From 8d1eeff021cc6f0d5620224acf046b978cafa349 Mon Sep 17 00:00:00 2001 From: AnHardt Date: Fri, 13 Nov 2015 14:04:48 +0100 Subject: [PATCH] Fix status LEDs update when reinitializing the display Fix status LEDs update when reinitializing the display By using the regular update function during init. Fixing #2683 --- Marlin/ultralcd.h | 3 +- .../ultralcd_implementation_hitachi_HD44780.h | 38 +++++++++++-------- 2 files changed, 24 insertions(+), 17 deletions(-) diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 23df71cc4..e1ccdacfa 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -67,7 +67,6 @@ #define EN_B BIT(BLEN_B) #define EN_A BIT(BLEN_A) - #define LCD_CLICKED (buttons&EN_C) #if ENABLED(REPRAPWORLD_KEYPAD) #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3)) #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2)) @@ -86,6 +85,8 @@ #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN) #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP) #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE) + #else + #define LCD_CLICKED (buttons&EN_C) #endif //REPRAPWORLD_KEYPAD #else //atomic, do not change diff --git a/Marlin/ultralcd_implementation_hitachi_HD44780.h b/Marlin/ultralcd_implementation_hitachi_HD44780.h index b2178b804..2ce720550 100644 --- a/Marlin/ultralcd_implementation_hitachi_HD44780.h +++ b/Marlin/ultralcd_implementation_hitachi_HD44780.h @@ -49,8 +49,10 @@ #if defined(BTN_ENC) && BTN_ENC > -1 // the pause/stop/restart button is connected to BTN_ENC when used #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name + #undef LCD_CLICKED #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop. #else + #undef LCD_CLICKED #define LCD_CLICKED (buttons&(B_MI|B_RI)) #endif @@ -64,11 +66,13 @@ #define B_MI (PANELOLU2_ENCODER_C< 0) leds |= LED_A; - if (target_temperature[0] > 0) leds |= LED_B; - if (fanSpeed) leds |= LED_C; - #if EXTRUDERS > 1 - if (target_temperature[1] > 0) leds |= LED_C; - #endif - if (leds != ledsprev) { - lcd.setBacklight(leds); - ledsprev = leds; - } + // Set the LEDS - referred to as backlights by the LiquidTWI2 library + static uint8_t ledsprev = 0; + uint8_t leds = 0; + if (target_temperature_bed > 0) leds |= LED_A; + if (target_temperature[0] > 0) leds |= LED_B; + if (fanSpeed) leds |= LED_C; + #if EXTRUDERS > 1 + if (target_temperature[1] > 0) leds |= LED_C; #endif + if (leds != ledsprev) { + lcd.setBacklight(leds); + ledsprev = leds; + } } #endif // LCD_HAS_STATUS_INDICATORS