Skip to content

Commit 0c1d3f7

Browse files
committed
fix reboot
1 parent 97dacd8 commit 0c1d3f7

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

‎wifi_funcs.h‎

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -233,12 +233,16 @@ int getRSSIasQuality(){
233233
returngetRSSIasQuality(WiFi.RSSI());
234234
}
235235

236-
236+
/**
237+
* [checkWifi description]
238+
* @param restart [description]
239+
*/
237240
voidcheckWifi(boolrestart= false){
238241
Serial.println("[TASK] checkWiFi");
239242
if(WiFi.status() !=WL_CONNECTED ){
240243
if(downtime==0) downtime=millis();
241244
if(restart&&millis() >downtime+downtimeRestart){
245+
// reboot
242246
#ifdefUSENEOIND
243247
indSetColor(np_red);
244248
#endif
@@ -247,11 +251,14 @@ void checkWifi(bool restart = false){
247251
delay(1000);
248252
ESP.restart();
249253
}
250-
#ifdefUSENEOIND
251-
indSetColor(np_red);
252-
#endif
253-
Serial.println("[WIFI] WiFi is Disconnected");
254-
WiFi.reconnect();
254+
else{
255+
// reconnect
256+
#ifdefUSENEOIND
257+
indSetColor(np_red);
258+
#endif
259+
Serial.println("[WIFI] WiFi is Disconnected");
260+
WiFi.reconnect();
261+
}
255262
} else{
256263
if(debug_wifi){
257264
Serial.println("[WIFI] WiFi is CONNECTED");

0 commit comments

Comments
(0)