Skip to content

Rework WiFi code #435

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
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Rework WiFi code #435

wants to merge 4 commits into from

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
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.

1 participant