Skip to content

Commit

Permalink
fix potential overflow on uptime (arendst#21965)
Browse files Browse the repository at this point in the history
* fix potential overflow

* fix potential overflow

* fix potential overflow

* fix potential overflow
  • Loading branch information
stefanbode authored Aug 15, 2024
1 parent 30cffa1 commit 851f11d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
10 changes: 4 additions & 6 deletions tasmota/tasmota_xdrv_driver/xdrv_27_esp32_shutter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -213,14 +213,12 @@ void ShutterAllowPreStartProcedure(uint8_t i) {
// Prestart allow e.g. to release a LOCK or something else before the movement start
// Anyway, as long var1 != 99 this is skipped (luckily)
#ifdef USE_RULES
uint32_t uptime_Local = 0;
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start? var%d <99>=<%s>, max10s?"),i + 1, rules_vars[i]);
uptime_Local = TasmotaGlobal.uptime;
while (uptime_Local + 10 > TasmotaGlobal.uptime
&& (String)rules_vars[i] == "99") {
loop();
// wait for response from rules
uint32_t start_time = millis();
while (TimePassedSince(start_time) < 10000 && (String)rules_vars[i] == "99") {
delay(1);
}
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. Done"));
#endif // USE_RULES
}

Expand Down
11 changes: 5 additions & 6 deletions tasmota/tasmota_xdrv_driver/xdrv_27_shutter.ino
Original file line number Diff line number Diff line change
Expand Up @@ -731,13 +731,12 @@ void ShutterAllowPreStartProcedure(uint8_t i) {
// What PreStartProcedure do you want to execute here?
// Anyway, as long var1 != 99 this is skipped (luckily)
#ifdef USE_RULES
uint32_t uptime_Local=0;
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start? var%d <99>=<%s>, max10s?"),i+1, rules_vars[i]);
uptime_Local = TasmotaGlobal.uptime;
while (uptime_Local+10 > TasmotaGlobal.uptime && (String)rules_vars[i] == "99") {
loop();
AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start? var%d <99>=<%s>, max10s?"),i + 1, rules_vars[i]);
// wait for response from rules
uint32_t start_time = millis();
while (TimePassedSince(start_time) < 10000 && (String)rules_vars[i] == "99") {
delay(1);
}
//AddLog(LOG_LEVEL_DEBUG_MORE, PSTR("SHT: Delay Start. Done"));
#endif // USE_RULES
}

Expand Down

0 comments on commit 851f11d

Please sign in to comment.