From e375fab0488a81a9f965fae181d5252f2fb7a9f3 Mon Sep 17 00:00:00 2001 From: Marcel Peterkau Date: Tue, 9 Jan 2024 12:15:39 +0100 Subject: [PATCH] make restart chooseable in SystemShutdown --- Software/src/main.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/Software/src/main.cpp b/Software/src/main.cpp index 4161fcb..d899a3b 100644 --- a/Software/src/main.cpp +++ b/Software/src/main.cpp @@ -46,8 +46,8 @@ U8X8_SSD1306_128X64_NONAME_HW_I2C u8x8(-1); void Display_Process(); #endif void Button_Process(); -void toggleWiFiAP(boolean shutdown = false); -void SystemShutdown(); +void toggleWiFiAP(bool shutdown = false); +void SystemShutdown(bool restart = false); uint32_t Process_Impulse_WheelSpeed(); void EEPROMCyclicPDS_callback(); @@ -562,7 +562,7 @@ void Button_Process() } } -void toggleWiFiAP(boolean shutdown) +void toggleWiFiAP(bool shutdown) { if (WiFi.getMode() != WIFI_OFF) { @@ -586,7 +586,7 @@ void toggleWiFiAP(boolean shutdown) } } -void SystemShutdown() +void SystemShutdown(bool restart) { static uint32_t shutdown_delay = 0; @@ -599,7 +599,11 @@ void SystemShutdown() { StoreConfig_EEPROM(); StorePersistence_EEPROM(); - ESP.restart(); + if (restart) + ESP.restart(); + else + while (1) + ; } }