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
This commit is contained in:
AnHardt 2015-11-13 14:04:48 +01:00 committed by Richard Wackerbarth
parent 5a54204f72
commit 8d1eeff021
2 changed files with 24 additions and 17 deletions

View file

@ -67,7 +67,6 @@
#define EN_B BIT(BLEN_B) #define EN_B BIT(BLEN_B)
#define EN_A BIT(BLEN_A) #define EN_A BIT(BLEN_A)
#define LCD_CLICKED (buttons&EN_C)
#if ENABLED(REPRAPWORLD_KEYPAD) #if ENABLED(REPRAPWORLD_KEYPAD)
#define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3)) #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
#define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2)) #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_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_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
#define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE) #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
#else
#define LCD_CLICKED (buttons&EN_C)
#endif //REPRAPWORLD_KEYPAD #endif //REPRAPWORLD_KEYPAD
#else #else
//atomic, do not change //atomic, do not change

View file

@ -49,8 +49,10 @@
#if defined(BTN_ENC) && BTN_ENC > -1 #if defined(BTN_ENC) && BTN_ENC > -1
// the pause/stop/restart button is connected to BTN_ENC when used // 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 #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. #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
#else #else
#undef LCD_CLICKED
#define LCD_CLICKED (buttons&(B_MI|B_RI)) #define LCD_CLICKED (buttons&(B_MI|B_RI))
#endif #endif
@ -64,11 +66,13 @@
#define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
#undef LCD_CLICKED
#define LCD_CLICKED (buttons&B_MI) #define LCD_CLICKED (buttons&B_MI)
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
#define LCD_HAS_SLOW_BUTTONS #define LCD_HAS_SLOW_BUTTONS
#else #else
#undef LCD_CLICKED
#define LCD_CLICKED (buttons&EN_C) #define LCD_CLICKED (buttons&EN_C)
#endif #endif
@ -206,6 +210,10 @@
#define LCD_STR_PROGRESS "\x03\x04\x05" #define LCD_STR_PROGRESS "\x03\x04\x05"
#endif #endif
#if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators();
#endif
static void lcd_set_custom_characters( static void lcd_set_custom_characters(
#if ENABLED(LCD_PROGRESS_BAR) #if ENABLED(LCD_PROGRESS_BAR)
bool progress_bar_set = true bool progress_bar_set = true
@ -362,13 +370,13 @@ static void lcd_implementation_init(
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
#ifdef LCD_I2C_PIN_BL #ifdef LCD_I2C_PIN_BL
lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE); lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
lcd.setBacklight(HIGH); lcd_implementation_update_indicators();
#endif #endif
#elif ENABLED(LCD_I2C_TYPE_MCP23017) #elif ENABLED(LCD_I2C_TYPE_MCP23017)
lcd.setMCPType(LTI_TYPE_MCP23017); lcd.setMCPType(LTI_TYPE_MCP23017);
lcd.begin(LCD_WIDTH, LCD_HEIGHT); lcd.begin(LCD_WIDTH, LCD_HEIGHT);
lcd.setBacklight(0); //set all the LEDs off to begin with lcd_implementation_update_indicators();
#elif ENABLED(LCD_I2C_TYPE_MCP23008) #elif ENABLED(LCD_I2C_TYPE_MCP23008)
lcd.setMCPType(LTI_TYPE_MCP23008); lcd.setMCPType(LTI_TYPE_MCP23008);
@ -831,7 +839,6 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
#if ENABLED(LCD_HAS_STATUS_INDICATORS) #if ENABLED(LCD_HAS_STATUS_INDICATORS)
static void lcd_implementation_update_indicators() { static void lcd_implementation_update_indicators() {
#if ENABLED(LCD_I2C_PANELOLU2) || ENABLED(LCD_I2C_VIKI)
// Set the LEDS - referred to as backlights by the LiquidTWI2 library // Set the LEDS - referred to as backlights by the LiquidTWI2 library
static uint8_t ledsprev = 0; static uint8_t ledsprev = 0;
uint8_t leds = 0; uint8_t leds = 0;
@ -845,7 +852,6 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
lcd.setBacklight(leds); lcd.setBacklight(leds);
ledsprev = leds; ledsprev = leds;
} }
#endif
} }
#endif // LCD_HAS_STATUS_INDICATORS #endif // LCD_HAS_STATUS_INDICATORS