Skip to content

Feature: Station-mode Fallback and Periodic Reconnection Loop (#112)#114

Open
dfry-lhzn wants to merge 5 commits into
CCOMJHC:mainfrom
dfry-lhzn:feature/112-reconnect-loop
Open

Feature: Station-mode Fallback and Periodic Reconnection Loop (#112)#114
dfry-lhzn wants to merge 5 commits into
CCOMJHC:mainfrom
dfry-lhzn:feature/112-reconnect-loop

Conversation

@dfry-lhzn
Copy link
Copy Markdown

@dfry-lhzn dfry-lhzn commented May 19, 2026

Stacked on #113. Review #113 first.
Resolves #112

This PR addresses the indefinite fallback behavior observed when the logger transitions into AP-Mode due to a missing target Station network. It implements a non-blocking background scanner that gracefully restores the Station connection whenever the target Hotspot returns.

Key Changes

  1. Asynchronous Background Scanning: When inside AP-Fallback, the ConnectionStateMachine triggers a non-blocking WiFi.scanNetworks(true). If the target SSID is spotted, it transitions to STATION_CONNECTING.
  2. WIFI_AP_STA Dual Mode: Replaced pure AP mode fallback with WIFI_AP_STA. This ensures the logger can continue hosting its configuration access point while the Station interface asynchronously scans the airways in the background.
  3. mDNS/DHCP Hostname Consistency: WiFi.setHostname is now executed prior to interface initialization on boot, binding the custom mDNS property to the DHCP negotiation so it correctly resolves instead of leaving it stranded as 'espressif'.
  4. WPA3 Baseband Resilience: Fixed a bug in station join configuration where WiFi.begin(ssid, pass) was forcefully overriding the structure memory. It now builds the wifi_config_t cleanly to preserve SAE and PMF constants and performs a hard WiFi.disconnect(true) during transition to kill underlying SDK tracking states from stale attempts.

dfry-lhzn added 5 commits May 19, 2026 13:36
…JHC#111)

- Adds CONFIG_REQUIRE_PMF_S to allow users with modern hotspots (like Pixel 9 Pro) to enforce Protected Management Frames.
- Defaults PMF to capable but not required to preserve compatibility with legacy WPA2 networks.
- Sets sae_pwe_h2e to WPA3_SAE_PWE_BOTH where available to enable WPA3 SAE flow.
Replaces the hard ESP.restart() failure loop when Station connection exhausts its retries. Instead:
- State machine drops to AP-Fallback mode headlessly via apSetup()
- Triggers non-blocking background async scans WiFi.scanNetworks(true)
- Polls for configured hotspot presence over the air
- Transitions seamlessly back to Station mode if detected
- Configured via new parameter CONFIG_STATION_SCAN_INTERVAL_S exposed to Web UI (default: 30000 ms / 30s)
Intercepts CONFIG_MDNS_NAME_S (default value: "wibl") and assigns it using WiFi.setHostname() and WiFi.softAPsetHostname() respectively prior to network connection. Ensures tethered networks explicitly register the logger.
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.

Feature Request: Station-mode Fallback and Periodic Reconnection Loop

1 participant