diff --git a/Marlin/pins_RAMBO.h b/Marlin/pins_RAMBO.h index 386d63b36..e04fbc529 100644 --- a/Marlin/pins_RAMBO.h +++ b/Marlin/pins_RAMBO.h @@ -150,15 +150,6 @@ #define LCD_PINS_D6 27 #define LCD_PINS_D7 29 - //bits in the shift register that carry the buttons for: - // left up center down right red - #define BL_LE 7 - #define BL_UP 6 - #define BL_MI 5 - #define BL_DW 4 - #define BL_RI 3 - #define BL_ST 2 - #endif // !NEWPANEL #endif // ULTRA_LCD diff --git a/Marlin/ultralcd.h b/Marlin/ultralcd.h index 457a70f51..b1d4300c0 100644 --- a/Marlin/ultralcd.h +++ b/Marlin/ultralcd.h @@ -58,7 +58,6 @@ void bootscreen(); #endif - #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x)) #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x)) @@ -93,7 +92,20 @@ bool lcd_blink(); - #if ENABLED(REPRAPWORLD_KEYPAD) + #if ENABLED(ULTIPANEL) + #define BLEN_A 0 + #define BLEN_B 1 + // Encoder click is directly connected + #if BUTTON_EXISTS(ENC) + #define BLEN_C 2 + #define EN_C (_BV(BLEN_C)) + #endif + #define EN_A (_BV(BLEN_A)) + #define EN_B (_BV(BLEN_B)) + #define EN_C (_BV(BLEN_C)) + #endif + + #if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values @@ -135,35 +147,10 @@ EN_REPRAPWORLD_KEYPAD_LEFT) \ ) - #endif // REPRAPWORLD_KEYPAD - - #if ENABLED(NEWPANEL) - - #define EN_C (_BV(BLEN_C)) - #define EN_B (_BV(BLEN_B)) - #define EN_A (_BV(BLEN_A)) - - #if ENABLED(REPRAPWORLD_KEYPAD) - #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1)) - #else - #define LCD_CLICKED (buttons&EN_C) - #endif - - #else //!NEWPANEL - - //atomic, do not change - #define B_LE (_BV(BL_LE)) - #define B_UP (_BV(BL_UP)) - #define B_MI (_BV(BL_MI)) - #define B_DW (_BV(BL_DW)) - #define B_RI (_BV(BL_RI)) - #define B_ST (_BV(BL_ST)) - #define EN_B (_BV(BLEN_B)) - #define EN_A (_BV(BLEN_A)) - - #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST)) - - #endif //!NEWPANEL + #define LCD_CLICKED ((buttons & EN_C) || (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1)) + #elif ENABLED(NEWPANEL) + #define LCD_CLICKED (buttons & EN_C) + #endif #else //no LCD FORCE_INLINE void lcd_update() {} diff --git a/Marlin/ultralcd_impl_DOGM.h b/Marlin/ultralcd_impl_DOGM.h index 43b76a995..f8ffd4db0 100644 --- a/Marlin/ultralcd_impl_DOGM.h +++ b/Marlin/ultralcd_impl_DOGM.h @@ -42,20 +42,9 @@ * Implementation of the LCD display routines for a DOGM128 graphic display. * These are common LCD 128x64 pixel graphic displays. */ - -#if ENABLED(ULTIPANEL) - #define BLEN_A 0 - #define BLEN_B 1 - #define BLEN_C 2 - #define EN_A (_BV(BLEN_A)) - #define EN_B (_BV(BLEN_B)) - #define EN_C (_BV(BLEN_C)) - #define LCD_CLICKED (buttons&EN_C) -#endif - -#include "dogm_bitmaps.h" #include "ultralcd.h" #include "ultralcd_st7920_u8glib_rrd.h" +#include "dogm_bitmaps.h" #include "duration_t.h" #include diff --git a/Marlin/ultralcd_impl_HD44780.h b/Marlin/ultralcd_impl_HD44780.h index fa942d8a1..ab120c2ca 100644 --- a/Marlin/ultralcd_impl_HD44780.h +++ b/Marlin/ultralcd_impl_HD44780.h @@ -39,18 +39,6 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt // via a shift/i2c register. #if ENABLED(ULTIPANEL) - // All UltiPanels might have an encoder - so this is always be mapped onto first two bits - #define BLEN_B 1 - #define BLEN_A 0 - - #define EN_B (_BV(BLEN_B)) // The two encoder pins are connected through BTN_EN1 and BTN_EN2 - #define EN_A (_BV(BLEN_A)) - - #if BUTTON_EXISTS(ENC) - // encoder click is directly connected - #define BLEN_C 2 - #define EN_C (_BV(BLEN_C)) - #endif // // Setup other button mappings of each panel @@ -80,51 +68,35 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt #elif ENABLED(LCD_I2C_PANELOLU2) - #if BUTTON_EXISTS(ENC) - - #undef LCD_CLICKED - #define LCD_CLICKED (buttons&EN_C) - - #else // Read through I2C if not directly connected to a pin + #if !BUTTON_EXISTS(ENC) // Use I2C if not directly connected to a pin #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C) #define B_MI (PANELOLU2_ENCODER_C<