File tree Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Expand file tree Collapse file tree 2 files changed +18
-8
lines changed Original file line number Diff line number Diff line change @@ -325,12 +325,17 @@ void loop_fauxmo() {
325
325
// Therefore, we have to manually poll for UDP packets
326
326
fauxmo.handle ();
327
327
328
- // This is a sample code to output free heap every 5 seconds
329
- // This is a cheap way to detect memory leaks
328
+ // Check Wifi connection and memory leaks
330
329
static unsigned long last = millis ();
331
330
if (millis () - last > 5000 ) {
332
- last = millis ();
333
- DBG (" [MAIN] Free heap: %d bytes\n " , MCU.getFreeHeap ());
331
+ last = millis ();
332
+ DBG (" [MAIN] Free heap: %d bytes\n " , MCU.getFreeHeap ());
333
+ if (WiFi.status () != WL_CONNECTED) {
334
+ WiFi.disconnect ();
335
+ DBG (" [MAIN] Wifi disconnected. Rebooting\n " );
336
+ delay (100 );
337
+ MCU.restart ();
338
+ }
334
339
}
335
340
336
341
outputControl ();
Original file line number Diff line number Diff line change @@ -303,12 +303,17 @@ void loop_fauxmo() {
303
303
// Therefore, we have to manually poll for UDP packets
304
304
fauxmo.handle ();
305
305
306
- // This is a sample code to output free heap every 5 seconds
307
- // This is a cheap way to detect memory leaks
306
+ // Check Wifi connection and memory leaks
308
307
static unsigned long last = millis ();
309
308
if (millis () - last > 5000 ) {
310
- last = millis ();
311
- DBG (" [MAIN] Free heap: %d bytes\n " , MCU.getFreeHeap ());
309
+ last = millis ();
310
+ DBG (" [MAIN] Free heap: %d bytes\n " , MCU.getFreeHeap ());
311
+ if (WiFi.status () != WL_CONNECTED) {
312
+ WiFi.disconnect ();
313
+ DBG (" [MAIN] Wifi disconnected. Rebooting\n " );
314
+ delay (100 );
315
+ MCU.restart ();
316
+ }
312
317
}
313
318
314
319
outputControl ();
You can’t perform that action at this time.
0 commit comments