Add auto-sleep/wake functionality with timer-based dimming
- Added PWM brightness control to ST7796 driver (0-100%) - Implemented hardware sleep mode for ST7796 (saves ~150mA) - Added sleep/wake functions preserving framebuffer and settings - Implemented timer-based inactivity detection (checks every 10s) - Auto-sleep after 5 minutes of no user input - Touch controller remains active during TFT sleep for instant wake - E-ink display also sleeps after timeout, requires re-init on wake - Added hardware_pwm library dependency to CMakeLists.txt - Brightness and sleep/wake methods exposed through display abstraction layer
This commit is contained in:
@@ -69,9 +69,24 @@ void LowLevelDisplayST7796::refresh() {
|
||||
}
|
||||
|
||||
void LowLevelDisplayST7796::set_backlight(bool on) {
|
||||
// ST7796 driver doesn't have backlight control yet
|
||||
// TODO: Add GPIO control for backlight pin
|
||||
(void)on;
|
||||
// Use brightness control: on = 100%, off = 0%
|
||||
st7796_set_brightness(on ? 100 : 0);
|
||||
}
|
||||
|
||||
void LowLevelDisplayST7796::set_brightness(uint8_t brightness) {
|
||||
st7796_set_brightness(brightness);
|
||||
}
|
||||
|
||||
uint8_t LowLevelDisplayST7796::get_brightness() const {
|
||||
return st7796_get_brightness();
|
||||
}
|
||||
|
||||
void LowLevelDisplayST7796::sleep() {
|
||||
st7796_sleep();
|
||||
}
|
||||
|
||||
void LowLevelDisplayST7796::wake() {
|
||||
st7796_wake();
|
||||
}
|
||||
|
||||
void LowLevelDisplayST7796::set_rotation(uint8_t rotation) {
|
||||
|
||||
Reference in New Issue
Block a user