Bladeren bron

Merge pull request #2821 from MarlinFirmware/ReinitializeDisplay

Fix status LEDs update when reinitializing the display
Scott Lahteine 9 jaren geleden
bovenliggende
commit
04a0d45c22
2 gewijzigde bestanden met toevoegingen van 24 en 17 verwijderingen
  1. 2
    1
      Marlin/ultralcd.h
  2. 22
    16
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 2
- 1
Marlin/ultralcd.h Bestand weergeven

@@ -67,7 +67,6 @@
67 67
     #define EN_B BIT(BLEN_B)
68 68
     #define EN_A BIT(BLEN_A)
69 69
 
70
-    #define LCD_CLICKED (buttons&EN_C)
71 70
     #if ENABLED(REPRAPWORLD_KEYPAD)
72 71
       #define EN_REPRAPWORLD_KEYPAD_F3 (BIT(BLEN_REPRAPWORLD_KEYPAD_F3))
73 72
       #define EN_REPRAPWORLD_KEYPAD_F2 (BIT(BLEN_REPRAPWORLD_KEYPAD_F2))
@@ -86,6 +85,8 @@
86 85
       #define REPRAPWORLD_KEYPAD_MOVE_Y_DOWN (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_DOWN)
87 86
       #define REPRAPWORLD_KEYPAD_MOVE_Y_UP (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_UP)
88 87
       #define REPRAPWORLD_KEYPAD_MOVE_HOME (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_MIDDLE)
88
+    #else
89
+      #define LCD_CLICKED (buttons&EN_C)
89 90
     #endif //REPRAPWORLD_KEYPAD
90 91
   #else
91 92
     //atomic, do not change

+ 22
- 16
Marlin/ultralcd_implementation_hitachi_HD44780.h Bestand weergeven

@@ -49,8 +49,10 @@
49 49
     #if defined(BTN_ENC) && BTN_ENC > -1
50 50
       // the pause/stop/restart button is connected to BTN_ENC when used
51 51
       #define B_ST (EN_C)                            // Map the pause/stop/resume button into its normalized functional name
52
+      #undef LCD_CLICKED
52 53
       #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
53 54
     #else
55
+      #undef LCD_CLICKED
54 56
       #define LCD_CLICKED (buttons&(B_MI|B_RI))
55 57
     #endif
56 58
 
@@ -64,11 +66,13 @@
64 66
 
65 67
       #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
66 68
 
69
+      #undef LCD_CLICKED
67 70
       #define LCD_CLICKED (buttons&B_MI)
68 71
 
69 72
       // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
70 73
       #define LCD_HAS_SLOW_BUTTONS
71 74
     #else
75
+      #undef LCD_CLICKED
72 76
       #define LCD_CLICKED (buttons&EN_C)
73 77
     #endif
74 78
 
@@ -206,6 +210,10 @@
206 210
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
207 211
 #endif
208 212
 
213
+#if ENABLED(LCD_HAS_STATUS_INDICATORS)
214
+  static void lcd_implementation_update_indicators();
215
+#endif
216
+
209 217
 static void lcd_set_custom_characters(
210 218
   #if ENABLED(LCD_PROGRESS_BAR)
211 219
     bool progress_bar_set = true
@@ -362,13 +370,13 @@ static void lcd_implementation_init(
362 370
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
363 371
     #ifdef LCD_I2C_PIN_BL
364 372
       lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
365
-      lcd.setBacklight(HIGH);
373
+      lcd_implementation_update_indicators();
366 374
     #endif
367 375
 
368 376
   #elif ENABLED(LCD_I2C_TYPE_MCP23017)
369 377
     lcd.setMCPType(LTI_TYPE_MCP23017);
370 378
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
371
-    lcd.setBacklight(0); //set all the LEDs off to begin with
379
+    lcd_implementation_update_indicators();
372 380
 
373 381
   #elif ENABLED(LCD_I2C_TYPE_MCP23008)
374 382
     lcd.setMCPType(LTI_TYPE_MCP23008);
@@ -835,21 +843,19 @@ void lcd_implementation_drawedit(const char* pstr, char* value) {
835 843
 #if ENABLED(LCD_HAS_STATUS_INDICATORS)
836 844
 
837 845
   static void lcd_implementation_update_indicators() {
838
-    #if ENABLED(LCD_I2C_PANELOLU2) || ENABLED(LCD_I2C_VIKI)
839
-      // Set the LEDS - referred to as backlights by the LiquidTWI2 library
840
-      static uint8_t ledsprev = 0;
841
-      uint8_t leds = 0;
842
-      if (target_temperature_bed > 0) leds |= LED_A;
843
-      if (target_temperature[0] > 0) leds |= LED_B;
844
-      if (fanSpeed) leds |= LED_C;
845
-      #if EXTRUDERS > 1
846
-        if (target_temperature[1] > 0) leds |= LED_C;
847
-      #endif
848
-      if (leds != ledsprev) {
849
-        lcd.setBacklight(leds);
850
-        ledsprev = leds;
851
-      }
846
+    // Set the LEDS - referred to as backlights by the LiquidTWI2 library
847
+    static uint8_t ledsprev = 0;
848
+    uint8_t leds = 0;
849
+    if (target_temperature_bed > 0) leds |= LED_A;
850
+    if (target_temperature[0] > 0) leds |= LED_B;
851
+    if (fanSpeed) leds |= LED_C;
852
+    #if EXTRUDERS > 1
853
+      if (target_temperature[1] > 0) leds |= LED_C;
852 854
     #endif
855
+    if (leds != ledsprev) {
856
+      lcd.setBacklight(leds);
857
+      ledsprev = leds;
858
+    }
853 859
   }
854 860
 
855 861
 #endif // LCD_HAS_STATUS_INDICATORS

Laden…
Annuleren
Opslaan