Broadcast presence on WiFi (re)connect immediately

This commit is contained in:
Blaz Kristan 2022-11-20 18:12:01 +01:00
parent e409bd298a
commit 1b351b7743
2 changed files with 3 additions and 2 deletions

View File

@ -133,7 +133,7 @@ void WLED::loop()
ntpLastSyncTime = 0; ntpLastSyncTime = 0;
strip.restartRuntime(); strip.restartRuntime();
} }
if (millis() - lastMqttReconnectAttempt > 30000) { if (millis() - lastMqttReconnectAttempt > 30000 || lastMqttReconnectAttempt == 0) { // lastMqttReconnectAttempt==0 forces immediate broadcast
lastMqttReconnectAttempt = millis(); lastMqttReconnectAttempt = millis();
initMqtt(); initMqtt();
yield(); yield();
@ -804,6 +804,7 @@ void WLED::handleConnection()
initInterfaces(); initInterfaces();
userConnected(); userConnected();
usermods.connected(); usermods.connected();
lastMqttReconnectAttempt = 0; // force immediate update
// shut down AP // shut down AP
if (apBehavior != AP_BEHAVIOR_ALWAYS && apActive) { if (apBehavior != AP_BEHAVIOR_ALWAYS && apActive) {

View File

@ -8,7 +8,7 @@
*/ */
// version code in format yymmddb (b = daily build) // 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 //uncomment this if you have a "my_config.h" file you'd like to use
//#define WLED_USE_MY_CONFIG //#define WLED_USE_MY_CONFIG