|
@ -174,22 +174,26 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP; |
|
|
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
|
|
|
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
|
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if LCD_BACKLIGHT_TIMEOUT |
|
|
#if LCD_BACKLIGHT_TIMEOUT_MINS |
|
|
|
|
|
|
|
|
uint16_t MarlinUI::lcd_backlight_timeout; // Initialized by settings.load()
|
|
|
constexpr uint8_t MarlinUI::backlight_timeout_min, MarlinUI::backlight_timeout_max; |
|
|
|
|
|
|
|
|
|
|
|
uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load()
|
|
|
millis_t MarlinUI::backlight_off_ms = 0; |
|
|
millis_t MarlinUI::backlight_off_ms = 0; |
|
|
void MarlinUI::refresh_backlight_timeout() { |
|
|
void MarlinUI::refresh_backlight_timeout() { |
|
|
backlight_off_ms = lcd_backlight_timeout ? millis() + lcd_backlight_timeout * 1000UL : 0; |
|
|
backlight_off_ms = backlight_timeout_minutes ? millis() + backlight_timeout_minutes * 60UL * 1000UL : 0; |
|
|
WRITE(LCD_BACKLIGHT_PIN, HIGH); |
|
|
WRITE(LCD_BACKLIGHT_PIN, HIGH); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#elif HAS_DISPLAY_SLEEP |
|
|
#elif HAS_DISPLAY_SLEEP |
|
|
|
|
|
|
|
|
|
|
|
constexpr uint8_t MarlinUI::sleep_timeout_min, MarlinUI::sleep_timeout_max; |
|
|
|
|
|
|
|
|
uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
|
|
|
uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
|
|
|
millis_t MarlinUI::screen_timeout_millis = 0; |
|
|
millis_t MarlinUI::screen_timeout_millis = 0; |
|
|
void MarlinUI::refresh_screen_timeout() { |
|
|
void MarlinUI::refresh_screen_timeout() { |
|
|
screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0; |
|
|
screen_timeout_millis = sleep_timeout_minutes ? millis() + sleep_timeout_minutes * 60UL * 1000UL : 0; |
|
|
sleep_off(); |
|
|
sleep_display(false); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
#endif |
|
|
#endif |
|
@ -1059,7 +1063,7 @@ void MarlinUI::init() { |
|
|
|
|
|
|
|
|
reset_status_timeout(ms); |
|
|
reset_status_timeout(ms); |
|
|
|
|
|
|
|
|
#if LCD_BACKLIGHT_TIMEOUT |
|
|
#if LCD_BACKLIGHT_TIMEOUT_MINS |
|
|
refresh_backlight_timeout(); |
|
|
refresh_backlight_timeout(); |
|
|
#elif HAS_DISPLAY_SLEEP |
|
|
#elif HAS_DISPLAY_SLEEP |
|
|
refresh_screen_timeout(); |
|
|
refresh_screen_timeout(); |
|
@ -1169,14 +1173,14 @@ void MarlinUI::init() { |
|
|
return_to_status(); |
|
|
return_to_status(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
#if LCD_BACKLIGHT_TIMEOUT |
|
|
#if LCD_BACKLIGHT_TIMEOUT_MINS |
|
|
if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) { |
|
|
if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) { |
|
|
WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off
|
|
|
WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off
|
|
|
backlight_off_ms = 0; |
|
|
backlight_off_ms = 0; |
|
|
} |
|
|
} |
|
|
#elif HAS_DISPLAY_SLEEP |
|
|
#elif HAS_DISPLAY_SLEEP |
|
|
if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis)) |
|
|
if (screen_timeout_millis && ELAPSED(ms, screen_timeout_millis)) |
|
|
sleep_on(); |
|
|
sleep_display(); |
|
|
#endif |
|
|
#endif |
|
|
|
|
|
|
|
|
// Change state of drawing flag between screen updates
|
|
|
// Change state of drawing flag between screen updates
|
|
|