DOGM Display Sleep (#23992)

Co-authored-by: borland1 <barryorlando@hotmail.com>
This commit is contained in:
Scott Lahteine
2022-04-04 15:57:03 -05:00
committed by Scott Lahteine
parent 4ae54a6229
commit dbd00d9927
13 changed files with 141 additions and 2 deletions

View File

@@ -191,6 +191,15 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
WRITE(LCD_BACKLIGHT_PIN, HIGH);
}
#elif HAS_DISPLAY_SLEEP
uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
millis_t MarlinUI::screen_timeout_millis = 0;
void MarlinUI::refresh_screen_timeout() {
screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0;
sleep_off();
}
#endif
void MarlinUI::init() {
@@ -1060,6 +1069,8 @@ void MarlinUI::init() {
#if LCD_BACKLIGHT_TIMEOUT
refresh_backlight_timeout();
#elif HAS_DISPLAY_SLEEP
refresh_screen_timeout();
#endif
refresh(LCDVIEW_REDRAW_NOW);
@@ -1171,6 +1182,9 @@ void MarlinUI::init() {
WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off
backlight_off_ms = 0;
}
#elif HAS_DISPLAY_SLEEP
if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis))
sleep_on();
#endif
// Change state of drawing flag between screen updates