mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-06 03:50:13 +02:00
Improvement: Add Battery Pause Feature for Max Charge/Discharge Power and OTA Update Optimization
This commit is contained in:
parent
ccb2db87ec
commit
856a0838d1
23 changed files with 1004 additions and 773 deletions
|
@ -43,6 +43,15 @@ void ElegantOTAClass::begin(ELEGANTOTA_WEBSERVER *server, const char * username,
|
|||
return request->requestAuthentication();
|
||||
}
|
||||
|
||||
// Pre-OTA update callback
|
||||
if (preUpdateCallback != NULL) preUpdateCallback();
|
||||
|
||||
// Sleep for 3 seconds to allow asynchronous preUpdateCallback tasks to complete
|
||||
unsigned long sleepStart = millis();
|
||||
while (millis() - sleepStart < 3000) { // Sleep for 3 second
|
||||
delay(1); // Yield to other tasks
|
||||
}
|
||||
|
||||
// Get header x-ota-mode value, if present
|
||||
OTA_Mode mode = OTA_MODE_FIRMWARE;
|
||||
// Get mode from arg
|
||||
|
@ -73,7 +82,7 @@ void ElegantOTAClass::begin(ELEGANTOTA_WEBSERVER *server, const char * username,
|
|||
#endif
|
||||
|
||||
// Pre-OTA update callback
|
||||
if (preUpdateCallback != NULL) preUpdateCallback();
|
||||
//if (preUpdateCallback != NULL) preUpdateCallback();
|
||||
|
||||
// Start update process
|
||||
#if defined(ESP8266)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue