Bläddra i källkod

Merge pull request #2821 from MarlinFirmware/ReinitializeDisplay

Fix status LEDs update when reinitializing the display
Scott Lahteine 9 år sedan
förälder
incheckning
04a0d45c22
2 ändrade filer med 24 tillägg och 17 borttagningar
  1. 2
    1
      Marlin/ultralcd.h
  2. 22
    16
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 2
- 1
Marlin/ultralcd.h Visa fil

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

+ 22
- 16
Marlin/ultralcd_implementation_hitachi_HD44780.h Visa fil

49
     #if defined(BTN_ENC) && BTN_ENC > -1
49
     #if defined(BTN_ENC) && BTN_ENC > -1
50
       // the pause/stop/restart button is connected to BTN_ENC when used
50
       // the pause/stop/restart button is connected to BTN_ENC when used
51
       #define B_ST (EN_C)                            // Map the pause/stop/resume button into its normalized functional name
51
       #define B_ST (EN_C)                            // Map the pause/stop/resume button into its normalized functional name
52
+      #undef LCD_CLICKED
52
       #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
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
     #else
54
     #else
55
+      #undef LCD_CLICKED
54
       #define LCD_CLICKED (buttons&(B_MI|B_RI))
56
       #define LCD_CLICKED (buttons&(B_MI|B_RI))
55
     #endif
57
     #endif
56
 
58
 
64
 
66
 
65
       #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
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
       #define LCD_CLICKED (buttons&B_MI)
70
       #define LCD_CLICKED (buttons&B_MI)
68
 
71
 
69
       // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
72
       // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
70
       #define LCD_HAS_SLOW_BUTTONS
73
       #define LCD_HAS_SLOW_BUTTONS
71
     #else
74
     #else
75
+      #undef LCD_CLICKED
72
       #define LCD_CLICKED (buttons&EN_C)
76
       #define LCD_CLICKED (buttons&EN_C)
73
     #endif
77
     #endif
74
 
78
 
206
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
210
   #define LCD_STR_PROGRESS  "\x03\x04\x05"
207
 #endif
211
 #endif
208
 
212
 
213
+#if ENABLED(LCD_HAS_STATUS_INDICATORS)
214
+  static void lcd_implementation_update_indicators();
215
+#endif
216
+
209
 static void lcd_set_custom_characters(
217
 static void lcd_set_custom_characters(
210
   #if ENABLED(LCD_PROGRESS_BAR)
218
   #if ENABLED(LCD_PROGRESS_BAR)
211
     bool progress_bar_set = true
219
     bool progress_bar_set = true
362
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
370
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
363
     #ifdef LCD_I2C_PIN_BL
371
     #ifdef LCD_I2C_PIN_BL
364
       lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
372
       lcd.setBacklightPin(LCD_I2C_PIN_BL, POSITIVE);
365
-      lcd.setBacklight(HIGH);
373
+      lcd_implementation_update_indicators();
366
     #endif
374
     #endif
367
 
375
 
368
   #elif ENABLED(LCD_I2C_TYPE_MCP23017)
376
   #elif ENABLED(LCD_I2C_TYPE_MCP23017)
369
     lcd.setMCPType(LTI_TYPE_MCP23017);
377
     lcd.setMCPType(LTI_TYPE_MCP23017);
370
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
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
   #elif ENABLED(LCD_I2C_TYPE_MCP23008)
381
   #elif ENABLED(LCD_I2C_TYPE_MCP23008)
374
     lcd.setMCPType(LTI_TYPE_MCP23008);
382
     lcd.setMCPType(LTI_TYPE_MCP23008);
835
 #if ENABLED(LCD_HAS_STATUS_INDICATORS)
843
 #if ENABLED(LCD_HAS_STATUS_INDICATORS)
836
 
844
 
837
   static void lcd_implementation_update_indicators() {
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
     #endif
854
     #endif
855
+    if (leds != ledsprev) {
856
+      lcd.setBacklight(leds);
857
+      ledsprev = leds;
858
+    }
853
   }
859
   }
854
 
860
 
855
 #endif // LCD_HAS_STATUS_INDICATORS
861
 #endif // LCD_HAS_STATUS_INDICATORS

Laddar…
Avbryt
Spara