|
@@ -23,32 +23,52 @@ extern volatile uint8_t buttons; //the last checked buttons in a bit array.
|
23
|
23
|
#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
|
24
|
24
|
#define EN_A (1<<BLEN_A)
|
25
|
25
|
|
|
26
|
+#if defined(BTN_ENC) && BTN_ENC > -1
|
|
27
|
+ // encoder click is directly connected
|
|
28
|
+ #define BLEN_C 2
|
|
29
|
+ #define EN_C (1<<BLEN_C)
|
|
30
|
+#endif
|
|
31
|
+
|
26
|
32
|
//
|
27
|
33
|
// Setup other button mappings of each panel
|
28
|
34
|
//
|
29
|
35
|
#if defined(LCD_I2C_VIKI)
|
30
|
|
- #define BLEN_C 2 // == pause/stop/restart button connected to BTN_ENC pin (named for consistency with NEWPANEL code)
|
31
|
|
- #define EN_C (1<<BLEN_C)
|
32
|
|
-
|
33
|
|
- #define B_I2C_BTN_OFFSET (BLEN_C+1) // (the first three bit positions reserved for EN_A, EN_B, EN_C)
|
|
36
|
+ #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
|
34
|
37
|
|
35
|
38
|
// button and encoder bit positions within 'buttons'
|
36
|
|
- #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
|
37
|
39
|
#define B_LE (BUTTON_LEFT<<B_I2C_BTN_OFFSET) // The remaining normalized buttons are all read via I2C
|
38
|
40
|
#define B_UP (BUTTON_UP<<B_I2C_BTN_OFFSET)
|
39
|
41
|
#define B_MI (BUTTON_SELECT<<B_I2C_BTN_OFFSET)
|
40
|
42
|
#define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
|
41
|
43
|
#define B_RI (BUTTON_RIGHT<<B_I2C_BTN_OFFSET)
|
42
|
44
|
|
43
|
|
- #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
|
|
45
|
+ #if defined(BTN_ENC) && BTN_ENC > -1
|
|
46
|
+ // the pause/stop/restart button is connected to BTN_ENC when used
|
|
47
|
+ #define B_ST (EN_C) // Map the pause/stop/resume button into its normalized functional name
|
|
48
|
+ #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
|
|
49
|
+ #else
|
|
50
|
+ #define LCD_CLICKED (buttons&(B_MI|B_RI))
|
|
51
|
+ #endif
|
44
|
52
|
|
45
|
53
|
// I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
|
46
|
54
|
#define LCD_HAS_SLOW_BUTTONS
|
47
|
55
|
|
|
56
|
+#elif defined(LCD_I2C_PANELOLU2)
|
|
57
|
+ #if !defined(BTN_ENC) || BTN_ENC == -1
|
|
58
|
+ // encoder click is connected through I2C (rather than directly connected)
|
|
59
|
+ #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
|
|
60
|
+
|
|
61
|
+ #define B_MI (ENCODER_C<<B_I2C_BTN_OFFSET)
|
|
62
|
+
|
|
63
|
+ #define LCD_CLICKED (buttons&B_MI)
|
|
64
|
+
|
|
65
|
+ // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
|
|
66
|
+ #define LCD_HAS_SLOW_BUTTONS
|
|
67
|
+ #else
|
|
68
|
+ #define LCD_CLICKED (buttons&EN_C)
|
|
69
|
+ #endif
|
|
70
|
+
|
48
|
71
|
#elif defined(NEWPANEL)
|
49
|
|
- // Standard Newpanel has just a single button (all direclty connected)
|
50
|
|
- #define BLEN_C 2 // == select button
|
51
|
|
- #define EN_C (1<<BLEN_C)
|
52
|
72
|
#define LCD_CLICKED (buttons&EN_C)
|
53
|
73
|
|
54
|
74
|
#else // old style ULTIPANEL
|
|
@@ -88,7 +108,7 @@ extern volatile uint8_t buttons; //the last checked buttons in a bit array.
|
88
|
108
|
#define encrot2 3
|
89
|
109
|
#define encrot3 2
|
90
|
110
|
#endif
|
91
|
|
-#endif
|
|
111
|
+#endif
|
92
|
112
|
|
93
|
113
|
#endif //ULTIPANEL
|
94
|
114
|
|
|
@@ -629,7 +649,7 @@ static void lcd_implementation_drawmenu_sddirectory(uint8_t row, const char* pst
|
629
|
649
|
static void lcd_implementation_quick_feedback()
|
630
|
650
|
{
|
631
|
651
|
#ifdef LCD_USE_I2C_BUZZER
|
632
|
|
- lcd.buzz(300,4000);
|
|
652
|
+ lcd.buzz(60,1000/6);
|
633
|
653
|
#elif defined(BEEPER) && BEEPER > -1
|
634
|
654
|
SET_OUTPUT(BEEPER);
|
635
|
655
|
for(int8_t i=0;i<10;i++)
|