- Notifications
You must be signed in to change notification settings - Fork 13.3k
Closed
Description
I've noticed lately that multiple devices I have have started dropping off WiFi and reconnecting (causing MQTT dropouts etc) unless I specify WiFi.setSleepMode(WIFI_NONE_SLEEP)
when setting up the WiFi adapter.
ESP.getFullVersion() output:
SDK:3.0.0-dev(c0f7b44)/Core:2.5.0=20500000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1/BearSSL:6778687
WiFi setup code in setup():
mConnectHandler = WiFi.onStationModeConnected(onConnected); mDisConnectHandler = WiFi.onStationModeDisconnected(onDisconnect); mGotIpHandler = WiFi.onStationModeGotIP(onGotIP); WiFi.disconnect() ; WiFi.persistent(false); WiFi.setSleepMode(WIFI_NONE_SLEEP); WiFi.mode(WIFI_STA); // Client mode WiFi.setOutputPower(17); // 10dBm == 10mW, 14dBm = 25mW, 17dBm = 50mW, 20dBm = 100mW WiFi.begin(ssid, password); // Start WiFi.
And the functions:
void onConnected(const WiFiEventStationModeConnected& event){ update_status += millis(); update_status += ": Connected to AP."; update_status += "\n"; } void onDisconnect(const WiFiEventStationModeDisconnected& event){ update_status += millis(); update_status += ": Station disconnected"; update_status += "\n"; client.disconnect(); } void onGotIP(const WiFiEventStationModeGotIP& event){ update_status += millis(); update_status += ": Station connected, IP: "; update_status += WiFi.localIP().toString(); update_status += "\n"; timer.setTimeout(1000, checkForUpdate); }
update_status is a global string that is included on the web page interface.
If I comment out the setSleepMode line, I get regular wifi disconnections.
Spackstor
Metadata
Metadata
Assignees
Labels
No labels