FAQ
TL;DR: On ESP8266, EEPROM.commit() should print 1 on success; "A properly executed commit returns true." Handle zero‑length passwords, finalize EEPROM, and avoid immediate ESP.reset() to prevent WDT resets. [Elektroda, khoam, post #19737594]
Why it matters: This helps ESP8266 makers fix WDT resets when saving blank Wi‑Fi passwords and connect to open networks reliably.
Quick Facts
- The sketch waits 10 seconds for Wi‑Fi to connect (20 loops × 500 ms). [Elektroda, pier, post #19736135]
- An empty password produced length 0, and the device logged WDT resets. [Elektroda, pier, post #19736904]
- Before ESP.reset()/ESP.restart(), call EEPROM.end() and stop Wi‑Fi to avoid WDT. [Elektroda, khoam, post #19737641]
- A successful EEPROM.commit() prints 1 (true). [Elektroda, khoam, post #19737594]
- To join open networks, call WiFi.begin(ssid) without a password. [*ESP8266WiFi — WiFi.begin()*]
How do I save an empty Wi‑Fi password on ESP8266 without crashing?
Accept a zero‑length password in your handler. After writing SSID/pass and calling EEPROM.commit(), call EEPROM.end(). Stop Wi‑Fi, then call ESP.restart() instead of ESP.reset(). This sequence preserves your original behavior and prevents post‑save WDT resets during the HTTP handler. [Elektroda, khoam, post #19737641]
Why does the board WDT reset right after saving settings?
Calling ESP.reset() inside the request handler can trip the watchdog. Use ESP.restart() for a cleaner reset path after closing resources. As the expert noted: "This next command that can trigger WTD is just ESP.reset()." [Elektroda, khoam, post #19737625]
Do I need to save anything for an open Wi‑Fi network?
Your flow may require it. As the author confirmed: "You have to save something because otherwise the 'configurator' doesn't execute." If your UI or boot logic expects stored credentials, keep SSID and store an empty pass. [Elektroda, pier, post #19736737]
What length should I expect for an empty password from the form?
Expect qpass.length() to be 0. The serial log showed: "Value = 0" followed by WDT resets, confirming the handler received an empty string and then crashed later. [Elektroda, pier, post #19736904]
How do I confirm EEPROM saved credentials successfully?
Print the result of EEPROM.commit(). A correct save prints 1, meaning true. As the helper put it: "A properly executed commit returns true." If you see 1, your crash likely occurs after commit, during reset/cleanup. [Elektroda, khoam, post #19737594]
How do I connect to an open Wi‑Fi network in code?
Use WiFi.begin(ssid) without providing a password. This form joins open networks and aligns with accepting an empty pass in your configurator. [ESP8266WiFi — WiFi.begin()]
How long does this sketch wait for Wi‑Fi, and can I change it?
It waits 10 seconds: 20 attempts with 500 ms delay in testWifi(). Increase reliability by raising the loop count or delay. Example: double the attempts for 20 seconds of total wait time. [Elektroda, pier, post #19736135]
Could power supply issues cause WDT resets here?
Yes. Low supply capacity can cause voltage dips and watchdog timeouts. As noted: "it looks as if the WTD is triggered due to insufficient current capacity of the ESP supply." Use a stable 3.3 V source with adequate peak current. [Elektroda, khoam, post #19737431]
Whats a safe reset sequence after saving credentials?
Follow this quick sequence:
- EEPROM.commit(), then EEPROM.end().
- Stop Wi‑Fi cleanly.
- Call ESP.restart() instead of ESP.reset().
This reduces watchdog trips in the HTTP handler. [Elektroda, khoam, post #19737641]
Should I clear EEPROM before writing new SSID/password?
Yes. The sketch clears the first 96 bytes, then writes SSID and password. That avoids mixing old and new bytes and keeps reads clean on next boot. [Elektroda, pier, post #19736135]
How can I quickly reproduce and diagnose the issue?
Add serial diagnostics in the handler. Print qpass.length() to confirm empty input. Then save and observe the serial output to locate the stage of failure. This isolates form parsing from storage and reset behavior. [Elektroda, khoam, post #19736757]
Why does it connect after a power cycle but crash immediately after save?
A full power cycle starts cleanly, so saved open‑network credentials work. The crash stems from the immediate post‑save reset path. Fix the handler exit by finalizing EEPROM and stopping Wi‑Fi before restart. [Elektroda, pier, post #19737436]