Skip to content

ESP8266/ESP32 locked on wifi connect #1115

Open
@av1024

Description

@av1024

If user pass invalid settings for WiFi, device will locked before setup() and never returns control to other code.

Some way to control over WiFi connection required. This may be at least a predefined timeout. A more complex way is external flag controlled by "hardware" timer and/or WiFi event handlers.

Both ESP8266 and ESP32 code in gatewayTransportInit() copied from trivial sample code
(latest development git, compiled with esp8266 2.3.0):

while (WiFi.status() != WL_CONNECTED) {
wait(500);
GATEWAY_DEBUG(PSTR("GWT:TIN:CONNECTING...\n"));
}

and

while (WiFi.waitForConnectResult() != WL_CONNECTED) {
wait(500);
GATEWAY_DEBUG(PSTR("."));
}

  1. This loop will never ends if (for example) wrong password provided.
  2. wait potentially may produce unexpected results because transport not ready here (see ESP8266Gateway do not connect to Access Point #946)
  3. User code in setup and loop never be executed so no way to reconfig or restart device

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions