mirror of
https://github.com/anklimov/lighthub
synced 2025-12-06 11:49:51 +03:00
Compilation issue (with updated libs) fixed for most platforms
Command now can be refined for particular channel state using SUBITEM=CMD
This commit is contained in:
@@ -1,3 +1,3 @@
|
||||
-DMODBUS_DISABLE
|
||||
#-DCOUNTER_DISABLE
|
||||
-DOTA
|
||||
#-DOTA
|
||||
|
||||
@@ -89,6 +89,26 @@ int txt2cmd(char *payload) {
|
||||
return cmd;
|
||||
}
|
||||
|
||||
int subitem2cmd(char *payload) {
|
||||
int cmd = 0;
|
||||
|
||||
// Check for command
|
||||
if (payload)
|
||||
if (strcmp_P(payload, ON_P) == 0) cmd = CMD_ON;
|
||||
else if (strcmp_P(payload, OFF_P) == 0) cmd = CMD_OFF;
|
||||
//else if (strcmp_P(payload, REST_P) == 0) cmd = CMD_RESTORE;
|
||||
//else if (strcmp_P(payload, TOGGLE_P) == 0) cmd = CMD_TOGGLE;
|
||||
else if (strcmp_P(payload, HALT_P) == 0) cmd = CMD_HALT;
|
||||
else if (strcmp_P(payload, XON_P) == 0) cmd = CMD_XON;
|
||||
//else if (strcmp_P(payload, XOFF_P) == 0) cmd = CMD_XOFF;
|
||||
else if (strcmp_P(payload, HEAT_P) == 0) cmd = CMD_HEAT;
|
||||
else if (strcmp_P(payload, COOL_P) == 0) cmd = CMD_COOL;
|
||||
else if (strcmp_P(payload, AUTO_P) == 0) cmd = CMD_AUTO;
|
||||
else if (strcmp_P(payload, FAN_ONLY_P) == 0) cmd = CMD_FAN;
|
||||
else if (strcmp_P(payload, DRY_P) == 0) cmd = CMD_DRY;
|
||||
|
||||
return cmd;
|
||||
}
|
||||
|
||||
int txt2subItem(char *payload) {
|
||||
int cmd = S_NOTFOUND;
|
||||
@@ -501,6 +521,18 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
||||
|
||||
debugSerial<<F("RAM=")<<freeRam()<<F(" Item=")<<itemArr->name<<F(" Sub=")<<subItem<<F(" Suff=")<<suffixCode<<F(" Cmd=")<<cmd<<F(" Par=(");
|
||||
if (!itemArr) return -1;
|
||||
|
||||
if (itemType != CH_GROUP )
|
||||
{
|
||||
//Check if subitem is some sort of command
|
||||
int subitemCmd = subitem2cmd(subItem);
|
||||
if (subitemCmd && subitemCmd != getCmd())
|
||||
{
|
||||
debugSerial<<F("Ignored, stored cmd=")<<getCmd()<<endl;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
int Par[MAXCTRLPAR] = {0, 0, 0};
|
||||
if (Parameters)
|
||||
for (short i=0;i<n && i<MAXCTRLPAR;i++){
|
||||
@@ -556,7 +588,8 @@ int Item::Ctrl(short cmd, short n, int *Parameters, boolean send, int suffixCode
|
||||
switch (t = getCmd()) {
|
||||
case CMD_HALT: //previous command was HALT ?
|
||||
debugSerial << F("Restored from:") << t << endl;
|
||||
cmd = CMD_ON; //turning on
|
||||
if (itemType == CH_THERMO) cmd = CMD_AUTO;
|
||||
else cmd = CMD_ON; //turning on
|
||||
break;
|
||||
default:
|
||||
return -3;
|
||||
@@ -1842,7 +1875,7 @@ int Item::SendStatus(int sendFlags) {
|
||||
break;
|
||||
case CMD_ON:
|
||||
case CMD_XON:
|
||||
if (itemType == CH_THERMO) strcpy_P(cmdstr, HEAT_P);
|
||||
if (itemType == CH_THERMO) strcpy_P(cmdstr, AUTO_P);
|
||||
}
|
||||
|
||||
setTopic(addrstr,sizeof(addrstr),T_OUT);
|
||||
|
||||
@@ -29,7 +29,7 @@ default_envs =
|
||||
; due-5100
|
||||
|
||||
; Arduino DUE + Ethernet shield Wiznet 5500
|
||||
due-5500
|
||||
; due-5500
|
||||
|
||||
; ESP 8266
|
||||
; esp8266-wifi
|
||||
@@ -86,6 +86,7 @@ lib_ignore =
|
||||
SparkFun CCS811 Arduino Library
|
||||
ESP8266HTTPClient
|
||||
M5Stack
|
||||
ArduinoOTA
|
||||
|
||||
lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
@@ -97,13 +98,13 @@ lib_deps =
|
||||
https://github.com/anklimov/ModbusMaster
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
; https://github.com/anklimov/Artnet.git
|
||||
; FastLED
|
||||
; FastLED@3.3.2
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
Streaming
|
||||
https://github.com/anklimov/NRFFlashStorage
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
; https://github.com/jandrassy/ArduinoOTA
|
||||
; https://github.com/livello/PrintEx#is-select-redecl
|
||||
|
||||
|
||||
@@ -148,13 +149,13 @@ lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/anklimov/DS2482_OneWire
|
||||
https://github.com/anklimov/ESP-Dmx
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
ClosedCube HDC1080
|
||||
;SparkFun CCS811 Arduino Library
|
||||
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7
|
||||
M5Stack
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
[env:esp32-wifi]
|
||||
platform = espressif32
|
||||
@@ -198,12 +199,12 @@ lib_deps =
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
https://github.com/anklimov/DS2482_OneWire
|
||||
https://github.com/anklimov/ESP-Dmx
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
ClosedCube HDC1080
|
||||
;SparkFun CCS811 Arduino Library
|
||||
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
[env:due-5100]
|
||||
platform = atmelsam
|
||||
@@ -225,6 +226,7 @@ lib_ignore =
|
||||
UIPEthernet
|
||||
EEPROM
|
||||
M5Stack
|
||||
ArduinoOTA
|
||||
lib_deps =
|
||||
https://github.com/sebnil/DueFlashStorage
|
||||
https://github.com/anklimov/Arduino-Temperature-Control-Library.git
|
||||
@@ -237,7 +239,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
SD
|
||||
SdFat
|
||||
Adafruit Unified Sensor
|
||||
@@ -247,7 +249,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
;https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
[env:mega2560slim-5100]
|
||||
platform = atmelavr
|
||||
@@ -279,7 +281,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
;EEPROM
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
@@ -288,7 +290,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
[env:mega2560-5500]
|
||||
platform = atmelavr
|
||||
@@ -320,7 +322,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet2
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
https://github.com/arcao/Syslog.git
|
||||
@@ -328,7 +330,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
|
||||
[env:esp8266-wifi]
|
||||
@@ -384,6 +386,7 @@ lib_deps =
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
|
||||
|
||||
[env:mega2560-5100]
|
||||
platform = atmelavr
|
||||
board = megaatmega2560
|
||||
@@ -416,7 +419,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
https://github.com/arcao/Syslog.git
|
||||
@@ -424,7 +427,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
[env:due-5500]
|
||||
platform = atmelsam
|
||||
@@ -461,7 +464,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet2
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
SD
|
||||
SdFat
|
||||
Adafruit Unified Sensor
|
||||
@@ -508,7 +511,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet2
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
SD
|
||||
SdFat
|
||||
Adafruit Unified Sensor
|
||||
@@ -519,7 +522,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
|
||||
[env:controllino]
|
||||
@@ -553,7 +556,7 @@ lib_deps =
|
||||
https://github.com/anklimov/Ethernet
|
||||
https://github.com/knolleary/pubsubclient.git
|
||||
https://github.com/anklimov/Artnet.git
|
||||
FastLED
|
||||
FastLED@3.3.2
|
||||
;EEPROM
|
||||
Adafruit Unified Sensor
|
||||
DHT sensor library
|
||||
@@ -562,7 +565,7 @@ lib_deps =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library@~1.0.7
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
https://github.com/jandrassy/ArduinoOTA
|
||||
|
||||
[env:stm32-enc2860]
|
||||
platform = ststm32
|
||||
@@ -600,6 +603,7 @@ lib_ignore =
|
||||
ClosedCube HDC1080
|
||||
SparkFun CCS811 Arduino Library
|
||||
M5Stack
|
||||
ArduinoOTA
|
||||
lib_deps =
|
||||
https://github.com/anklimov/aJson
|
||||
https://github.com/anklimov/CmdArduino
|
||||
@@ -609,4 +613,3 @@ lib_deps =
|
||||
UIPEthernet
|
||||
https://github.com/anklimov/NRFFlashStorage
|
||||
Adafruit NeoPixel
|
||||
ArduinoOTA
|
||||
|
||||
Reference in New Issue
Block a user