From 1b351b7743194747e146fcfec29f370772d3293e Mon Sep 17 00:00:00 2001 From: Blaz Kristan Date: Sun, 20 Nov 2022 18:12:01 +0100 Subject: [PATCH] Broadcast presence on WiFi (re)connect immediately --- wled00/wled.cpp | 3 ++- wled00/wled.h | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/wled00/wled.cpp b/wled00/wled.cpp index 594a41d0..0442e3c5 100644 --- a/wled00/wled.cpp +++ b/wled00/wled.cpp @@ -133,7 +133,7 @@ void WLED::loop() ntpLastSyncTime = 0; strip.restartRuntime(); } - if (millis() - lastMqttReconnectAttempt > 30000) { + if (millis() - lastMqttReconnectAttempt > 30000 || lastMqttReconnectAttempt == 0) { // lastMqttReconnectAttempt==0 forces immediate broadcast lastMqttReconnectAttempt = millis(); initMqtt(); yield(); @@ -804,6 +804,7 @@ void WLED::handleConnection() initInterfaces(); userConnected(); usermods.connected(); + lastMqttReconnectAttempt = 0; // force immediate update // shut down AP if (apBehavior != AP_BEHAVIOR_ALWAYS && apActive) { diff --git a/wled00/wled.h b/wled00/wled.h index 44e08000..6fd4523c 100644 --- a/wled00/wled.h +++ b/wled00/wled.h @@ -8,7 +8,7 @@ */ // version code in format yymmddb (b = daily build) -#define VERSION 2211190 +#define VERSION 2211200 //uncomment this if you have a "my_config.h" file you'd like to use //#define WLED_USE_MY_CONFIG