Refactor GPIO_HEARTBEAT

Remove delay from interrupt by refactoring GPIO_HEARTBEAT
This commit is contained in:
Theo Arends 2021-12-18 14:30:25 +01:00
parent 871bc9700e
commit 85731148c5
2 changed files with 6 additions and 6 deletions

View File

@ -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) {

View File

@ -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) {