File tree 1 file changed +11
-2
lines changed
1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -292,7 +292,13 @@ void DisplayApp::Refresh() {
292
292
switch (msg) {
293
293
case Messages::GoToSleep:
294
294
case Messages::GoToAOD:
295
- if (state != States::Running) {
295
+ // Checking if SystemTask is sleeping is purely an optimisation.
296
+ // If it's no longer sleeping since it sent GoToSleep, it has
297
+ // cancelled the sleep and transitioned directly from
298
+ // GoingToSleep->Running, so we are about to receive GoToRunning
299
+ // and can ignore this message. If it wasn't ignored, DisplayApp
300
+ // would go to sleep and then immediately re-wake
301
+ if (state != States::Running || !systemTask->IsSleeping ()) {
296
302
break ;
297
303
}
298
304
while (brightnessController.Level () != Controllers::BrightnessController::Levels::Low) {
@@ -334,7 +340,10 @@ void DisplayApp::Refresh() {
334
340
lv_disp_trig_activity (nullptr );
335
341
break ;
336
342
case Messages::GoToRunning:
337
- if (state == States::Running) {
343
+ // If SystemTask is sleeping, the GoToRunning message is old
344
+ // and must be ignored. Otherwise DisplayApp will use SPI
345
+ // that is powered down and cause bad behaviour
346
+ if (state == States::Running || systemTask->IsSleeping ()) {
338
347
break ;
339
348
}
340
349
if (state == States::AOD) {
You can’t perform that action at this time.
0 commit comments