diff --git a/compiled/lighthub21/uploadOTA.BAT b/compiled/lighthub21/uploadOTA.BAT new file mode 100644 index 0000000..4806c17 --- /dev/null +++ b/compiled/lighthub21/uploadOTA.BAT @@ -0,0 +1 @@ +..\tools\arduinoOTA -address 192.168.11.204 -port 80 -username arduino -password password -sketch firmware.bin -b -upload /sketch diff --git a/lighthub/abstractin.h b/lighthub/abstractin.h index 87f3748..7fe5abc 100644 --- a/lighthub/abstractin.h +++ b/lighthub/abstractin.h @@ -1,3 +1,5 @@ + + #pragma once #include "Arduino.h" #include "abstractch.h" diff --git a/lighthub/item.cpp b/lighthub/item.cpp index 1d5be76..830f29b 100644 --- a/lighthub/item.cpp +++ b/lighthub/item.cpp @@ -815,11 +815,11 @@ int Item::scheduleCommand(itemCmd cmd,bool authorized) aJsonObject *timestampObj = aJson.getArrayItem(itemArr, I_TIMESTAMP); if (timestampObj && cmd.getCmd()<=0xf) { - if ((cmd.getInt()>0) && (timestampObj->type == aJson_Int || timestampObj->type == aJson_NULL)) + if ((cmd.getInt()>0) && (timestampObj->type == aJson_Int || timestampObj->type == aJson_NULL || timestampObj->type == aJson_Reserved)) { timestampObj->valueint = millis()+cmd.getInt(); - timestampObj->type = aJson_Int; - timestampObj->subtype=(cmd.getCmd() & 0xF) | ((authorized?1:0)<<4); + timestampObj->type = (authorized?aJson_Reserved:aJson_Int); + timestampObj->subtype=(cmd.getCmd() & 0xF); debugSerial<valueint<subtype & 0xF; - bool authorized = timestampObj->subtype & 0x10; + bool authorized = (timestampObj->type==aJson_Reserved); + int32_t remain = (uint32_t) timestampObj->valueint - (uint32_t)millis(); if (cmd) { diff --git a/lighthub/main.cpp b/lighthub/main.cpp index d1f6650..697327d 100644 --- a/lighthub/main.cpp +++ b/lighthub/main.cpp @@ -165,10 +165,12 @@ int8_t mqttErrorRate=0; void watchdogSetup(void) {} //Do not remove - strong re-definition WDT Init for DUE #endif -bool cleanConf() +bool cleanConf(bool wait) { if (!root) return true; bool clean = true; +if (wait) +{ debugSerial<child; while (item) { - if (item->type == aJson_Array && aJson.getArraySize(item)>0) - { - if (item->type == aJson_Array && aJson.getArraySize(item)>0) - { + if (item->type == aJson_Array && (aJson.getArraySize(item)>0)) + { Item it(item->name); if (it.isValid()) it.Stop(); yield(); } item = item->next; - } } -} +} else debugSerial<itemArr->name); -delete store; +if (store) delete store; item->setPersistent(NULL); store = NULL; return 1; diff --git a/lighthub/modules/out_pid.cpp b/lighthub/modules/out_pid.cpp index d93522f..09bc24f 100644 --- a/lighthub/modules/out_pid.cpp +++ b/lighthub/modules/out_pid.cpp @@ -138,7 +138,8 @@ else int out_pid::Stop() { -debugSerial.println("PID: De-Init"); +debugSerial.print(F("PID: De-Init ")); +debugSerial.println(item->itemArr->name); if (store) delete (store->pid); delete store; item->setPersistent(NULL); diff --git a/lighthub/modules/out_pwm.cpp b/lighthub/modules/out_pwm.cpp index a5d6557..3b1e4a3 100644 --- a/lighthub/modules/out_pwm.cpp +++ b/lighthub/modules/out_pwm.cpp @@ -20,7 +20,7 @@ void analogWrite(int pin, int val) int out_pwm::Setup() { abstractOut::Setup(); -debugSerial<itemArr->name<itemArr->name<