From 85731148c52b4121b2808ff1ced47cf3658f762d Mon Sep 17 00:00:00 2001 From: Theo Arends <11044339+arendst@users.noreply.github.com> Date: Sat, 18 Dec 2021 14:30:25 +0100 Subject: [PATCH] Refactor GPIO_HEARTBEAT Remove delay from interrupt by refactoring GPIO_HEARTBEAT --- tasmota/support_rtc.ino | 6 ------ tasmota/support_tasmota.ino | 6 ++++++ 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tasmota/support_rtc.ino b/tasmota/support_rtc.ino index 03b7164fa..fe5fd10ec 100644 --- a/tasmota/support_rtc.ino +++ b/tasmota/support_rtc.ino @@ -377,12 +377,6 @@ void RtcSecond(void) static uint32_t last_sync = 0; static bool mutex = false; - if ((TasmotaGlobal.init_state >= INIT_GPIOS) && PinUsed(GPIO_HEARTBEAT)) { - digitalWrite(Pin(GPIO_HEARTBEAT), ~TasmotaGlobal.heartbeat_inverted &1); - delayMicroseconds(50); - digitalWrite(Pin(GPIO_HEARTBEAT), TasmotaGlobal.heartbeat_inverted); - } - if (mutex) { return; } if (Rtc.time_synced) { diff --git a/tasmota/support_tasmota.ino b/tasmota/support_tasmota.ino index 3129c2831..72a1b7ced 100644 --- a/tasmota/support_tasmota.ino +++ b/tasmota/support_tasmota.ino @@ -983,6 +983,12 @@ void PerformEverySecond(void) ResetGlobalValues(); + if ((TasmotaGlobal.init_state >= INIT_GPIOS) && PinUsed(GPIO_HEARTBEAT)) { + digitalWrite(Pin(GPIO_HEARTBEAT), ~TasmotaGlobal.heartbeat_inverted &1); + delayMicroseconds(50); + digitalWrite(Pin(GPIO_HEARTBEAT), TasmotaGlobal.heartbeat_inverted); + } + if (Settings->tele_period || (3601 == TasmotaGlobal.tele_period)) { if (TasmotaGlobal.tele_period >= 9999) { if (!TasmotaGlobal.global_state.network_down) {