8000 Improve AP mode stability by stopping unnecessary Wi-Fi reconnections by eandersson · Pull Request #815 · bitaxeorg/ESP-Miner · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Improve AP mode stability by stopping unnecessary Wi-Fi reconnections #815

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

Merged
merged 2 commits into from
Apr 3, 2025

Conversation

eandersson
Copy link
Collaborator
@eandersson eandersson commented Apr 1, 2025

When the device is in AP mode, repeatedly attempting to connect to an incorrect or non-existent Wi-Fi network causes instability. This patch halts the reconnection process if a client is already connected to the AP, ensuring a stable connection.

@eandersson eandersson changed the base branch from master to dev-latest April 1, 2025 11:35
Copy link
github-actions bot commented Apr 1, 2025

Unit Test Results

20 tests  ±0   20 ✔️ ±0   0s ⏱️ ±0s
  1 suites ±0     0 💤 ±0 
  1 files   ±0     0 ±0 

Results for commit 480e52b. ± Comparison against base commit d3486df.

♻️ This comment has been updated with latest results.

@eandersson eandersson changed the title Don't retry wifi when connected to AP Improve AP mode stability by stopping unnecessary Wi-Fi reconnections Apr 1, 2025
@WantClue WantClue added this to the v2.6.2 milestone Apr 2, 2025
Copy link
Collaborator
@mutatrum mutatrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good change, makes it a lot more stable. Code can be simplified by checking on event_id WIFI_EVENT_AP_STACONNECTED for user connect to STA and keep state in a static boolean. The opposite is WIFI_EVENT_AP_STADISCONNECTED, so the retrying can continue if user disconnects (for whatever reason).

@STSMiner1
Copy link
Contributor

V2.6.1 - First time setup - Wi-Fi typo error results in the Bitaxe AP dropping thus stopping you from fixing the typo error when connecting to it's AP.

I found an issue that if you make a typo error with the first time setup with the Wi-Fi SSID and you've clicked "Save" and "Restart", you will not be able to fix the issue when reconnecting to the Bitaxe AP, the connection drops and connection between your PC / cell phone is lost with the Bitaxe.

The same applies if your changing out your Wi-Fi SSID for another one and you make a typo mistake here.
Note, you will not be able to change your Wi-Fi SSID via the AP of the Bitaxe if your running v2.6.1

Image below shows that the PC is not connected to the AP of the Bitaxe, the connection was dropped by the Bitaxe and the browser timed out because of that.

The only way I found to resolve this issue was to flash the Bitaxe to it's factory state with the Web Flasher or with the BitaxeTool with the default configs (no entry for Wi-Fi and password) and start again with the setup (first time setup).

How did I stumble on this issue ?

I was trying to reproduce the issue described here --> #802

I was not able to reproduce this issue (802), thus leading to the issue I've described above, this PR (#815) resolves this issue I found.

image

@eandersson
Copy link
Collaborator Author
eandersson commented Apr 2, 2025

Good change, makes it a lot more stable. Code can be simplified by checking on event_id WIFI_EVENT_AP_STACONNECTED for user connect to STA and keep state in a static boolean. The opposite is WIFI_EVENT_AP_STADISCONNECTED, so the retrying can continue if user disconnects (for whatever reason).

I'm not convinced this simplifies things, though it’s probably more robust. Also, not sure if we even care about retrying here, since we've already failed multiple times while waiting for the user to connect to the AP. This is really just fixing an edge case that very few users would care about - for example, after having typo'd the wifi password, or maybe the password changed.

Feel free to open a PR though if you feel strongly about it.

Slept on this and updated it to use this instead. I didn't implement a continuation on re-connects, but used the events instead to track if clients are connected.

Copy link
Collaborator
@mutatrum mutatrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Agree that continuing after user disconnect is not neccesary. At that point user had successfully connected to the setup AP, so it should be fine.

Really makes a big difference in stability, before this PR the setup AP connection was really flaky.

@mutatrum mutatrum merged commit de3b95e into dev-latest Apr 3, 2025
5 checks passed
adammwest pushed a commit to adammwest/ESP-Miner that referenced this pull request Apr 18, 2025
…bitaxeorg#815)

* Don't retry wifi when connected to AP

* Update based on feedback
WantClue pushed a commit that referenced this pull request May 2, 2025
…#815)

* Don't retry wifi when connected to AP

* Update based on feedback
un-painted pushed a commit to un-painted-org/ESP-Miner that referenced this pull request May 5, 2025
…bitaxeorg#815)

* Don't retry wifi when connected to AP

* Update based on feedback
@WantClue WantClue deleted the ap_fix branch May 15, 2025 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0