mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-04-02 19:39:08 +00:00
[1.1.x] Fix TEMP_STAT_LED startup init (#13121)
This commit is contained in:
parent
3a216bb962
commit
da112b91c5
1 changed files with 7 additions and 9 deletions
|
@ -14606,7 +14606,7 @@ void prepare_move_to_destination() {
|
||||||
|
|
||||||
#if ENABLED(TEMP_STAT_LEDS)
|
#if ENABLED(TEMP_STAT_LEDS)
|
||||||
|
|
||||||
static bool red_led = false;
|
static uint8_t red_led = -1; // Invalid value to force leds initializzation on startup
|
||||||
static millis_t next_status_led_update_ms = 0;
|
static millis_t next_status_led_update_ms = 0;
|
||||||
|
|
||||||
void handle_status_leds(void) {
|
void handle_status_leds(void) {
|
||||||
|
@ -14614,20 +14614,18 @@ void prepare_move_to_destination() {
|
||||||
next_status_led_update_ms += 500; // Update every 0.5s
|
next_status_led_update_ms += 500; // Update every 0.5s
|
||||||
float max_temp = 0.0;
|
float max_temp = 0.0;
|
||||||
#if HAS_HEATED_BED
|
#if HAS_HEATED_BED
|
||||||
max_temp = MAX3(max_temp, thermalManager.degTargetBed(), thermalManager.degBed());
|
max_temp = MAX(thermalManager.degTargetBed(), thermalManager.degBed());
|
||||||
#endif
|
#endif
|
||||||
HOTEND_LOOP()
|
HOTEND_LOOP()
|
||||||
max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
max_temp = MAX3(max_temp, thermalManager.degHotend(e), thermalManager.degTargetHotend(e));
|
||||||
const bool new_led = (max_temp > 55.0) ? true : (max_temp < 54.0) ? false : red_led;
|
const uint8_t new_led = (max_temp > 55.0) ? HIGH : (max_temp < 54.0 || red_led == -1) ? LOW : red_led;
|
||||||
if (new_led != red_led) {
|
if (new_led != red_led) {
|
||||||
red_led = new_led;
|
red_led = new_led;
|
||||||
#if PIN_EXISTS(STAT_LED_RED)
|
#if PIN_EXISTS(STAT_LED_RED)
|
||||||
WRITE(STAT_LED_RED_PIN, new_led ? HIGH : LOW);
|
WRITE(STAT_LED_RED_PIN, new_led);
|
||||||
#if PIN_EXISTS(STAT_LED_BLUE)
|
#endif
|
||||||
WRITE(STAT_LED_BLUE_PIN, new_led ? LOW : HIGH);
|
#if PIN_EXISTS(STAT_LED_BLUE)
|
||||||
#endif
|
WRITE(STAT_LED_BLUE_PIN, !new_led);
|
||||||
#else
|
|
||||||
WRITE(STAT_LED_BLUE_PIN, new_led ? HIGH : LOW);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue