Skip to content

feat: Add WiFi setup screen with QR code on LilyGo display#673

Open
marcodejongh wants to merge 3 commits intomainfrom
claude/fix-wifi-credentials-TftwJ
Open

feat: Add WiFi setup screen with QR code on LilyGo display#673
marcodejongh wants to merge 3 commits intomainfrom
claude/fix-wifi-credentials-TftwJ

Conversation

@marcodejongh
Copy link
Owner

When WiFi isn't configured, the device now:

  • Starts in AP mode with SSID "Boardsesh-Setup"
  • Shows a setup screen with QR code linking to http://192.168.4.1
  • Defers BLE initialization until WiFi is connected

This provides a better first-time setup experience where users can
scan the QR code to configure WiFi credentials via the web interface.

Changes:

  • WiFiUtils: Add AP_MODE state and startAP/stopAP methods
  • LilyGoDisplay: Add showSetupScreen() with QR code
  • main.cpp: Defer BLE init until WiFi configured
  • esp_web_server: Handle AP mode in status endpoint

Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com

marcodejongh and others added 2 commits February 5, 2026 21:00
When WiFi isn't configured, the device now:
- Starts in AP mode with SSID "Boardsesh-Setup"
- Shows a setup screen with QR code linking to http://192.168.4.1
- Defers BLE initialization until WiFi is connected

This provides a better first-time setup experience where users can
scan the QR code to configure WiFi credentials via the web interface.

Changes:
- WiFiUtils: Add AP_MODE state and startAP/stopAP methods
- LilyGoDisplay: Add showSetupScreen() with QR code
- main.cpp: Defer BLE init until WiFi configured
- esp_web_server: Handle AP mode in status endpoint

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
startAP() was not clearing currentSSID/currentPassword, which caused
checkConnection() to attempt reconnection with stale credentials after
transitioning out of AP mode. This created a loop between AP mode and
failed connection attempts.

Also adds softAP/softAPIP/softAPdisconnect mock methods and 7 new AP
mode tests covering credential clearing, state transitions, and the
reconnection loop prevention.

https://claude.ai/code/session_0183bcPx7kSdnPXNKw2kKp6m
@vercel
Copy link

vercel bot commented Feb 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
boardsesh Building Building Preview, Comment Feb 6, 2026 10:34am

Request Review

@claude
Copy link

claude bot commented Feb 6, 2026

Claude Review

Ready to merge - Minor issues noted below, but nothing blocking.


Issues

  1. Non-display builds don't start AP mode on connection failure - main.cpp:417-428: The CONNECTION_FAILED case only starts AP mode when ENABLE_DISPLAY is defined. Non-display builds will remain in CONNECTION_FAILED state without starting AP mode, which may not be intentional.

  2. Credentials saved but not in AP mode on handleWiFiConnect - esp_web_server.cpp:464: The connect() call doesn't pass true for the save parameter, so credentials entered via the AP mode web interface won't be persisted. After a reboot, the device will return to AP mode.

  3. Missing getAPSSID in WiFiUtils - The test mock adds getAPSSID() but WiFiUtils class doesn't have this method. While tests pass (mocks are separate), this represents incomplete API symmetry.

The AP mode fallback when WiFi connection fails with no saved credentials
was wrapped entirely in #ifdef ENABLE_DISPLAY, so non-display builds
would stay stuck in CONNECTION_FAILED state. Restructured the #ifdef
guards so only Display calls are conditional.

Also removes unused getAPSSID/isAPActive mock methods that had no
corresponding WiFiUtils API.

https://claude.ai/code/session_0183bcPx7kSdnPXNKw2kKp6m
@claude
Copy link

claude bot commented Feb 6, 2026

Claude Review

Ready to merge - Minor issues noted below, but nothing blocking.

Issues

  1. embedded/libs/wifi-utils/src/wifi_utils.cpp:157-159 - Unreachable code: The AP_MODE case in checkConnection() is dead code since the function returns early at line 129 when in AP mode. Consider removing it to avoid confusion.

  2. embedded/projects/board-controller/src/main.cpp:219-226 - When ENABLE_DISPLAY is not defined, the AP mode starts but there's no way for users to know the device IP or that setup is needed (no display, no visual feedback). Consider logging more prominently or providing alternative feedback (e.g., LED pattern).

Test Coverage

Tests are well-written and cover the key AP mode functionality including edge cases like credential clearing and state transitions.

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.

2 participants