Fake "alarm off" event for legacy thermostat fixed

scheduled execution fixed
Aircon  driver relability improvement (working on 1-way lines)
This commit is contained in:
2025-08-11 23:44:58 +03:00
parent d71499442e
commit 5294617455
5 changed files with 10 additions and 6 deletions

View File

@@ -1094,7 +1094,8 @@ int Item::Ctrl(itemCmd cmd, char* subItem, uint8_t flags, bool authorized)
} }
/// ///
if (((flags & CTRL_SCHEDULED_CALL_RECURSION) == CTRL_SCHEDULED_CALL_RECURSION && itemType != CH_GROUP)) if (((flags & CTRL_SCHEDULED_CALL_RECURSION) == CTRL_SCHEDULED_CALL_RECURSION && itemType == CH_GROUP))
// if (((flags & CTRL_SCHEDULED_CALL_RECURSION) == CTRL_SCHEDULED_CALL_RECURSION && itemType != CH_GROUP))
{ {
debugSerial<<F("Skipping scheduled group exec")<<endl; debugSerial<<F("Skipping scheduled group exec")<<endl;
return -7; return -7;
@@ -1686,7 +1687,7 @@ if ((!driver || driver->isAllowed(cmd))
#endif #endif
} }
tStore.tempX100=cmd.getFloat()*100.; //Save measurement tStore.tempX100=cmd.getFloat()*100.; //Save measurement
tStore.timestamp16=millisNZ(8) & 0xFFFFU; //And timestamp tStore.timestamp16=millisNZ(8,0xFFFFU); //And timestamp
debugSerial<<F("THERM:")<<itemArr->name<<F(" T:")<<tStore.tempX100<<F(" TS:")<<tStore.timestamp16<<endl; debugSerial<<F("THERM:")<<itemArr->name<<F(" T:")<<tStore.tempX100<<F(" TS:")<<tStore.timestamp16<<endl;
setExt(tStore.asint); setExt(tStore.asint);
res=1; res=1;

View File

@@ -3282,7 +3282,7 @@ publishStat();
if (tStore.timestamp16) //Valid temperature if (tStore.timestamp16) //Valid temperature
{ {
if (isTimeOver(tStore.timestamp16,millisNZ(8) & 0xFFFF,PERIOD_THERMOSTAT_FAILED >> 8,0xFFFF)) if (isTimeOver(tStore.timestamp16,millisNZ(8,0xFFFF),PERIOD_THERMOSTAT_FAILED >> 8,0xFFFF))
{ {
errorSerial<<thermoItem->name<<F(" Alarm Expired\n"); errorSerial<<thermoItem->name<<F(" Alarm Expired\n");
#if not defined (NOIP) #if not defined (NOIP)

View File

@@ -326,6 +326,9 @@ if (!store)
return 0;} return 0;}
memset(store->data,0,sizeof(acPersistent::data)); memset(store->data,0,sizeof(acPersistent::data));
store->data[0]=255;
store->data[1]=255;
store->data[2]=0x22;
store->mode=0; store->mode=0;
store->power=0; store->power=0;
store->inCheck=0; store->inCheck=0;

View File

@@ -839,9 +839,9 @@ itemCmd mapInt(int32_t arg, aJsonObject* map)
} }
//Same as millis() but never return 0 or -1 //Same as millis() but never return 0 or -1
uint32_t millisNZ(uint8_t shift) uint32_t millisNZ(uint8_t shift, uint32_t mask)
{ {
uint32_t now = millis()>>shift; uint32_t now = (millis()>>shift) & mask;
if (!now || !(now+1)) now=1; if (!now || !(now+1)) now=1;
return now; return now;
} }

View File

@@ -73,7 +73,7 @@ bool isTimeOver(uint32_t timestamp, uint32_t currTime, uint32_t time, uint32_t m
bool executeCommand(aJsonObject* cmd, int8_t toggle = -1); bool executeCommand(aJsonObject* cmd, int8_t toggle = -1);
bool executeCommand(aJsonObject* cmd, int8_t toggle, itemCmd _itemCmd, aJsonObject* defaultItem=NULL, aJsonObject* defaultEmit=NULL, aJsonObject* defaultCan = NULL); bool executeCommand(aJsonObject* cmd, int8_t toggle, itemCmd _itemCmd, aJsonObject* defaultItem=NULL, aJsonObject* defaultEmit=NULL, aJsonObject* defaultCan = NULL);
itemCmd mapInt(int32_t arg, aJsonObject* map); itemCmd mapInt(int32_t arg, aJsonObject* map);
uint32_t millisNZ(uint8_t shift=0); uint32_t millisNZ(uint8_t shift=0, uint32_t mask=0xFFFFFFFFUL);
serialParamType str2SerialParam(char * str); serialParamType str2SerialParam(char * str);
String toString(const IPAddress& address); String toString(const IPAddress& address);
bool getPinVal(uint8_t pin); bool getPinVal(uint8_t pin);