mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-02-02 07:00:42 +00:00
🧑💻 Conditional HAS_LED_POWEROFF_TIMEOUT
This commit is contained in:
parent
e0dcc610da
commit
4af5229cee
4 changed files with 15 additions and 19 deletions
|
@ -239,7 +239,7 @@ void LEDLights::set_color(const LEDColor &incol
|
|||
void LEDLights::toggle() { if (lights_on) set_off(); else update(); }
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#if HAS_LED_POWEROFF_TIMEOUT
|
||||
|
||||
millis_t LEDLights::led_off_time; // = 0
|
||||
|
||||
|
|
|
@ -164,11 +164,11 @@ public:
|
|||
#if ENABLED(LED_CONTROL_MENU)
|
||||
static void toggle(); // swap "off" with color
|
||||
#endif
|
||||
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED) || LED_POWEROFF_TIMEOUT > 0
|
||||
#if ANY(LED_CONTROL_MENU, CASE_LIGHT_USE_RGB_LED, HAS_LED_POWEROFF_TIMEOUT)
|
||||
static void update() { set_color(color); }
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#if HAS_LED_POWEROFF_TIMEOUT
|
||||
private:
|
||||
static millis_t led_off_time;
|
||||
public:
|
||||
|
|
|
@ -1898,6 +1898,10 @@
|
|||
#define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#define HAS_LED_POWEROFF_TIMEOUT 1
|
||||
#endif
|
||||
|
||||
#if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE)
|
||||
#define SPI_FLASH_BACKUP 1
|
||||
#endif
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "../MarlinCore.h" // for printingIsPaused
|
||||
#include "../gcode/parser.h" // for axis_is_rotational, using_inch_units
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0 || ALL(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (HAS_BACKLIGHT_TIMEOUT && defined(NEOPIXEL_BKGD_INDEX_FIRST))
|
||||
#if HAS_LED_POWEROFF_TIMEOUT || ALL(HAS_WIRED_LCD, PRINTER_EVENT_LEDS) || (HAS_BACKLIGHT_TIMEOUT && defined(NEOPIXEL_BKGD_INDEX_FIRST))
|
||||
#include "../feature/leds/leds.h"
|
||||
#endif
|
||||
|
||||
|
@ -319,7 +319,7 @@ void MarlinUI::init() {
|
|||
#include "../feature/power_monitor.h"
|
||||
#endif
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
#if HAS_LED_POWEROFF_TIMEOUT
|
||||
#include "../feature/power.h"
|
||||
#endif
|
||||
|
||||
|
@ -943,9 +943,7 @@ void MarlinUI::init() {
|
|||
static uint16_t max_display_update_time = 0;
|
||||
const millis_t ms = millis();
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
leds.update_timeout(powerManager.psu_on);
|
||||
#endif
|
||||
TERN_(HAS_LED_POWEROFF_TIMEOUT, leds.update_timeout(powerManager.psu_on));
|
||||
|
||||
#if HAS_MARLINUI_MENU
|
||||
|
||||
|
@ -1085,10 +1083,8 @@ void MarlinUI::init() {
|
|||
|
||||
refresh(LCDVIEW_REDRAW_NOW);
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
if (!powerManager.psu_on) leds.reset_timeout(ms);
|
||||
#endif
|
||||
} // encoder activity
|
||||
TERN_(HAS_LED_POWEROFF_TIMEOUT, if (!powerManager.psu_on) leds.reset_timeout(ms));
|
||||
} // encoder or click
|
||||
|
||||
#endif // HAS_ENCODER_ACTION
|
||||
|
||||
|
@ -1863,14 +1859,10 @@ void MarlinUI::host_notify(const char * const cstr) {
|
|||
|
||||
refresh();
|
||||
|
||||
#if HAS_WIRED_LCD || LED_POWEROFF_TIMEOUT > 0
|
||||
#if HAS_WIRED_LCD || HAS_LED_POWEROFF_TIMEOUT
|
||||
const millis_t ms = millis();
|
||||
#endif
|
||||
|
||||
TERN_(HAS_WIRED_LCD, next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL); // Delay LCD update for SD activity
|
||||
|
||||
#if LED_POWEROFF_TIMEOUT > 0
|
||||
leds.reset_timeout(ms);
|
||||
TERN_(HAS_WIRED_LCD, next_lcd_update_ms = ms + LCD_UPDATE_INTERVAL); // Delay LCD update for SD activity
|
||||
TERN_(HAS_LED_POWEROFF_TIMEOUT, leds.reset_timeout(ms));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue