InfiniTime.git

commit 8a2ee437f52312cbe22741023cbbe9cec7b4e8f6

Author: mark9064 <30447455+mark9064@users.noreply.github.com>

Restrict hardware reactivation when not sleeping

 src/systemtask/SystemTask.cpp | 20 +++++++++++---------


diff --git a/src/systemtask/SystemTask.cpp b/src/systemtask/SystemTask.cpp
index ba12535c44ee576fb6dfee50c20c02031077dd71..1bfae4c6046390a75c6d601d45adcdb05abbe86d 100644
--- a/src/systemtask/SystemTask.cpp
+++ b/src/systemtask/SystemTask.cpp
@@ -386,17 +386,19 @@ void SystemTask::GoToRunning() {
   if (state == SystemTaskState::Running) {
     return;
   }
-  // SPI only switched off when entering Sleeping, not AOD or GoingToSleep
-  if (state == SystemTaskState::Sleeping) {
-    spi.Wakeup();
-  }
+  if (state == SystemTaskState::Sleeping || state == SystemTaskState::AODSleeping) {
+    // SPI only switched off when entering Sleeping, not AOD or GoingToSleep
+    if (state == SystemTaskState::Sleeping) {
+      spi.Wakeup();
+    }
 
-  // Double Tap needs the touch screen to be in normal mode
-  if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
-    touchPanel.Wakeup();
-  }
+    // Double Tap needs the touch screen to be in normal mode
+    if (!settingsController.isWakeUpModeOn(Pinetime::Controllers::Settings::WakeUpMode::DoubleTap)) {
+      touchPanel.Wakeup();
+    }
 
-  spiNorFlash.Wakeup();
+    spiNorFlash.Wakeup();
+  }
 
   displayApp.PushMessage(Pinetime::Applications::Display::Messages::GoToRunning);
   heartRateApp.PushMessage(Pinetime::Applications::HeartRateTask::Messages::WakeUp);