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:
2020-03-03 02:27:09 +03:00
parent 504280ca84
commit d5e9686ca9
3 changed files with 60 additions and 24 deletions

View File

@@ -1,3 +1,3 @@
-DMODBUS_DISABLE -DMODBUS_DISABLE
#-DCOUNTER_DISABLE #-DCOUNTER_DISABLE
-DOTA #-DOTA

View File

@@ -89,6 +89,26 @@ int txt2cmd(char *payload) {
return cmd; 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 txt2subItem(char *payload) {
int cmd = S_NOTFOUND; 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=("); debugSerial<<F("RAM=")<<freeRam()<<F(" Item=")<<itemArr->name<<F(" Sub=")<<subItem<<F(" Suff=")<<suffixCode<<F(" Cmd=")<<cmd<<F(" Par=(");
if (!itemArr) return -1; 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}; int Par[MAXCTRLPAR] = {0, 0, 0};
if (Parameters) if (Parameters)
for (short i=0;i<n && i<MAXCTRLPAR;i++){ 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()) { switch (t = getCmd()) {
case CMD_HALT: //previous command was HALT ? case CMD_HALT: //previous command was HALT ?
debugSerial << F("Restored from:") << t << endl; 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; break;
default: default:
return -3; return -3;
@@ -1842,7 +1875,7 @@ int Item::SendStatus(int sendFlags) {
break; break;
case CMD_ON: case CMD_ON:
case CMD_XON: 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); setTopic(addrstr,sizeof(addrstr),T_OUT);

View File

@@ -29,7 +29,7 @@ default_envs =
; due-5100 ; due-5100
; Arduino DUE + Ethernet shield Wiznet 5500 ; Arduino DUE + Ethernet shield Wiznet 5500
due-5500 ; due-5500
; ESP 8266 ; ESP 8266
; esp8266-wifi ; esp8266-wifi
@@ -86,6 +86,7 @@ lib_ignore =
SparkFun CCS811 Arduino Library SparkFun CCS811 Arduino Library
ESP8266HTTPClient ESP8266HTTPClient
M5Stack M5Stack
ArduinoOTA
lib_deps = lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git https://github.com/anklimov/Arduino-Temperature-Control-Library.git
@@ -97,13 +98,13 @@ lib_deps =
https://github.com/anklimov/ModbusMaster https://github.com/anklimov/ModbusMaster
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
; https://github.com/anklimov/Artnet.git ; https://github.com/anklimov/Artnet.git
; FastLED ; FastLED@3.3.2
Adafruit Unified Sensor Adafruit Unified Sensor
DHT sensor library DHT sensor library
Streaming Streaming
https://github.com/anklimov/NRFFlashStorage https://github.com/anklimov/NRFFlashStorage
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA ; https://github.com/jandrassy/ArduinoOTA
; https://github.com/livello/PrintEx#is-select-redecl ; 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/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/ESP-Dmx https://github.com/anklimov/ESP-Dmx
FastLED FastLED@3.3.2
ClosedCube HDC1080 ClosedCube HDC1080
;SparkFun CCS811 Arduino Library ;SparkFun CCS811 Arduino Library
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7 https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7
M5Stack M5Stack
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:esp32-wifi] [env:esp32-wifi]
platform = espressif32 platform = espressif32
@@ -198,12 +199,12 @@ lib_deps =
https://github.com/anklimov/Arduino-Temperature-Control-Library.git https://github.com/anklimov/Arduino-Temperature-Control-Library.git
https://github.com/anklimov/DS2482_OneWire https://github.com/anklimov/DS2482_OneWire
https://github.com/anklimov/ESP-Dmx https://github.com/anklimov/ESP-Dmx
FastLED FastLED@3.3.2
ClosedCube HDC1080 ClosedCube HDC1080
;SparkFun CCS811 Arduino Library ;SparkFun CCS811 Arduino Library
https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7 https://github.com/sparkfun/SparkFun_CCS811_Arduino_Library.git@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:due-5100] [env:due-5100]
platform = atmelsam platform = atmelsam
@@ -225,6 +226,7 @@ lib_ignore =
UIPEthernet UIPEthernet
EEPROM EEPROM
M5Stack M5Stack
ArduinoOTA
lib_deps = lib_deps =
https://github.com/sebnil/DueFlashStorage https://github.com/sebnil/DueFlashStorage
https://github.com/anklimov/Arduino-Temperature-Control-Library.git https://github.com/anklimov/Arduino-Temperature-Control-Library.git
@@ -237,7 +239,7 @@ lib_deps =
https://github.com/anklimov/Ethernet https://github.com/anklimov/Ethernet
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
SD SD
SdFat SdFat
Adafruit Unified Sensor Adafruit Unified Sensor
@@ -247,7 +249,7 @@ lib_deps =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library@~1.0.7 SparkFun CCS811 Arduino Library@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA ;https://github.com/jandrassy/ArduinoOTA
[env:mega2560slim-5100] [env:mega2560slim-5100]
platform = atmelavr platform = atmelavr
@@ -279,7 +281,7 @@ lib_deps =
https://github.com/anklimov/Ethernet https://github.com/anklimov/Ethernet
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
;EEPROM ;EEPROM
Adafruit Unified Sensor Adafruit Unified Sensor
DHT sensor library DHT sensor library
@@ -288,7 +290,7 @@ lib_deps =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library@~1.0.7 SparkFun CCS811 Arduino Library@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:mega2560-5500] [env:mega2560-5500]
platform = atmelavr platform = atmelavr
@@ -320,7 +322,7 @@ lib_deps =
https://github.com/anklimov/Ethernet2 https://github.com/anklimov/Ethernet2
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
Adafruit Unified Sensor Adafruit Unified Sensor
DHT sensor library DHT sensor library
https://github.com/arcao/Syslog.git https://github.com/arcao/Syslog.git
@@ -328,7 +330,7 @@ lib_deps =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library@~1.0.7 SparkFun CCS811 Arduino Library@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:esp8266-wifi] [env:esp8266-wifi]
@@ -384,6 +386,7 @@ lib_deps =
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA ArduinoOTA
[env:mega2560-5100] [env:mega2560-5100]
platform = atmelavr platform = atmelavr
board = megaatmega2560 board = megaatmega2560
@@ -416,7 +419,7 @@ lib_deps =
https://github.com/anklimov/Ethernet https://github.com/anklimov/Ethernet
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
Adafruit Unified Sensor Adafruit Unified Sensor
DHT sensor library DHT sensor library
https://github.com/arcao/Syslog.git https://github.com/arcao/Syslog.git
@@ -424,7 +427,7 @@ lib_deps =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library@~1.0.7 SparkFun CCS811 Arduino Library@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:due-5500] [env:due-5500]
platform = atmelsam platform = atmelsam
@@ -461,7 +464,7 @@ lib_deps =
https://github.com/anklimov/Ethernet2 https://github.com/anklimov/Ethernet2
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
SD SD
SdFat SdFat
Adafruit Unified Sensor Adafruit Unified Sensor
@@ -508,7 +511,7 @@ lib_deps =
https://github.com/anklimov/Ethernet2 https://github.com/anklimov/Ethernet2
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
SD SD
SdFat SdFat
Adafruit Unified Sensor Adafruit Unified Sensor
@@ -519,7 +522,7 @@ lib_deps =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library@~1.0.7 SparkFun CCS811 Arduino Library@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:controllino] [env:controllino]
@@ -553,7 +556,7 @@ lib_deps =
https://github.com/anklimov/Ethernet https://github.com/anklimov/Ethernet
https://github.com/knolleary/pubsubclient.git https://github.com/knolleary/pubsubclient.git
https://github.com/anklimov/Artnet.git https://github.com/anklimov/Artnet.git
FastLED FastLED@3.3.2
;EEPROM ;EEPROM
Adafruit Unified Sensor Adafruit Unified Sensor
DHT sensor library DHT sensor library
@@ -562,7 +565,7 @@ lib_deps =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library@~1.0.7 SparkFun CCS811 Arduino Library@~1.0.7
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA https://github.com/jandrassy/ArduinoOTA
[env:stm32-enc2860] [env:stm32-enc2860]
platform = ststm32 platform = ststm32
@@ -600,6 +603,7 @@ lib_ignore =
ClosedCube HDC1080 ClosedCube HDC1080
SparkFun CCS811 Arduino Library SparkFun CCS811 Arduino Library
M5Stack M5Stack
ArduinoOTA
lib_deps = lib_deps =
https://github.com/anklimov/aJson https://github.com/anklimov/aJson
https://github.com/anklimov/CmdArduino https://github.com/anklimov/CmdArduino
@@ -609,4 +613,3 @@ lib_deps =
UIPEthernet UIPEthernet
https://github.com/anklimov/NRFFlashStorage https://github.com/anklimov/NRFFlashStorage
Adafruit NeoPixel Adafruit NeoPixel
ArduinoOTA