Adafruit_Learning_System_Guides
Adafruit_Learning_System_Guides copied to clipboard
Macropad hotkeys: Add screensaver mode to prevent OLED burn-in
This commit introduces a screensaver mode to the Adafruit Macropad hotkeys script, addressing issue #2882.
Key Changes:
- Screensaver Activation: Added a new configurable parameter
SCREENSAVER_START_TIME, which specifies the duration of inactivity (in seconds) before the screensaver activates. - Class-Level Variables: Introduced class-level variables in the
Appclass to track the last activity time, screensaver mode status, and breathing effect brightness. - Screensaver Functions: Added helper functions:
enter_screensaver_mode(): Turns off the OLED display and LEDs, entering screensaver mode.wake_from_screensaver(): Exits screensaver mode and restores the previous state of the display and LEDs.screensaver_breathing_effect(): Implements a breathing LED effect during screensaver mode.
- Main Loop Integration: Modified the main loop to monitor inactivity and trigger the screensaver mode based on the specified timeout.
This update ensures the Macropad’s OLED display is protected from burn-in during extended periods of inactivity.
Fixes #2882.
/cc @PaintYourDragon PTAL