Improve WiFi connection resilience and skip MQTT when offline#44
Open
totolouis wants to merge 2 commits into
Open
Improve WiFi connection resilience and skip MQTT when offline#44totolouis wants to merge 2 commits into
totolouis wants to merge 2 commits into
Conversation
- Skip MQTT connection attempts when WiFi is not connected - Add better retry system for WiFi connections
nmaupu
reviewed
Apr 16, 2026
| // Phase 3: nothing worked, restart | ||
| LOG.println("WiFi reconnect failed after 6 attempts, restarting..."); | ||
| delay(100); | ||
| ESP.restart(); |
Owner
There was a problem hiding this comment.
This means that if the wifi is out for whatever reason, the boards reboot in an infinite loop.
Author
There was a problem hiding this comment.
You are right, I removed the restart. are you good with infinite retry to connect to the wifi?
nmaupu
reviewed
Apr 16, 2026
nmaupu
reviewed
May 4, 2026
| LOG.println(")..."); | ||
| WiFi.disconnect(true); | ||
| delay(100); | ||
| WiFi.mode(WIFI_STA); |
Owner
There was a problem hiding this comment.
Not sure about that. Mode is already set as per the initial configuration.
nmaupu
reviewed
May 4, 2026
| LOG.handle(); // telnetspy handling | ||
| ArduinoOTA.handle(); | ||
|
|
||
| #if WIFI_ENABLED |
Owner
There was a problem hiding this comment.
There is already a function to reconnectWifi which does exactly that declared in src/net/wifi.cpp (reconnectWifi).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 1.
Les PRs sont à la suite, j'avais tout fait en même temps dans mon fork.