From 02df35b6b5d9173e76fd3a5589c0672a1a7da441 Mon Sep 17 00:00:00 2001 From: Hadinger Date: Sun, 2 Feb 2020 18:02:31 +0100 Subject: [PATCH] Safeguard if delay is too high --- tasmota/core_esp8266_waveform.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tasmota/core_esp8266_waveform.cpp b/tasmota/core_esp8266_waveform.cpp index 14cec9789..8ee2d9eba 100644 --- a/tasmota/core_esp8266_waveform.cpp +++ b/tasmota/core_esp8266_waveform.cpp @@ -262,6 +262,7 @@ static ICACHE_RAM_ATTR void timer1Interrupt() { // Check for toggles int32_t cyclesToGo = wave->nextServiceCycle - now; if (cyclesToGo < 0) { + cyclesToGo = -((-cyclesToGo) % (wave->nextTimeHighCycles + wave->nextTimeLowCycles)); waveformState ^= mask; if (waveformState & mask) { if (i == 16) {