feat(oled): Implement brightness control and auto-power save for bread-compact-wifi#1659
feat(oled): Implement brightness control and auto-power save for bread-compact-wifi#1659
Conversation
- **OledDisplay**: - Add hardware power control in `SetPowerSaveMode`. - Add `SetContrast` using SSD1306/SH1106 command 0x81. - Implement `OledBacklight` adapter class to map brightness to contrast. - Default brightness set to 50% to match hardware reset state. - Logic: Brightness <= 5% turns off display power; > 5% turns on and sets contrast. - **CompactWifiBoard**: - Integrate `PowerSaveTimer` for 60-second idle auto-sleep. - Override `GetBacklight` to expose `OledBacklight` to MCP tools. - Add wake-up triggers to Boot, Touch, and Volume buttons. - Sync system power save level with display timer.
|
This feature should be optional. Auto-off screens should not be mandatory for all OLED board types. |
|
I understand this is an optional feature. Is there an easy way to configure whether it is enabled or disabled, or does this currently require maintaining a custom Xiaozhi branch? |
|
Check this file: https://github.com/78/xiaozhi-esp32/blob/main/main/Kconfig.projbuild You can open the menuconfig in the root directory of the project with the following command: # idf.py menuconfig |
- Add CONFIG_OLED_AUTO_POWER_SAVE Kconfig option (default off) for bread-compact-wifi to make screen auto-off optional - Make Backlight::SetBrightness virtual to allow OledBacklight to skip the PWM gradual transition, applying brightness changes immediately
efaa093 to
2c03282
Compare
|
Hi. Why not just override |
|
Thanks for the suggestion. The reason I overrode The base I overrode Do you have any suggestions? I'd be happy to make corrections. |
Description
This PR implements comprehensive power management and brightness control for OLED displays, specifically targeting the
bread-compact-wifiboard.Key Features:
SetPowerSaveModeinOledDisplayto useesp_lcd_panel_disp_on_offfor true hardware sleep/wake.SetContrastusing command0x81.OledBacklightadapter to map brightness (0-100) to contrast (0-255).PowerSaveTimerinCompactWifiBoard.OledBacklightviaGetBacklight, enabling the standardself.screen.set_brightnesstool for voice control (e.g., "Turn off screen", "Set brightness to 50").Testing
bread-compact-wifi-128x64.Related Issue