Skip to content

Commit

Permalink
Fix for NTP sync on millis() rollover.
Browse files Browse the repository at this point in the history
AP mode delay on boot (Aircoookie#2242).
  • Loading branch information
blazoncek committed Jan 10, 2022
1 parent aba4dc7 commit 04f5bdb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion wled00/wled.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ void WLED::loop()
if (lastMqttReconnectAttempt > millis()) {
rolloverMillis++;
lastMqttReconnectAttempt = 0;
ntpLastSyncTime = 0;
strip.restartRuntime();
}
if (millis() - lastMqttReconnectAttempt > 30000) {
Expand Down Expand Up @@ -683,8 +684,10 @@ void WLED::handleConnection()

if (now < 2000 && (!WLED_WIFI_CONFIGURED || apBehavior == AP_BEHAVIOR_ALWAYS))
return;
if (lastReconnectAttempt == 0)
if (lastReconnectAttempt == 0) {
initConnection();
return;
}

// reconnect WiFi to clear stale allocations if heap gets too low
if (now - heapTime > 5000) {
Expand Down

0 comments on commit 04f5bdb

Please sign in to comment.