Skip to content

Comments

Rework WiFi code#435

Merged
Eirenliel merged 8 commits intomainfrom
wifi-rework
Sep 17, 2025
Merged

Rework WiFi code#435
Eirenliel merged 8 commits intomainfrom
wifi-rework

Conversation

@gorbit99
Copy link
Contributor

@gorbit99 gorbit99 commented May 3, 2025

This PR reworks the WiFi code in the following ways:

  • WiFiNetwork and WiFiProvisioning are now singleton classes, instead of namespaces with free-floating functions in them
  • The code for the wifi connection logic is now pulled into separate functions for clarity
  • The mcu only tries switching to the G phy mode if the connection on the N phy mode timed out, not when the credentials were incorrect
  • The reason for the failure is now reported correctly

@gorbit99 gorbit99 requested a review from Eirenliel as a code owner May 3, 2025 23:19
@gorbit99 gorbit99 requested a review from loucass003 May 3, 2025 23:41
@gorbit99
Copy link
Contributor Author

gorbit99 commented May 3, 2025

Since the ESP8266 and the ESP32 code didn't agree on the status codes, I remapped them to the following error codes instead:
0 - Timeout (likely DHCP failure)
1 - SSID not found
2 - Wrong password
3 - Unknown error (didn't manage to trigger this)

The new format for the message that the connection failed is
Can't connect from any credentials, error: <error code>, reason: <error message>.

@gorbit99 gorbit99 mentioned this pull request May 5, 2025
2 tasks
Copy link
Member

@ButterscotchV ButterscotchV left a comment

Choose a reason for hiding this comment

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

Looks good, the code looks so much better. This requires thorough testing to ensure it matches the previous behaviour. If anyone tests, I would appreciate seeing what's been tested as comments on this PR :3

@Eirenliel Eirenliel merged commit 23390dd into main Sep 17, 2025
2 checks passed
@Eirenliel Eirenliel deleted the wifi-rework branch September 17, 2025 15:03
ShineBrightMeow added a commit to Shine-Bright-Meow/SlimeVR-Tracker-ESP that referenced this pull request Sep 20, 2025
@gorbit99 gorbit99 mentioned this pull request Sep 30, 2025
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