|
24 | 24 |
|
25 | 25 | #include "../MarlinCore.h" // for printingIsPaused
|
26 | 26 |
|
27 |
| -#if LED_POWEROFF_TIMEOUT > 0 || BOTH(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) |
| 27 | +#if LED_POWEROFF_TIMEOUT > 0 || BOTH(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (defined(LCD_BACKLIGHT_TIMEOUT_MINS) && defined(NEOPIXEL_BKGD_INDEX_FIRST)) |
28 | 28 | #include "../feature/leds/leds.h"
|
29 | 29 | #endif
|
30 | 30 |
|
@@ -186,12 +186,17 @@ constexpr uint8_t epps = ENCODER_PULSES_PER_STEP;
|
186 | 186 | #if LCD_BACKLIGHT_TIMEOUT_MINS
|
187 | 187 |
|
188 | 188 | constexpr uint8_t MarlinUI::backlight_timeout_min, MarlinUI::backlight_timeout_max;
|
189 |
| - |
190 | 189 | uint8_t MarlinUI::backlight_timeout_minutes; // Initialized by settings.load()
|
191 | 190 | millis_t MarlinUI::backlight_off_ms = 0;
|
| 191 | + |
192 | 192 | void MarlinUI::refresh_backlight_timeout() {
|
193 | 193 | backlight_off_ms = backlight_timeout_minutes ? millis() + backlight_timeout_minutes * 60UL * 1000UL : 0;
|
194 |
| - WRITE(LCD_BACKLIGHT_PIN, HIGH); |
| 194 | + #ifdef NEOPIXEL_BKGD_INDEX_FIRST |
| 195 | + neo.reset_background_color(); |
| 196 | + neo.show(); |
| 197 | + #elif PIN_EXISTS(LCD_BACKLIGHT) |
| 198 | + WRITE(LCD_BACKLIGHT_PIN, HIGH); |
| 199 | + #endif |
195 | 200 | }
|
196 | 201 |
|
197 | 202 | #elif HAS_DISPLAY_SLEEP
|
@@ -1196,8 +1201,14 @@ void MarlinUI::init() {
|
1196 | 1201 | #endif
|
1197 | 1202 |
|
1198 | 1203 | #if LCD_BACKLIGHT_TIMEOUT_MINS
|
| 1204 | + |
1199 | 1205 | if (backlight_off_ms && ELAPSED(ms, backlight_off_ms)) {
|
1200 |
| - WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off |
| 1206 | + #ifdef NEOPIXEL_BKGD_INDEX_FIRST |
| 1207 | + neo.set_background_off(); |
| 1208 | + neo.show(); |
| 1209 | + #elif PIN_EXIST(LCD_BACKLIGHT) |
| 1210 | + WRITE(LCD_BACKLIGHT_PIN, LOW); // Backlight off |
| 1211 | + #endif |
1201 | 1212 | backlight_off_ms = 0;
|
1202 | 1213 | }
|
1203 | 1214 | #elif HAS_DISPLAY_SLEEP
|
|
0 commit comments