Skip to content

Commit e8a7a20

Browse files
authored
Fix PulseTime Remaining (#24690)
`PulseTime` `Remaining` sometimes returns a non zero value, when no pulsetime remains. It is caused by a rollover of `millis()`.
1 parent 487d4a7 commit e8a7a20

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

tasmota/tasmota_support/support_tasmota.ino

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -616,10 +616,9 @@ void SetPulseTimer(uint32_t index, uint32_t time)
616616

617617
uint32_t GetPulseTimer(uint32_t index)
618618
{
619-
long time = TimePassedSince(TasmotaGlobal.pulse_timer[index]);
620-
if (time < 0) {
621-
time *= -1;
622-
return (time > 11100) ? (time / 1000) + 100 : (time > 0) ? time / 100 : 0;
619+
int32_t time = -TimePassedSince(TasmotaGlobal.pulse_timer[index]);
620+
if (TasmotaGlobal.pulse_timer[index] && time > 0) {
621+
return (time > 11100) ? (time / 1000) + 100 : time / 100;
623622
}
624623
return 0;
625624
}

0 commit comments

Comments
 (0)