|
@@ -39,18 +39,6 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
|
39
|
39
|
// via a shift/i2c register.
|
40
|
40
|
|
41
|
41
|
#if ENABLED(ULTIPANEL)
|
42
|
|
- // All UltiPanels might have an encoder - so this is always be mapped onto first two bits
|
43
|
|
- #define BLEN_B 1
|
44
|
|
- #define BLEN_A 0
|
45
|
|
-
|
46
|
|
- #define EN_B (_BV(BLEN_B)) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
|
47
|
|
- #define EN_A (_BV(BLEN_A))
|
48
|
|
-
|
49
|
|
- #if BUTTON_EXISTS(ENC)
|
50
|
|
- // encoder click is directly connected
|
51
|
|
- #define BLEN_C 2
|
52
|
|
- #define EN_C (_BV(BLEN_C))
|
53
|
|
- #endif
|
54
|
42
|
|
55
|
43
|
//
|
56
|
44
|
// Setup other button mappings of each panel
|
|
@@ -80,51 +68,35 @@ extern volatile uint8_t buttons; //an extended version of the last checked butt
|
80
|
68
|
|
81
|
69
|
#elif ENABLED(LCD_I2C_PANELOLU2)
|
82
|
70
|
|
83
|
|
- #if BUTTON_EXISTS(ENC)
|
84
|
|
-
|
85
|
|
- #undef LCD_CLICKED
|
86
|
|
- #define LCD_CLICKED (buttons&EN_C)
|
87
|
|
-
|
88
|
|
- #else // Read through I2C if not directly connected to a pin
|
|
71
|
+ #if !BUTTON_EXISTS(ENC) // Use I2C if not directly connected to a pin
|
89
|
72
|
|
90
|
73
|
#define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
|
91
|
74
|
|
92
|
75
|
#define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
|
93
|
76
|
|
94
|
77
|
#undef LCD_CLICKED
|
95
|
|
- #define LCD_CLICKED (buttons&B_MI)
|
|
78
|
+ #define LCD_CLICKED (buttons & B_MI)
|
96
|
79
|
|
97
|
80
|
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
|
98
|
81
|
#define LCD_HAS_SLOW_BUTTONS
|
99
|
82
|
|
100
|
83
|
#endif
|
101
|
84
|
|
102
|
|
- #elif ENABLED(REPRAPWORLD_KEYPAD)
|
103
|
|
-
|
104
|
|
- // REPRAPWORLD_KEYPAD defined in ultralcd.h
|
105
|
|
-
|
106
|
|
- #elif ENABLED(NEWPANEL)
|
107
|
|
- #define LCD_CLICKED (buttons&EN_C)
|
108
|
|
-
|
109
|
|
- #else // old style ULTIPANEL
|
110
|
|
- //bits in the shift register that carry the buttons for:
|
111
|
|
- // left up center down right red(stop)
|
112
|
|
- #define BL_LE 7
|
113
|
|
- #define BL_UP 6
|
114
|
|
- #define BL_MI 5
|
115
|
|
- #define BL_DW 4
|
116
|
|
- #define BL_RI 3
|
117
|
|
- #define BL_ST 2
|
118
|
|
-
|
119
|
|
- //automatic, do not change
|
|
85
|
+ #elif DISABLED(NEWPANEL) // old style ULTIPANEL
|
|
86
|
+ // Shift register bits correspond to buttons:
|
|
87
|
+ #define BL_LE 7 // Left
|
|
88
|
+ #define BL_UP 6 // Up
|
|
89
|
+ #define BL_MI 5 // Middle
|
|
90
|
+ #define BL_DW 4 // Down
|
|
91
|
+ #define BL_RI 3 // Right
|
|
92
|
+ #define BL_ST 2 // Red Button
|
120
|
93
|
#define B_LE (_BV(BL_LE))
|
121
|
94
|
#define B_UP (_BV(BL_UP))
|
122
|
95
|
#define B_MI (_BV(BL_MI))
|
123
|
96
|
#define B_DW (_BV(BL_DW))
|
124
|
97
|
#define B_RI (_BV(BL_RI))
|
125
|
98
|
#define B_ST (_BV(BL_ST))
|
126
|
|
-
|
127
|
|
- #define LCD_CLICKED (buttons&(B_MI|B_ST))
|
|
99
|
+ #define LCD_CLICKED ((buttons & B_MI) || (buttons & B_ST))
|
128
|
100
|
#endif
|
129
|
101
|
|
130
|
102
|
#endif //ULTIPANEL
|