Make firmware updating more foolproof (#469)

* Make firmware updating more foolproof and fix bugs
* No need to manually handle overflow
* Make startTime TickType_t
* Don't process TouchEvents::None
* Fix sleep getting re-enabled issue more directly
This commit is contained in:
Riku Isokoski
2021-07-22 22:57:45 +03:00
committed by GitHub
parent 57b3397078
commit 0a0f28fff4
5 changed files with 52 additions and 17 deletions

View File

@@ -198,7 +198,11 @@ void SystemTask::Work() {
Messages message = static_cast<Messages>(msg);
switch (message) {
case Messages::EnableSleeping:
doNotGoToSleep = false;
// Make sure that exiting an app doesn't enable sleeping,
// if the exiting was caused by a firmware update
if (!bleController.IsFirmwareUpdating()) {
doNotGoToSleep = false;
}
break;
case Messages::DisableSleeping:
doNotGoToSleep = true;
@@ -275,10 +279,11 @@ void SystemTask::Work() {
displayApp.PushMessage(Pinetime::Applications::Display::Messages::BleFirmwareUpdateStarted);
break;
case Messages::BleFirmwareUpdateFinished:
if (bleController.State() == Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated) {
NVIC_SystemReset();
}
doNotGoToSleep = false;
xTimerStart(idleTimer, 0);
if (bleController.State() == Pinetime::Controllers::Ble::FirmwareUpdateStates::Validated)
NVIC_SystemReset();
break;
case Messages::OnTouchEvent:
ReloadIdleTimer();