Skip to content

maybe a fix for WiFi.setAutoReconnect (false) never connecting #4438

Closed
@odelot

Description

@odelot

Using: 2.4.0 git version

I always used WiFi.persistent (false); and took care of ssid and pass stored in the eeprom by myself. Until 2.3.0 everything was working. I was connecting with begin function manually.

In 2.4.0 changed something and my sketch was just connecting once. The second one never got the WL_CONNECTED status.

When used WiFi.setAutoReconnect (false) I discovered that I wasn't manually reconnecting before. It was the device. With WiFi.setAutoReconnect (true) I got a error that my wifi network was not found and with WiFi.setAutoReconnect (false) it never connects after the first connection.

In file ESP8266WiFiSTA.cpp I changed this part of the begin function to set the config even if it hasn't changed if we are in the persist mode. Just this way I could kick off the connection procedure and DHCP

wifi_station_get_config(&current_conf);
    if(sta_config_equal(current_conf, conf)) {
        DEBUGV("sta config unchanged");

		//added this
		if (!WiFi._persistent) {
			//set anyway
			wifi_station_set_config_current(&conf);
		}
    }
    else {
        ETS_UART_INTR_DISABLE();

I tried to make a small sketch to simulate it but I couldn't. This behavior seems to happen just with my big project.

I will try to simulate this in a small sketch again. Maybe I am doing something wrong, calling a disconnect in a wrong place, I don't know. I just wanted to share this to someone that are facing the same problem.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions