changed restart behaviour after Firmware-Update
This commit is contained in:
		| @@ -35,6 +35,8 @@ | |||||||
| #define OTA_DELAY 50 // ticks -> 10ms / tick | #define OTA_DELAY 50 // ticks -> 10ms / tick | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|  | #define SHUTDOWN_DELAY_MS 5000 | ||||||
|  |  | ||||||
| #define ATOMIC_FS_UPDATE | #define ATOMIC_FS_UPDATE | ||||||
|  |  | ||||||
| #ifndef ADMIN_PASSWORD | #ifndef ADMIN_PASSWORD | ||||||
|   | |||||||
| @@ -735,8 +735,19 @@ void toggleWiFiAP(boolean shutdown) | |||||||
|  |  | ||||||
| void SystemShutdown() | void SystemShutdown() | ||||||
| { | { | ||||||
|   StoreConfig_EEPROM(); |   static uint32_t shutdown_delay = 0; | ||||||
|   ESP.restart(); |  | ||||||
|  |   if (shutdown_delay == 0) | ||||||
|  |   { | ||||||
|  |     shutdown_delay = millis() + SHUTDOWN_DELAY_MS; | ||||||
|  |     Serial.printf("Shutdown requested - Restarting in %d seconds\n", SHUTDOWN_DELAY_MS); | ||||||
|  |   } | ||||||
|  |   if (shutdown_delay < millis()) | ||||||
|  |   { | ||||||
|  |     StoreConfig_EEPROM(); | ||||||
|  |     StorePersistence_EEPROM(); | ||||||
|  |     ESP.restart(); | ||||||
|  |   } | ||||||
| } | } | ||||||
|  |  | ||||||
| uint32_t Process_Impulse_WheelSpeed() | uint32_t Process_Impulse_WheelSpeed() | ||||||
|   | |||||||
| @@ -348,7 +348,7 @@ void WebserverFirmwareUpdate_Callback(AsyncWebServerRequest *request, const Stri | |||||||
|     { |     { | ||||||
|       Serial.println("Update complete"); |       Serial.println("Update complete"); | ||||||
|       Serial.flush(); |       Serial.flush(); | ||||||
|       ESP.restart(); |       globals.systemStatus = sysStat_Shutdown; | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user