fix: OTA update on x3 and progress bar on x4 and x3 (#1805)
Co-authored-by: Justin Mitchell <1875695+itsthisjustin@users.noreply.github.com>
This commit is contained in:
co-authored by
Justin Mitchell
parent
15ea7027df
commit
ba4a361d64
@@ -139,11 +139,6 @@ void OtaUpdateActivity::render(RenderLock&&) {
|
||||
}
|
||||
|
||||
void OtaUpdateActivity::loop() {
|
||||
// TODO @ngxson : refactor this logic later
|
||||
if (updater.getRender()) {
|
||||
requestUpdate();
|
||||
}
|
||||
|
||||
if (state == WAITING_CONFIRMATION) {
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Confirm)) {
|
||||
LOG_DBG("OTA", "New update available, starting download...");
|
||||
@@ -152,7 +147,14 @@ void OtaUpdateActivity::loop() {
|
||||
state = UPDATE_IN_PROGRESS;
|
||||
}
|
||||
requestUpdateAndWait();
|
||||
const auto res = updater.installUpdate();
|
||||
const auto res = updater.installUpdate(
|
||||
[](void* ctx) {
|
||||
// immediate=true notifies the render task directly. The default deferred path only
|
||||
// sets a flag consumed at the end of ActivityManager::loop(), which never runs while
|
||||
// installUpdate() blocks this task.
|
||||
static_cast<OtaUpdateActivity*>(ctx)->requestUpdate(true);
|
||||
},
|
||||
this);
|
||||
|
||||
if (res != OtaUpdater::OK) {
|
||||
LOG_DBG("OTA", "Update failed: %d", res);
|
||||
@@ -168,7 +170,13 @@ void OtaUpdateActivity::loop() {
|
||||
RenderLock lock(*this);
|
||||
state = FINISHED;
|
||||
}
|
||||
requestUpdate();
|
||||
requestUpdateAndWait();
|
||||
// Hold the completion screen briefly so the user sees it, then restart.
|
||||
delay(3000);
|
||||
{
|
||||
RenderLock lock(*this);
|
||||
state = SHUTTING_DOWN;
|
||||
}
|
||||
}
|
||||
|
||||
if (mappedInput.wasPressed(MappedInputManager::Button::Back)) {
|
||||
|
||||
Reference in New Issue
Block a user