From cf32071ee095ddc6f98c4529158828fb0f1aaa3c Mon Sep 17 00:00:00 2001 From: Alexey Zholtikov Date: Mon, 13 Feb 2023 19:04:46 +0300 Subject: [PATCH] Version 1.42 Fixed bug with ESP-NOW devices not getting restart or update command. Minor main code refactoring. --- src/main.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 4dff492..79f93eb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -193,12 +193,12 @@ void setup() void loop() { - if (mqttAvailabilityCheckTimerSemaphore) - checkMqttAvailability(); if (keepAliveMessageTimerSemaphore) sendKeepAliveMessage(); if (attributesMessageTimerSemaphore) sendAttributesMessage(); + if (mqttAvailabilityCheckTimerSemaphore) + checkMqttAvailability(); if (workMode == ESP_NOW_WIFI) mqttWifiClient.loop(); if (workMode == ESP_NOW_LAN) @@ -679,6 +679,8 @@ void checkMqttAvailability() mqttWifiClient.subscribe((topicPrefix + "/espnow_led/#").c_str()); sendConfigMessage(); + sendAttributesMessage(); + sendKeepAliveMessage(); } } @@ -696,6 +698,8 @@ void checkMqttAvailability() mqttEthClient.subscribe((topicPrefix + "/espnow_led/#").c_str()); sendConfigMessage(); + sendAttributesMessage(); + sendKeepAliveMessage(); } } }