mirror of
https://github.com/ratspeak/ratdeck.git
synced 2026-10-23 01:41:17 +00:00
power: keyboard backlight follows screen sleep
This commit is contained in:
1 parent
c4d4309f8d
commit
969267657e
4 files changed
+11
-4
No files matched your search
+6
-4
@@ -134,7 +134,9 @@ void Power::setState(State newState) {
|
||||
} else {
|
||||
display.setBrightness(percentToPWM(_brightnessPct));
|
||||
}
|
||||
if (_kbAutoOn) {
|
||||
// On wake, relight only what screen-off forced dark (or per auto-on) —
|
||||
// never force-enable for users who keep the kb light off.
|
||||
if (_kbAutoOn || (oldState == SCREEN_OFF && _kbLitBeforeOff)) {
|
||||
keyboard.backlightOn();
|
||||
}
|
||||
break;
|
||||
@@ -148,9 +150,9 @@ void Power::setState(State newState) {
|
||||
// LovyanGFX sleep() sets brightness to 0 internally — no
|
||||
// need to call setBrightness(0) beforehand.
|
||||
display.sleep();
|
||||
if (_kbAutoOff) {
|
||||
keyboard.backlightOff();
|
||||
}
|
||||
// Kb backlight always follows screen-off — the timeout exists to save battery.
|
||||
_kbLitBeforeOff = keyboard.backlightIsLit();
|
||||
keyboard.backlightOff();
|
||||
break;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user