-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
allows WiFi to attempt reconnect more than once as defined, default 6 attempts. #8217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
sandeepkumar0153
wants to merge
22
commits into
meshtastic:develop
Choose a base branch
from
sandeepkumar0153:develop
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 7 commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
99b4293
allows WiFi to attempt reconnect more than once as defined, default 6…
sandeepkumar0153 4f1156c
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 b78e35d
Merge branch 'develop' into develop
sandeepkumar0153 e8dcc30
changes to pin config based on custom hardware.
sandeepkumar0153 8bb91b6
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 f6631fb
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 bfa17f5
Merge branch 'develop' into develop
thebentern 6966392
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 55a7c95
Update src/mesh/wifi/WiFiAPClient.cpp
sandeepkumar0153 bdc28f9
Update src/mesh/wifi/WiFiAPClient.cpp
sandeepkumar0153 38d5e46
Update variant.h to default
sandeepkumar0153 c2224ad
Update variant.h to default
sandeepkumar0153 c6c5307
Update variant.h
sandeepkumar0153 4ff4358
Update WiFiAPClient.cpp
sandeepkumar0153 bcb8274
Merge branch 'develop' into develop
sandeepkumar0153 9e08b7b
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 90be0ae
Merge branch 'develop' into develop
thebentern 0d32fc6
Merge branch 'develop' into develop
thebentern 5e4ff85
Macros have been capitalised, Updated WiFiAPClient.cpp
sandeepkumar0153 3fd00a6
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 69bde4b
Merge branch 'meshtastic:develop' into develop
sandeepkumar0153 e073e09
Merge branch 'develop' into develop
sandeepkumar0153 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -49,6 +49,15 @@ char ourHost[16]; | |
| // To replace blocking wifi connect delay with a non-blocking sleep | ||
| static unsigned long wifiReconnectStartMillis = 0; | ||
| static bool wifiReconnectPending = false; | ||
| static unsigned char wifiConnectAttempts=0; | ||
|
|
||
| #ifndef MaxWifiConnectionAttempts | ||
| #define MaxWifiConnectionAttempts 6 | ||
|
||
| #endif | ||
|
|
||
| #ifndef wifiReconnectGap | ||
| #define wifiReconnectGap 10000 | ||
|
||
| #endif | ||
|
|
||
| bool APStartupComplete = 0; | ||
|
|
||
|
|
@@ -168,28 +177,44 @@ static int32_t reconnectWiFi() | |
| #elif defined(ARCH_RP2040) | ||
| WiFi.disconnect(false); | ||
| #endif | ||
| LOG_INFO("Reconnecting to WiFi access point %s", wifiName); | ||
| LOG_INFO("Connecting to WiFi access point %s", wifiName); | ||
|
|
||
| // Start the non-blocking wait for 5 seconds | ||
| wifiReconnectStartMillis = millis(); | ||
| wifiReconnectPending = true; | ||
| // Do not attempt to connect yet, wait for the next invocation | ||
| return 5000; // Schedule next check soon | ||
| return wifiReconnectGap; // Schedule next check soon | ||
| } | ||
|
|
||
| // Check if we are ready to proceed with the WiFi connection after the 5s wait | ||
| if (wifiReconnectPending) { | ||
| if (millis() - wifiReconnectStartMillis >= 5000) { | ||
| if (millis() - wifiReconnectStartMillis >= wifiReconnectGap) { | ||
| if (!WiFi.isConnected()) { | ||
| wifiConnectAttempts++; | ||
| LOG_INFO("Reconnecting to WiFi access point %s, attempt %d", wifiName, wifiConnectAttempts); | ||
| #ifdef CONFIG_IDF_TARGET_ESP32C3 | ||
| WiFi.mode(WIFI_MODE_NULL); | ||
| WiFi.useStaticBuffers(true); | ||
| WiFi.mode(WIFI_STA); | ||
| #endif | ||
| WiFi.begin(wifiName, wifiPsw); | ||
| wifiReconnectStartMillis=millis(); | ||
| if(wifiConnectAttempts<MaxWifiConnectionAttempts){ | ||
| needReconnect=true; | ||
| } | ||
| else{ | ||
| needReconnect=false; | ||
sandeepkumar0153 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| wifiReconnectPending = false; | ||
| LOG_INFO("Maximum connection attempts reached %d", wifiConnectAttempts); | ||
| LOG_INFO("Unable to connect access point %s", wifiName); | ||
| } | ||
|
|
||
| } | ||
| else{ | ||
| LOG_INFO("WiFi succesfully connected to access point %s", wifiName); | ||
sandeepkumar0153 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| LOG_INFO("Connection attempts %d", wifiConnectAttempts); | ||
| wifiReconnectPending = false; | ||
| } | ||
sandeepkumar0153 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| isReconnecting = false; | ||
| wifiReconnectPending = false; | ||
| } else { | ||
| // Still waiting for 5s to elapse | ||
| return 100; // Check again soon | ||
|
|
||
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.