Fix leaving display on in deep sleep.

We shutoff screen immediately, rather than waiting for our loop call()
1.2-legacy
geeksville 2020-05-17 05:11:32 -07:00
rodzic efc239533c
commit ef831a0b4d
1 zmienionych plików z 8 dodań i 1 usunięć

Wyświetl plik

@ -100,7 +100,14 @@ class Screen : public PeriodicTask
void setup();
/// Turns the screen on/off.
void setOn(bool on) { enqueueCmd(CmdItem{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF}); }
void setOn(bool on)
{
if (!on)
handleSetOn(
false); // We handle off commands immediately, because they might be called because the CPU is shutting down
else
enqueueCmd(CmdItem{.cmd = on ? Cmd::SET_ON : Cmd::SET_OFF});
}
/// Handles a button press.
void onPress() { enqueueCmd(CmdItem{.cmd = Cmd::ON_PRESS}); }