✨ DOGM Display Sleep (#23992)
Co-authored-by: borland1 <barryorlando@hotmail.com>
This commit is contained in:
@@ -192,6 +192,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() {
|
||||
@@ -1061,6 +1070,8 @@ void MarlinUI::init() {
|
||||
|
||||
#if LCD_BACKLIGHT_TIMEOUT
|
||||
refresh_backlight_timeout();
|
||||
#elif HAS_DISPLAY_SLEEP
|
||||
refresh_screen_timeout();
|
||||
#endif
|
||||
|
||||
refresh(LCDVIEW_REDRAW_NOW);
|
||||
@@ -1172,6 +1183,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
|
||||
|
Reference in New Issue
Block a user