From e21738913fe779ad37cfc0b17973b146fd0e4241 Mon Sep 17 00:00:00 2001 From: Dirk Jahnke Date: Tue, 2 Feb 2021 16:15:54 +0100 Subject: [PATCH] Added automatic reboot after 28h --- src/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.cpp b/src/main.cpp index 8208ae3..2b39f29 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -34,6 +34,10 @@ #include #include +// Auto reset Arduino to start network again and avoid counter overflow +#define REBOOT_EVERY_ms (28 * (3600000 /* hours */)) +void (*resetArduinoNow) (void) = 0; // declare reset fuction at address 0 + // Update these with values suitable for your network. byte mac[] = { 0xDE, 0xED, 0xBA, 0xFE, 0xFE, 0xEA }; IPAddress ip(192, 168, 89, 205); @@ -404,4 +408,7 @@ void loop() { checkOutputAutoOff(); + if (millis() > REBOOT_EVERY_ms) { + resetArduinoNow(); + } }