mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 19:59:50 +03:00
Google Home Volume voicecommand compatible, XON-XOFF command added, Mega compilation issue fixed (Brige.cpp - updated Modbus lib required)
This commit is contained in:
30
build_flags_mega2560-net.sh
Normal file
30
build_flags_mega2560-net.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#! /bin/bash
|
||||
# usage:
|
||||
# first make your own copy of template
|
||||
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
||||
# then edit, change or comment something
|
||||
export FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru"
|
||||
#export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
|
||||
#export FLAGS="$FLAGS -DUSE_1W_PIN=12"
|
||||
#export FLAGS="$FLAGS -DSD_CARD_INSERTED"
|
||||
export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
|
||||
#export FLAGS="$FLAGS -DWiz5500"
|
||||
#export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
|
||||
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:ff"
|
||||
# export FLAGS="$FLAGS -DDMX_DISABLE"
|
||||
# export FLAGS="$FLAGS -DARTNET_ENABLE"
|
||||
# export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||
export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
||||
# export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
|
||||
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
|
||||
# export FLAGS="$FLAGS -DCONTROLLINO"
|
||||
# export FLAGS="$FLAGS -DESP_WIFI_AP=MYAP"
|
||||
# export FLAGS="$FLAGS -DESP_WIFI_PWD=MYPWD"
|
||||
# export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
|
||||
export FLAGS="$FLAGS -DDHT_DISABLE"
|
||||
# export FLAGS="$FLAGS -DRESET_PIN=5"
|
||||
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
|
||||
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
|
||||
# export FLAGS="$FLAGS -DW5500_CS_PIN=53"
|
||||
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||
echo $FLAGS
|
||||
30
build_flags_mega2560.sh
Normal file
30
build_flags_mega2560.sh
Normal file
@@ -0,0 +1,30 @@
|
||||
#! /bin/bash
|
||||
# usage:
|
||||
# first make your own copy of template
|
||||
# cp build_flags_template.sh build_flags_ENVNAME.sh
|
||||
# then edit, change or comment something
|
||||
export FLAGS="-DMY_CONFIG_SERVER=lazyhome.ru"
|
||||
#export FLAGS="$FLAGS -DWATCH_DOG_TICKER_DISABLE"
|
||||
#export FLAGS="$FLAGS -DUSE_1W_PIN=12"
|
||||
#export FLAGS="$FLAGS -DSD_CARD_INSERTED"
|
||||
export FLAGS="$FLAGS -DSERIAL_BAUD=115200"
|
||||
#export FLAGS="$FLAGS -DWiz5500"
|
||||
#export FLAGS="$FLAGS -DDISABLE_FREERAM_PRINT"
|
||||
export FLAGS="$FLAGS -DCUSTOM_FIRMWARE_MAC=de:ad:be:ef:fe:ff"
|
||||
# export FLAGS="$FLAGS -DDMX_DISABLE"
|
||||
# export FLAGS="$FLAGS -DARTNET_ENABLE"
|
||||
# export FLAGS="$FLAGS -DMODBUS_DISABLE"
|
||||
# export FLAGS="$FLAGS -DOWIRE_DISABLE"
|
||||
# export FLAGS="$FLAGS -DAVR_DMXOUT_PIN=18"
|
||||
# export FLAGS="$FLAGS -DLAN_INIT_DELAY=2000"
|
||||
# export FLAGS="$FLAGS -DCONTROLLINO"
|
||||
# export FLAGS="$FLAGS -DESP_WIFI_AP=MYAP"
|
||||
# export FLAGS="$FLAGS -DESP_WIFI_PWD=MYPWD"
|
||||
# export FLAGS="$FLAGS -DWIFI_MANAGER_DISABLE"
|
||||
export FLAGS="$FLAGS -DDHT_DISABLE"
|
||||
# export FLAGS="$FLAGS -DRESET_PIN=5"
|
||||
# export FLAGS="$FLAGS -DDHCP_RETRY_INTERVAL=60000"
|
||||
# export FLAGS="$FLAGS -DRESTART_LAN_ON_MQTT_ERRORS"
|
||||
# export FLAGS="$FLAGS -DW5500_CS_PIN=53"
|
||||
export FLAGS="$FLAGS -DPIO_SRC_REV="$(git log --pretty=format:%h_%ad -1 --date=short)
|
||||
echo $FLAGS
|
||||
@@ -55,6 +55,8 @@ int txt2cmd(char *payload) {
|
||||
else if (strcmp(payload, "REST") == 0) cmd = CMD_RESTORE;
|
||||
else if (strcmp(payload, "TOGGLE") == 0) cmd = CMD_TOGGLE;
|
||||
else if (strcmp(payload, "HALT") == 0) cmd = CMD_HALT;
|
||||
else if (strcmp(payload, "XON") == 0) cmd = CMD_XON;
|
||||
else if (strcmp(payload, "XOFF") == 0) cmd = CMD_XOFF;
|
||||
else if (*payload == '-' || (*payload >= '0' && *payload <= '9')) cmd = 0;
|
||||
else if (*payload == '{') cmd = -2;
|
||||
else if (*payload == '#') cmd = -3;
|
||||
@@ -277,6 +279,17 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
default:
|
||||
return -3;
|
||||
}//switch old cmd
|
||||
case CMD_XOFF:
|
||||
if (itemType != CH_GROUP) //individual threating of channels. Ignore restore command for groups
|
||||
switch (t = getCmd()) {
|
||||
case CMD_XON: //previous command was CMD_XON ?
|
||||
Serial.print(F("Turned off from:"));
|
||||
Serial.println(t);
|
||||
cmd = CMD_OFF; //turning Off
|
||||
break;
|
||||
default:
|
||||
return -3;
|
||||
}//switch old cmd
|
||||
} //switch cmd
|
||||
|
||||
switch (cmd) {
|
||||
@@ -290,10 +303,20 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
if (!Par[1]) itemType = CH_WHITE;
|
||||
case CH_GROUP: //Save for groups as well
|
||||
case CH_RGB:
|
||||
if (n == 3) { // Full triplet passed
|
||||
st.h = Par[0];
|
||||
st.s = Par[1];
|
||||
st.v = Par[2];
|
||||
setVal(st.aslong);
|
||||
} else // Just volume passed
|
||||
{
|
||||
st.aslong = getVal(); // restore Colour
|
||||
st.v = Par[0]; // override volume
|
||||
setVal(st.aslong); // Save back
|
||||
Par[0] = st.h;
|
||||
Par[1] = st.s;
|
||||
Par[2] = st.v;
|
||||
}
|
||||
if (send) SendStatus(0,3,Par,true); // Send back triplet ?
|
||||
break;
|
||||
|
||||
@@ -314,6 +337,7 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
break;
|
||||
|
||||
case CMD_ON:
|
||||
case CMD_XON:
|
||||
if (itemType==CH_RGBW && getCmd() == CMD_ON && getEnableCMD(500)) {
|
||||
Serial.println(F("Force White"));
|
||||
itemType = CH_WHITE;
|
||||
@@ -547,7 +571,7 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send) {
|
||||
case CH_RELAY: {
|
||||
int k;
|
||||
pinMode(iaddr, OUTPUT);
|
||||
digitalWrite(iaddr, k = ((cmd == CMD_ON) ? HIGH : LOW));
|
||||
digitalWrite(iaddr, k = ((cmd == CMD_ON || cmd == CMD_XON) ? HIGH : LOW));
|
||||
Serial.print(F("Pin:"));
|
||||
Serial.print(iaddr);
|
||||
Serial.print(F("="));
|
||||
@@ -629,6 +653,7 @@ int Item::isActive() {
|
||||
// Simple check last command first
|
||||
switch (cmd) {
|
||||
case CMD_ON:
|
||||
case CMD_XON:
|
||||
//Serial.println(" active");
|
||||
return 1;
|
||||
case CMD_OFF:
|
||||
@@ -1146,6 +1171,7 @@ int Item::SendStatus(short cmd, short n, int *Par, boolean deffered) {
|
||||
|
||||
switch (cmd) {
|
||||
case CMD_ON:
|
||||
case CMD_XON:
|
||||
strcpy(valstr, "ON");
|
||||
break;
|
||||
case CMD_OFF:
|
||||
|
||||
@@ -33,9 +33,11 @@ e-mail anklimov@gmail.com
|
||||
|
||||
#define CMD_ON 1
|
||||
#define CMD_OFF 2
|
||||
#define CMD_HALT 5
|
||||
#define CMD_RESTORE 3
|
||||
#define CMD_RESTORE 3 //on only if was turned off by CMD_HALT
|
||||
#define CMD_TOGGLE 4
|
||||
#define CMD_HALT 5 //just Off
|
||||
#define CMD_XON 6 //just on
|
||||
#define CMD_XOFF 7 //off only if was previously turned on by CMD_XON
|
||||
#define CMD_CURTEMP 127
|
||||
#define CMD_SET 9
|
||||
#define CMD_RETRY 64
|
||||
|
||||
@@ -37,15 +37,23 @@
|
||||
//#define wdt_en()
|
||||
//#define wdt_dis()
|
||||
//#endif
|
||||
|
||||
#if defined(WATCH_DOG_TICKER_DISABLE) && defined(__AVR__)
|
||||
#if defined(__AVR__)
|
||||
#if defined(WATCH_DOG_TICKER_DISABLE)
|
||||
#define wdt_en() wdt_disable()
|
||||
#define wdt_dis() wdt_disable()
|
||||
#define wdt_res() wdt_disable()
|
||||
#else
|
||||
#define wdt_en() wdt_enable(WDTO_8S)
|
||||
#define wdt_dis() wdt_disable()
|
||||
#define wdt_res() wdt_reset()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef OWIRE_DISABLE
|
||||
#include "DallasTemperature.h"
|
||||
#endif
|
||||
|
||||
#include "Arduino.h"
|
||||
#include "DallasTemperature.h"
|
||||
#include <PubSubClient.h>
|
||||
#include <SPI.h>
|
||||
#include "utils.h"
|
||||
@@ -56,18 +64,18 @@
|
||||
#include "stdarg.h"
|
||||
#include "item.h"
|
||||
#include "inputs.h"
|
||||
|
||||
#ifndef ARDUINO_ARCH_STM32F1
|
||||
#include "FastLED.h"
|
||||
#endif
|
||||
|
||||
#include "Dns.h"
|
||||
//#include "hsv2rgb.h"
|
||||
|
||||
#if defined(__SAM3X8E__)
|
||||
|
||||
#include <DueFlashStorage.h>
|
||||
#include <watchdog.h>
|
||||
#include <ArduinoHttpClient.h>
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(__AVR__)
|
||||
@@ -150,7 +158,9 @@ void restoreState();
|
||||
|
||||
lan_status lanLoop();
|
||||
|
||||
#ifndef OWIRE_DISABLE
|
||||
void Changed(int i, DeviceAddress addr, int val);
|
||||
#endif
|
||||
|
||||
void modbusIdle(void);
|
||||
|
||||
|
||||
@@ -10,13 +10,13 @@
|
||||
[platformio]
|
||||
src_dir = lighthub
|
||||
env_default =
|
||||
; megaatmega2560
|
||||
megaatmega2560
|
||||
; megaatmega2560-net
|
||||
; due
|
||||
; esp8266
|
||||
; esp32
|
||||
; megaatmega2560-5500
|
||||
due-5500
|
||||
; due-5500
|
||||
; controllino
|
||||
; stm32
|
||||
|
||||
@@ -112,7 +112,6 @@ lib_deps =
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/anklimov/DMXSerial
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/anklimov/Ethernet2
|
||||
https://github.com/PaulStoffregen/SPI.git
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
@@ -120,6 +119,7 @@ lib_deps =
|
||||
EEPROM
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
https://github.com/arcao/Syslog.git
|
||||
|
||||
[env:esp8266]
|
||||
platform = espressif8266
|
||||
@@ -168,6 +168,7 @@ lib_deps =
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
|
||||
|
||||
[env:due-5500]
|
||||
platform = atmelsam
|
||||
framework = arduino
|
||||
@@ -210,7 +211,6 @@ lib_deps =
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/anklimov/DMXSerial
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/anklimov/Ethernet2
|
||||
https://github.com/PaulStoffregen/SPI.git
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
|
||||
Reference in New Issue
Block a user