diff --git a/include/param_prj.h b/include/param_prj.h index 6731ea7..f4ac6f4 100644 --- a/include/param_prj.h +++ b/include/param_prj.h @@ -125,9 +125,9 @@ #define CAT_COMM "Communication" // SKUDAK customization suffix: bump on every Skudak-side change so the OpenInverter -// web UI shows a distinct version (e.g. "4=1.19.R-S1") and we can visually confirm +// web UI shows a distinct version (e.g. "4=1.19.R-S2") and we can visually confirm // the right firmware is flashed. Match the stm32-sine -S convention. -#define VERSTR STRINGIFY(4=VER-S1) +#define VERSTR STRINGIFY(4=VER-S2) /***** enums ******/ diff --git a/src/charger.cpp b/src/charger.cpp index db1c528..b3cd21d 100644 --- a/src/charger.cpp +++ b/src/charger.cpp @@ -85,9 +85,15 @@ bool CheckTimeout() bool CheckDelay() { uint32_t now = rtc_get_counter_val(); - uint32_t start = Param::GetInt(Param::timedly) * 60; + // Upstream uses uint32_t here, which wraps a negative timedly (the param's + // documented -1 "no delay" sentinel) into a ~4 billion-second timeout that + // never expires — leaving the state machine wedged in WaitStart forever. + // Use signed math for the short-circuit so timedly <= 0 still means + // "start immediately." The cast on the elapsed-comparison side is only + // reached when start > 0, so it can't reinterpret a negative as huge. + int start = Param::GetInt(Param::timedly) * 60; - return start <= 0 || (now - startTime) > start; + return start <= 0 || (now - startTime) > (uint32_t)start; }