24
24
25
25
#include " ../MarlinCore.h" // for printingIsPaused
26
26
27
- #if LED_POWEROFF_TIMEOUT > 0 || ALL(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (defined(LCD_BACKLIGHT_TIMEOUT_MINS) && defined(NEOPIXEL_BKGD_INDEX_FIRST))
27
+ #if LED_POWEROFF_TIMEOUT > 0 || ALL(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (HAS_BACKLIGHT_TIMEOUT && defined(NEOPIXEL_BKGD_INDEX_FIRST))
28
28
#include " ../feature/leds/leds.h"
29
29
#endif
30
30
@@ -185,10 +185,14 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
185
185
volatile int8_t encoderDiff; // Updated in update_buttons, added to encoderPosition every LCD update
186
186
#endif
187
187
188
- #if LCD_BACKLIGHT_TIMEOUT_MINS
188
+ #if HAS_BACKLIGHT_TIMEOUT
189
189
190
+ #if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
191
+ uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load()
192
+ #else
193
+ constexpr uint8_t MarlinUI::backlight_timeout_minutes;
194
+ #endif
190
195
constexpr uint8_t MarlinUI::backlight_timeout_min, MarlinUI::backlight_timeout_max;
191
- uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load()
192
196
millis_t MarlinUI::backlight_off_ms = 0 ;
193
197
194
198
void MarlinUI::refresh_backlight_timeout () {
@@ -203,12 +207,16 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
203
207
204
208
#elif HAS_DISPLAY_SLEEP
205
209
210
+ #if ENABLED(EDITABLE_DISPLAY_TIMEOUT)
211
+ uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
212
+ #else
213
+ constexpr uint8_t MarlinUI::sleep_timeout_minutes;
214
+ #endif
206
215
constexpr uint8_t MarlinUI::sleep_timeout_min, MarlinUI::sleep_timeout_max;
207
216
208
- uint8_t MarlinUI::sleep_timeout_minutes; // Initialized by settings.load()
209
- millis_t MarlinUI::screen_timeout_millis = 0 ;
217
+ millis_t MarlinUI::screen_timeout_ms = 0 ;
210
218
void MarlinUI::refresh_screen_timeout () {
211
- screen_timeout_millis = sleep_timeout_minutes ? millis () + sleep_timeout_minutes * 60UL * 1000UL : 0 ;
219
+ screen_timeout_ms = sleep_timeout_minutes ? millis () + sleep_timeout_minutes * 60UL * 1000UL : 0 ;
212
220
sleep_display (false );
213
221
}
214
222
@@ -1092,7 +1100,7 @@ void MarlinUI::init() {
1092
1100
if (encoderPastThreshold || lcd_clicked) {
1093
1101
reset_status_timeout (ms);
1094
1102
1095
- #if LCD_BACKLIGHT_TIMEOUT_MINS
1103
+ #if HAS_BACKLIGHT_TIMEOUT
1096
1104
refresh_backlight_timeout ();
1097
1105
#elif HAS_DISPLAY_SLEEP
1098
1106
refresh_screen_timeout ();
@@ -1202,8 +1210,7 @@ void MarlinUI::init() {
1202
1210
return_to_status ();
1203
1211
#endif
1204
1212
1205
- #if LCD_BACKLIGHT_TIMEOUT_MINS
1206
-
1213
+ #if HAS_BACKLIGHT_TIMEOUT
1207
1214
if (backlight_off_ms && ELAPSED (ms, backlight_off_ms)) {
1208
1215
#ifdef NEOPIXEL_BKGD_INDEX_FIRST
1209
1216
neo.set_background_off ();
@@ -1214,7 +1221,7 @@ void MarlinUI::init() {
1214
1221
backlight_off_ms = 0 ;
1215
1222
}
1216
1223
#elif HAS_DISPLAY_SLEEP
1217
- if (screen_timeout_millis && ELAPSED (ms, screen_timeout_millis ))
1224
+ if (screen_timeout_ms && ELAPSED (ms, screen_timeout_ms ))
1218
1225
sleep_display ();
1219
1226
#endif
1220
1227
0 commit comments