Fix PulseTime Remaining (#24690)

`PulseTime` `Remaining` sometimes returns a non zero value, when no pulsetime remains. It is caused by a rollover of `millis()`.
This commit is contained in:
SteWers
2026-04-30 16:21:49 +02:00
committed by GitHub
parent 487d4a7165
commit e8a7a209b5

View File

@@ -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;
}