🧑💻 Conditional HAS_LED_POWEROFF_TIMEOUT
This commit is contained in:
parent
e0dcc610da
commit
4af5229cee
@ -239,7 +239,7 @@ void LEDLights::set_color(const LEDColor &incol
|
|||||||
void LEDLights::toggle() { if (lights_on) set_off(); else update(); }
|
void LEDLights::toggle() { if (lights_on) set_off(); else update(); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LED_POWEROFF_TIMEOUT > 0
|
#if HAS_LED_POWEROFF_TIMEOUT
|
||||||
|
|
||||||
millis_t LEDLights::led_off_time; // = 0
|
millis_t LEDLights::led_off_time; // = 0
|
||||||
|
|
||||||
|
@ -164,11 +164,11 @@ public:
|
|||||||
#if ENABLED(LED_CONTROL_MENU)
|
#if ENABLED(LED_CONTROL_MENU)
|
||||||
static void toggle(); // swap "off" with color
|
static void toggle(); // swap "off" with color
|
||||||
#endif
|
#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); }
|
static void update() { set_color(color); }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LED_POWEROFF_TIMEOUT > 0
|
#if HAS_LED_POWEROFF_TIMEOUT
|
||||||
private:
|
private:
|
||||||
static millis_t led_off_time;
|
static millis_t led_off_time;
|
||||||
public:
|
public:
|
||||||
|
@ -1898,6 +1898,10 @@
|
|||||||
#define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
|
#define NEOPIXEL_BKGD_INDEX_LAST NEOPIXEL_BKGD_INDEX_FIRST
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if LED_POWEROFF_TIMEOUT > 0
|
||||||
|
#define HAS_LED_POWEROFF_TIMEOUT 1
|
||||||
|
#endif
|
||||||
|
|
||||||
#if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE)
|
#if ALL(SPI_FLASH, HAS_MEDIA, MARLIN_DEV_MODE)
|
||||||
#define SPI_FLASH_BACKUP 1
|
#define SPI_FLASH_BACKUP 1
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
#include "../MarlinCore.h" // for printingIsPaused
|
#include "../MarlinCore.h" // for printingIsPaused
|
||||||
#include "../gcode/parser.h" // for axis_is_rotational, using_inch_units
|
#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"
|
#include "../feature/leds/leds.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ void MarlinUI::init() {
|
|||||||
#include "../feature/power_monitor.h"
|
#include "../feature/power_monitor.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if LED_POWEROFF_TIMEOUT > 0
|
#if HAS_LED_POWEROFF_TIMEOUT
|
||||||
#include "../feature/power.h"
|
#include "../feature/power.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -943,9 +943,7 @@ void MarlinUI::init() {
|
|||||||
static uint16_t max_display_update_time = 0;
|
static uint16_t max_display_update_time = 0;
|
||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
|
|
||||||
#if LED_POWEROFF_TIMEOUT > 0
|
TERN_(HAS_LED_POWEROFF_TIMEOUT, leds.update_timeout(powerManager.psu_on));
|
||||||
leds.update_timeout(powerManager.psu_on);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if HAS_MARLINUI_MENU
|
#if HAS_MARLINUI_MENU
|
||||||
|
|
||||||
@ -1085,10 +1083,8 @@ void MarlinUI::init() {
|
|||||||
|
|
||||||
refresh(LCDVIEW_REDRAW_NOW);
|
refresh(LCDVIEW_REDRAW_NOW);
|
||||||
|
|
||||||
#if LED_POWEROFF_TIMEOUT > 0
|
TERN_(HAS_LED_POWEROFF_TIMEOUT, if (!powerManager.psu_on) leds.reset_timeout(ms));
|
||||||
if (!powerManager.psu_on) leds.reset_timeout(ms);
|
} // encoder or click
|
||||||
#endif
|
|
||||||
} // encoder activity
|
|
||||||
|
|
||||||
#endif // HAS_ENCODER_ACTION
|
#endif // HAS_ENCODER_ACTION
|
||||||
|
|
||||||
@ -1863,14 +1859,10 @@ void MarlinUI::host_notify(const char * const cstr) {
|
|||||||
|
|
||||||
refresh();
|
refresh();
|
||||||
|
|
||||||
#if HAS_WIRED_LCD || LED_POWEROFF_TIMEOUT > 0
|
#if HAS_WIRED_LCD || HAS_LED_POWEROFF_TIMEOUT
|
||||||
const millis_t ms = millis();
|
const millis_t ms = millis();
|
||||||
#endif
|
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));
|
||||||
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);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user