Skip to content

Commit 71d1f5b

Browse files
committed
Keep external flash awake during AOD
1 parent b66c5de commit 71d1f5b

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

src/systemtask/SystemTask.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -310,14 +310,14 @@ void SystemTask::Work() {
310310
if (state != SystemTaskState::GoingToSleep) {
311311
break;
312312
}
313-
if (BootloaderVersion::IsValid()) {
314-
// First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH
315-
// if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions.
316-
spiNorFlash.Sleep();
317-
}
318313

319-
// Must keep SPI awake when still updating the display for always on
314+
// Must keep SPI and flash awake when still updating the display for always on
320315
if (msg == Messages::OnDisplayTaskSleeping) {
316+
if (BootloaderVersion::IsValid()) {
317+
// First versions of the bootloader do not expose their version and cannot initialize the SPI NOR FLASH
318+
// if it's in sleep mode. Avoid bricked device by disabling sleep mode on these versions.
319+
spiNorFlash.Sleep();
320+
}
321321
spi.Sleep();
322322
}
323323

@@ -409,14 +409,13 @@ void SystemTask::GoToRunning() {
409409
// SPI only switched off when entering Sleeping, not AOD or GoingToSleep
410410
if (state == SystemTaskState::Sleeping) {
411411
spi.Wakeup();
412+
spiNorFlash.Wakeup();
412413
}
413414

414415
// Double Tap needs the touch screen to be in normal mode
415416
if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
416417
touchPanel.Wakeup();
417418
}
418-
419-
spiNorFlash.Wakeup();
420419
}
421420

422421
displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning);

0 commit comments

Comments
 (0)