From e8a7a209b585ecc2ed2d3d29f3bbf0db930c8a60 Mon Sep 17 00:00:00 2001 From: SteWers <42718143+SteWers@users.noreply.github.com> Date: Thu, 30 Apr 2026 16:21:49 +0200 Subject: [PATCH] Fix `PulseTime` `Remaining` (#24690) `PulseTime` `Remaining` sometimes returns a non zero value, when no pulsetime remains. It is caused by a rollover of `millis()`. --- tasmota/tasmota_support/support_tasmota.ino | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tasmota/tasmota_support/support_tasmota.ino b/tasmota/tasmota_support/support_tasmota.ino index d14aaa237..cc241e4ab 100644 --- a/tasmota/tasmota_support/support_tasmota.ino +++ b/tasmota/tasmota_support/support_tasmota.ino @@ -616,10 +616,9 @@ void SetPulseTimer(uint32_t index, uint32_t time) uint32_t GetPulseTimer(uint32_t index) { - long time = TimePassedSince(TasmotaGlobal.pulse_timer[index]); - if (time < 0) { - time *= -1; - return (time > 11100) ? (time / 1000) + 100 : (time > 0) ? time / 100 : 0; + int32_t time = -TimePassedSince(TasmotaGlobal.pulse_timer[index]); + if (TasmotaGlobal.pulse_timer[index] && time > 0) { + return (time > 11100) ? (time / 1000) + 100 : time / 100; } return 0; }