mirror of
https://github.com/dalathegreat/Battery-Emulator.git
synced 2025-10-05 10:49:42 +02:00
Merge pull request #505 from amarofarinha/main
Improve OTA Update by Removing Delay and Immediate CAN Control
This commit is contained in:
commit
c2433bd81b
2 changed files with 3 additions and 6 deletions
|
@ -220,6 +220,9 @@ void setBatteryPause(bool pause_battery, bool pause_CAN) {
|
||||||
emulator_pause_status = RESUMING;
|
emulator_pause_status = RESUMING;
|
||||||
clear_event(EVENT_PAUSE_END);
|
clear_event(EVENT_PAUSE_END);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//immediate check if we can send CAN messages
|
||||||
|
emulator_pause_state_send_CAN_battery();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @brief handle emulator pause status
|
/// @brief handle emulator pause status
|
||||||
|
|
|
@ -46,12 +46,6 @@ void ElegantOTAClass::begin(ELEGANTOTA_WEBSERVER *server, const char * username,
|
||||||
// Pre-OTA update callback
|
// Pre-OTA update callback
|
||||||
if (preUpdateCallback != NULL) preUpdateCallback();
|
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
|
// Get header x-ota-mode value, if present
|
||||||
OTA_Mode mode = OTA_MODE_FIRMWARE;
|
OTA_Mode mode = OTA_MODE_FIRMWARE;
|
||||||
// Get mode from arg
|
// Get mode from arg
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue