From 24eed4a55ed3c46c5c07744a370c7a5bf0c98152 Mon Sep 17 00:00:00 2001 From: Klaus K Wilting Date: Sun, 15 Apr 2018 18:54:23 +0200 Subject: [PATCH] main.cpp: small change in main loop --- src/main.cpp | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 06f832bb..ad92f973 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -520,20 +520,22 @@ do_send(&sendjob); // Arduino main moop, runs on core 1 // https://techtutorialsx.com/2017/05/09/esp32-get-task-execution-core/ void loop() { + while(1) { -#ifdef HAS_BUTTON - if (ButtonTriggered) { - ButtonTriggered = false; - ESP_LOGI(TAG, "Button pressed, resetting device to factory defaults"); - eraseConfig(); - esp_restart(); - } - else -#endif - { vTaskDelay(500/portTICK_PERIOD_MS); - uptimecounter = uptime() / 1000; // count uptime seconds - } + + #ifdef HAS_BUTTON + if (ButtonTriggered) { + ButtonTriggered = false; + ESP_LOGI(TAG, "Button pressed, resetting device to factory defaults"); + eraseConfig(); + esp_restart(); + } + #endif + + vTaskDelay(500/portTICK_PERIOD_MS); + uptimecounter = uptime() / 1000; // count uptime seconds } + } /* end Aruino LOOP ------------------------------------------------------------ */