Ignore old GoToRunning messages
This commit is contained in:
parent
6c7eb6630e
commit
8aefa3b9a6
|
@ -292,7 +292,13 @@ void DisplayApp::Refresh() {
|
||||||
switch (msg) {
|
switch (msg) {
|
||||||
case Messages::GoToSleep:
|
case Messages::GoToSleep:
|
||||||
case Messages::GoToAOD:
|
case Messages::GoToAOD:
|
||||||
if (state != States::Running) {
|
// Checking if SystemTask is sleeping is purely an optimisation.
|
||||||
|
// If it's no longer sleeping since it sent GoToSleep, it has
|
||||||
|
// cancelled the sleep and transitioned directly from
|
||||||
|
// GoingToSleep->Running, so we are about to receive GoToRunning
|
||||||
|
// and can ignore this message. If it wasn't ignored, DisplayApp
|
||||||
|
// would go to sleep and then immediately re-wake
|
||||||
|
if (state != States::Running || !systemTask->IsSleeping()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
while (brightnessController.Level() != Controllers::BrightnessController::Levels::Low) {
|
while (brightnessController.Level() != Controllers::BrightnessController::Levels::Low) {
|
||||||
|
@ -334,7 +340,10 @@ void DisplayApp::Refresh() {
|
||||||
lv_disp_trig_activity(nullptr);
|
lv_disp_trig_activity(nullptr);
|
||||||
break;
|
break;
|
||||||
case Messages::GoToRunning:
|
case Messages::GoToRunning:
|
||||||
if (state == States::Running) {
|
// If SystemTask is sleeping, the GoToRunning message is old
|
||||||
|
// and must be ignored. Otherwise DisplayApp will use SPI
|
||||||
|
// that is powered down and cause bad behaviour
|
||||||
|
if (state == States::Running || systemTask->IsSleeping()) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (state == States::AOD) {
|
if (state == States::AOD) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user