Add compile-time WiFi hard-off mode (WLED_FORCE_WIFI_OFF)#1
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f8eb607d7f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| #ifdef WLED_FORCE_WIFI_OFF | ||
| DEBUG_PRINTLN(F("WLED_FORCE_WIFI_OFF active. Skipping WiFi/AP init.")); | ||
| WiFi.disconnect(true); | ||
| WiFi.mode(WIFI_OFF); | ||
| return; |
There was a problem hiding this comment.
Initialize reconnect state before WiFi-off early return
When WLED_FORCE_WIFI_OFF is enabled, initConnection() returns in this block before lastReconnectAttempt is set (currently done later in the function). handleConnection() gates its first path on lastReconnectAttempt == 0, so this creates a perpetual "initial connect" loop that returns early on every iteration, repeatedly resetting interfacesInited and preventing initInterfaces() (and therefore server.begin()) from running in Ethernet-only deployments. This makes the new hard-off mode effectively break network availability instead of only disabling WiFi radio usage.
Useful? React with 👍 / 👎.
09339c8 to
e3af1ad
Compare
Motivation
Description
WLED_FORCE_WIFI_OFFtowled.hand document it inmy_config_sample.hso users can enable it frommy_config.hor build flags.wled.cpp, change startup networking to callWiFi.mode(WIFI_OFF)whenWLED_FORCE_WIFI_OFFis defined instead of starting STA scanning andfindWiFi(true).initAP()to immediately return whenWLED_FORCE_WIFI_OFFis defined so no softAP is created.initConnection()early-exit whenWLED_FORCE_WIFI_OFFis defined after callingWiFi.disconnect(true)and forcingWiFi.mode(WIFI_OFF), and add debug prints to indicate the forced-off state.Testing
nl/rginspections) to verify the flag and conditional blocks were inserted intowled.h,my_config_sample.h, andwled.cpp, and those checks succeeded.