Browse Source

Attempt to address Bernhard's comments

Refactor configuration to try to make items clearer (what defines a
panel vs what is user changeable).
Robert F-C 11 years ago
parent
commit
6beb42cdf6
4 changed files with 134 additions and 142 deletions
  1. 11
    16
      Marlin/Configuration.h
  2. 7
    14
      Marlin/Marlin.pde
  3. 10
    4
      Marlin/ultralcd.cpp
  4. 106
    108
      Marlin/ultralcd_implementation_hitachi_HD44780.h

+ 11
- 16
Marlin/Configuration.h View File

336
  #define NEWPANEL
336
  #define NEWPANEL
337
 #endif 
337
 #endif 
338
 
338
 
339
-// I2C PANELS
339
+//I2C PANELS
340
 
340
 
341
 //#define LCD_I2C_SAINSMART_YWROBOT
341
 //#define LCD_I2C_SAINSMART_YWROBOT
342
 #ifdef LCD_I2C_SAINSMART_YWROBOT
342
 #ifdef LCD_I2C_SAINSMART_YWROBOT
343
   // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
343
   // This uses the LiquidCrystal_I2C library ( https://bitbucket.org/fmalpartida/new-liquidcrystal/wiki/Home )
344
   // Make sure it is placed in the Arduino libraries directory.
344
   // Make sure it is placed in the Arduino libraries directory.
345
   #define LCD_I2C_TYPE_PCF8575
345
   #define LCD_I2C_TYPE_PCF8575
346
-  #define LCD_I2C
347
-  #define ULTIPANEL
348
-  #define NEWPANEL
349
   #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
346
   #define LCD_I2C_ADDRESS 0x27   // I2C Address of the port expander
347
+  #define NEWPANEL
348
+  #define ULTIPANEL 
350
 #endif
349
 #endif
351
 
350
 
352
-// PANELOLU2 LCD with status LEDs, separate encoder and click inputs
351
+//PANELOLU2 LCD with status LEDs, separate encoder and click inputs
353
 //#define LCD_I2C_PANELOLU2
352
 //#define LCD_I2C_PANELOLU2
354
 #ifdef LCD_I2C_PANELOLU2
353
 #ifdef LCD_I2C_PANELOLU2
355
   // This uses the LiquidTWI2 library ( https://github.com/lincomatic/LiquidTWI2 ).
354
   // This uses the LiquidTWI2 library ( https://github.com/lincomatic/LiquidTWI2 ).
356
   // Make sure it is placed in the Arduino libraries directory.
355
   // Make sure it is placed in the Arduino libraries directory.
357
   #define LCD_I2C_TYPE_MCP23017
356
   #define LCD_I2C_TYPE_MCP23017
358
-  #define LCD_I2C
359
-  #define ULTIPANEL
357
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
358
+  #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD
360
   #define NEWPANEL
359
   #define NEWPANEL
361
-  #define LCD_I2C_ADDRESS 0x20
362
-  #define LCD_HAS_I2C_BUZZ //comment out to disable buzzer on LCD
363
-  #define LCD_HAS_STATUS_INDICATORS  
360
+  #define ULTIPANEL 
364
 #endif
361
 #endif
365
 
362
 
366
-// VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
363
+//VIKI LCD with status LEDs, integrated click & L/R/U/P buttons, separate encoder inputs
367
 //#define LCD_I2C_VIKI
364
 //#define LCD_I2C_VIKI
368
 #ifdef LCD_I2C_VIKI
365
 #ifdef LCD_I2C_VIKI
369
   // This uses the LiquidTWI2 library (https://github.com/lincomatic/LiquidTWI2).
366
   // This uses the LiquidTWI2 library (https://github.com/lincomatic/LiquidTWI2).
370
   // Make sure it is placed in the Arduino libraries directory.
367
   // Make sure it is placed in the Arduino libraries directory.
371
-  #define LCD_I2C_TYPE_MCP23017
372
-  #define LCD_I2C
373
-  #define ULTIPANEL
368
+  #define LCD_I2C_TYPE_MCP23017 
369
+  #define LCD_I2C_ADDRESS 0x20 // I2C Address of the port expander
374
   #define NEWPANEL
370
   #define NEWPANEL
375
-  #define LCD_I2C_ADDRESS 0x20
376
-  #define LCD_HAS_STATUS_INDICATORS  
371
+  #define ULTIPANEL 
377
 #endif
372
 #endif
378
 
373
 
379
 #ifdef ULTIPANEL
374
 #ifdef ULTIPANEL

+ 7
- 14
Marlin/Marlin.pde View File

34
 #include "pins.h"
34
 #include "pins.h"
35
 
35
 
36
 #ifdef ULTRA_LCD
36
 #ifdef ULTRA_LCD
37
-  #ifdef LCD_I2C
37
+  #if defined(LCD_I2C_TYPE_PCF8575)
38
     #include <Wire.h>
38
     #include <Wire.h>
39
-    #if defined(LCD_I2C_TYPE_PCF8575)
40
-      #include <LiquidCrystal_I2C.h>
41
-    #elif defined(LCD_I2C_TYPE_MCP23017)
42
-      #ifdef LCD_I2C_PANELOLU2
43
-        #include <LiquidTWI2.h>
44
-        #ifndef PANELOLU2
45
-          #error You must uncomment #define PANELOLU2 in LiquidTWI2.h for LiquidTWI2.cpp to compile correctly
46
-        #endif
47
-      #else
48
-        #include <LiquidTWI2.h>
49
-      #endif
50
-    #else
51
-      #error Unknown I2C LCD type    
39
+    #include <LiquidCrystal_I2C.h>
40
+  #elif defined(LCD_I2C_TYPE_MCP23017) || defined(LCD_I2C_TYPE_MCP23008)
41
+    #include <Wire.h>
42
+    #include <LiquidTWI2.h>
43
+    #if defined(LCD_I2C_PANELOLU2) && !defined(PANELOLU2)
44
+      #error You must uncomment "#define PANELOLU2" in LiquidTWI2.h for LiquidTWI2.cpp to compile correctly
52
     #endif
45
     #endif
53
   #else
46
   #else
54
     #include <LiquidCrystal.h>
47
     #include <LiquidCrystal.h>

+ 10
- 4
Marlin/ultralcd.cpp View File

705
     lcd_oldcardstatus = IS_SD_INSERTED;
705
     lcd_oldcardstatus = IS_SD_INSERTED;
706
 #endif//(SDCARDDETECT > -1)
706
 #endif//(SDCARDDETECT > -1)
707
     lcd_buttons_update();
707
     lcd_buttons_update();
708
+#ifdef ULTIPANEL    
708
     encoderDiff = 0;
709
     encoderDiff = 0;
710
+#endif    
709
 }
711
 }
710
 
712
 
711
 void lcd_update()
713
 void lcd_update()
714
     
716
     
715
     lcd_buttons_update();
717
     lcd_buttons_update();
716
     
718
     
717
-    #ifdef LCD_HAS_EXTRA_BUTTONS
718
-    buttons |= lcd_read_extra_buttons(); // buttons which take too long to read in interrupt context
719
+    #ifdef LCD_HAS_SLOW_BUTTONS
720
+    buttons |= lcd_implementation_read_slow_buttons(); // buttons which take too long to read in interrupt context
719
     #endif
721
     #endif
720
     
722
     
721
     #if (SDCARDDETECT > -1)
723
     #if (SDCARDDETECT > -1)
751
         if (LCD_CLICKED)
753
         if (LCD_CLICKED)
752
             timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
754
             timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
753
 #endif//ULTIPANEL
755
 #endif//ULTIPANEL
754
-        
755
         (*currentMenu)();
756
         (*currentMenu)();
757
+
758
+#ifdef LCD_HAS_STATUS_INDICATORS
759
+        lcd_implementation_update_indicators();
760
+#endif        
761
+        
756
 #ifdef ULTIPANEL
762
 #ifdef ULTIPANEL
757
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
763
         if(timeoutToStatus < millis() && currentMenu != lcd_status_screen)
758
         {
764
         {
860
     }
866
     }
861
     lastEncoderBits = enc;
867
     lastEncoderBits = enc;
862
 }
868
 }
863
-#endif//ULTIPANEL
864
 
869
 
865
 bool lcd_clicked() 
870
 bool lcd_clicked() 
866
 { 
871
 { 
867
   return LCD_CLICKED;
872
   return LCD_CLICKED;
868
 }
873
 }
874
+#endif//ULTIPANEL
869
 
875
 
870
 /********************************/
876
 /********************************/
871
 /** Float conversion utilities **/
877
 /** Float conversion utilities **/

+ 106
- 108
Marlin/ultralcd_implementation_hitachi_HD44780.h View File

6
 * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
6
 * When selecting the rusian language, a slightly different LCD implementation is used to handle UTF8 characters.
7
 **/
7
 **/
8
 
8
 
9
-// Declare LCD class to use
10
-#if defined(LCD_I2C_TYPE_PCF8575)
11
-  // note: these are virtual pins on the PCF8575 controller not Arduino pins
12
-  #define LCD_I2C_PIN_BL  3
13
-  #define LCD_I2C_PIN_EN  2
14
-  #define LCD_I2C_PIN_RW  1
15
-  #define LCD_I2C_PIN_RS  0
16
-  #define LCD_I2C_PIN_D4  4
17
-  #define LCD_I2C_PIN_D5  5
18
-  #define LCD_I2C_PIN_D6  6
19
-  #define LCD_I2C_PIN_D7  7
20
-
21
-  #include <Wire.h>
22
-  #include <LCD.h>
23
-  #include <LiquidCrystal_I2C.h>
24
-  #define LCD_CLASS LiquidCrystal_I2C
25
-  LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
26
-#elif defined(LCD_I2C_TYPE_MCP23017)
27
-  //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
28
-  #define LED_A 0x04 //100
29
-  #define LED_B 0x02 //010
30
-  #define LED_C 0x01  //001
31
-
32
-  #include <Wire.h>
33
-  #include <LiquidTWI2.h>
34
-  #define LCD_CLASS LiquidTWI2
35
-  LCD_CLASS lcd(LCD_I2C_ADDRESS);  //An alternative I2C master address can be used in place of "0"
36
-#elif defined(LCD_I2C_TYPE_MCP23008)
37
-  #include <Wire.h>
38
-  #include <LiquidTWI2.h>
39
-  #define LCD_CLASS LiquidTWI2
40
-  LCD_CLASS lcd(LCD_I2C_ADDRESS);  //An alternative I2C master address can be used in place of "0"
41
-#else
42
-  #if LANGUAGE_CHOICE == 6
43
-    #include "LiquidCrystalRus.h"
44
-    #define LCD_CLASS LiquidCrystalRus
45
-  #else 
46
-    #include <LiquidCrystal.h>
47
-    #define LCD_CLASS LiquidCrystal
48
-  #endif  
49
-  LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
50
-#endif
51
-
52
 extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
9
 extern volatile uint8_t buttons;  //the last checked buttons in a bit array.
53
 
10
 
54
-// provide default button bitmask and encoder definitions (note this is not pin or motherboard specific)
55
-#ifdef LCD_I2C_VIKI
56
-  //encoder rotation values
57
-  #define encrot0 0
58
-  #define encrot1 2
59
-  #define encrot2 3
60
-  #define encrot3 1
61
-
62
-  #define BLEN_C 2
63
-  #define BLEN_B 1
64
-  #define BLEN_A 0
65
-
66
-  #define EN_C (1<<BLEN_C) // The stop/pause/resume button comes through BTN_ENC pin (for consistency with NEWPANEL code)
67
-  #define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
68
-  #define EN_A (1<<BLEN_A)
69
-
70
-  #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
11
+////////////////////////////////////
12
+// Setup button and encode mappings for each panel (into 'buttons' variable)
13
+//
14
+// This is just to map common functions (across different panels) onto the same 
15
+// macro name. The mapping is independent of whether the button is directly connected or 
16
+// via a shift/i2c register.
17
+
18
+#ifdef ULTIPANEL
19
+// All Ultipanels might have an encoder - so this is always be mapped onto first two bits
20
+#define BLEN_B 1
21
+#define BLEN_A 0
22
+
23
+#define EN_B (1<<BLEN_B) // The two encoder pins are connected through BTN_EN1 and BTN_EN2
24
+#define EN_A (1<<BLEN_A)
25
+
26
+//
27
+// Setup other button mappings of each panel
28
+//
29
+#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)
71
   
34
   
72
   // button and encoder bit positions within 'buttons'
35
   // button and encoder bit positions within 'buttons'
73
-  #define B_ST (EN_C)                             // The pause/stop/resume button is mapped to EN_C for consistency with NEWPANEL 
74
-  #define B_LE (BUTTON_LEFT<<B_I2C_BTN_OFFSET)    // The remaining buttons are I2C read buttons.
36
+  #define B_ST (EN_C)                             // Map the pause/stop/resume button into its normalized functional name 
37
+  #define B_LE (BUTTON_LEFT<<B_I2C_BTN_OFFSET)    // The remaining normalized buttons are all read via I2C
75
   #define B_UP (BUTTON_UP<<B_I2C_BTN_OFFSET)
38
   #define B_UP (BUTTON_UP<<B_I2C_BTN_OFFSET)
76
   #define B_MI (BUTTON_SELECT<<B_I2C_BTN_OFFSET)
39
   #define B_MI (BUTTON_SELECT<<B_I2C_BTN_OFFSET)
77
   #define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
40
   #define B_DW (BUTTON_DOWN<<B_I2C_BTN_OFFSET)
79
 
42
 
80
   #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
43
   #define LCD_CLICKED (buttons&(B_MI|B_RI|B_ST)) // pause/stop button also acts as click until we implement proper pause/stop.
81
 
44
 
82
-  // I2C buttons are likely to take too long to read inside interrupt context and so we read them during lcd_update
83
-  #define LCD_HAS_EXTRA_BUTTONS
84
-  
85
-#elif defined(NEWPANEL)
86
-  //from the same bit in the RAMPS Newpanel define
87
-  //encoder rotation values
88
-  #define encrot0 0
89
-  #define encrot1 2
90
-  #define encrot2 3
91
-  #define encrot3 1
92
- 
93
-  #define BLEN_C 2
94
-  #define BLEN_B 1
95
-  #define BLEN_A 0
45
+  // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
46
+  #define LCD_HAS_SLOW_BUTTONS
96
 
47
 
48
+#elif defined(NEWPANEL)
49
+  // Standard Newpanel has just a single button (all direclty connected)
50
+  #define BLEN_C 2 // == select button
97
   #define EN_C (1<<BLEN_C)
51
   #define EN_C (1<<BLEN_C)
98
-  #define EN_B (1<<BLEN_B)
99
-  #define EN_A (1<<BLEN_A)
100
-
101
   #define LCD_CLICKED (buttons&EN_C)
52
   #define LCD_CLICKED (buttons&EN_C)
102
   
53
   
103
 #else // old style ULTIPANEL
54
 #else // old style ULTIPANEL
104
-  //encoder rotation values
105
-  #ifndef ULTIMAKERCONTROLLER
106
-    #define encrot0 0
107
-    #define encrot1 2
108
-    #define encrot2 3
109
-    #define encrot3 1
110
-  #else
111
-    #define encrot0 0
112
-    #define encrot1 1
113
-    #define encrot2 3
114
-    #define encrot3 2
115
-  #endif
116
-
117
   //bits in the shift register that carry the buttons for:
55
   //bits in the shift register that carry the buttons for:
118
   // left up center down right red(stop)
56
   // left up center down right red(stop)
119
   #define BL_LE 7
57
   #define BL_LE 7
123
   #define BL_RI 3
61
   #define BL_RI 3
124
   #define BL_ST 2
62
   #define BL_ST 2
125
 
63
 
126
-  #define BLEN_B 1
127
-  #define BLEN_A 0
128
-
129
   //automatic, do not change
64
   //automatic, do not change
130
   #define B_LE (1<<BL_LE)
65
   #define B_LE (1<<BL_LE)
131
   #define B_UP (1<<BL_UP)
66
   #define B_UP (1<<BL_UP)
133
   #define B_DW (1<<BL_DW)
68
   #define B_DW (1<<BL_DW)
134
   #define B_RI (1<<BL_RI)
69
   #define B_RI (1<<BL_RI)
135
   #define B_ST (1<<BL_ST)
70
   #define B_ST (1<<BL_ST)
136
-  #define EN_B (1<<BLEN_B)
137
-  #define EN_A (1<<BLEN_A)
138
   
71
   
139
   #define LCD_CLICKED (buttons&(B_MI|B_ST))
72
   #define LCD_CLICKED (buttons&(B_MI|B_ST))
140
 #endif//else NEWPANEL
73
 #endif//else NEWPANEL
141
 
74
 
142
-#ifdef LCD_HAS_STATUS_INDICATORS  
143
-//forward declaration
144
-static void lcd_implementation_update_indicators();
75
+////////////////////////
76
+// Setup Rotary Encoder Bit Values (for two pin encoders to indicate movement)
77
+// These values are independent of which pins are used for EN_A and EN_B indications
78
+// The rotary encoder part is also independent to the chipset used for the LCD
79
+#if defined(EN_A) && defined(EN_B)
80
+  #ifndef ULTIMAKERCONTROLLER
81
+    #define encrot0 0
82
+    #define encrot1 2
83
+    #define encrot2 3
84
+    #define encrot3 1
85
+  #else
86
+    #define encrot0 0
87
+    #define encrot1 1
88
+    #define encrot2 3
89
+    #define encrot3 2
90
+  #endif
91
+#endif
92
+
93
+#endif //ULTIPANEL
94
+
95
+////////////////////////////////////
96
+// Create LCD class instance and chipset-specific information
97
+#if defined(LCD_I2C_TYPE_PCF8575)
98
+  // note: these are register mapped pins on the PCF8575 controller not Arduino pins
99
+  #define LCD_I2C_PIN_BL  3
100
+  #define LCD_I2C_PIN_EN  2
101
+  #define LCD_I2C_PIN_RW  1
102
+  #define LCD_I2C_PIN_RS  0
103
+  #define LCD_I2C_PIN_D4  4
104
+  #define LCD_I2C_PIN_D5  5
105
+  #define LCD_I2C_PIN_D6  6
106
+  #define LCD_I2C_PIN_D7  7
107
+
108
+  #include <Wire.h>
109
+  #include <LCD.h>
110
+  #include <LiquidCrystal_I2C.h>
111
+  #define LCD_CLASS LiquidCrystal_I2C
112
+  LCD_CLASS lcd(LCD_I2C_ADDRESS,LCD_I2C_PIN_EN,LCD_I2C_PIN_RW,LCD_I2C_PIN_RS,LCD_I2C_PIN_D4,LCD_I2C_PIN_D5,LCD_I2C_PIN_D6,LCD_I2C_PIN_D7);
113
+  
114
+#elif defined(LCD_I2C_TYPE_MCP23017)
115
+  //for the LED indicators (which maybe mapped to different things in lcd_implementation_update_indicators())
116
+  #define LED_A 0x04 //100
117
+  #define LED_B 0x02 //010
118
+  #define LED_C 0x01 //001
119
+
120
+  #define LCD_HAS_STATUS_INDICATORS
121
+
122
+  #include <Wire.h>
123
+  #include <LiquidTWI2.h>
124
+  #define LCD_CLASS LiquidTWI2
125
+  LCD_CLASS lcd(LCD_I2C_ADDRESS);
126
+  
127
+#elif defined(LCD_I2C_TYPE_MCP23008)
128
+  #include <Wire.h>
129
+  #include <LiquidTWI2.h>
130
+  #define LCD_CLASS LiquidTWI2
131
+  LCD_CLASS lcd(LCD_I2C_ADDRESS);  
132
+  
133
+#else
134
+  // Standard directly connected LCD implementations
135
+  #if LANGUAGE_CHOICE == 6
136
+    #include "LiquidCrystalRus.h"
137
+    #define LCD_CLASS LiquidCrystalRus
138
+  #else 
139
+    #include <LiquidCrystal.h>
140
+    #define LCD_CLASS LiquidCrystal
141
+  #endif  
142
+  LCD_CLASS lcd(LCD_PINS_RS, LCD_PINS_ENABLE, LCD_PINS_D4, LCD_PINS_D5,LCD_PINS_D6,LCD_PINS_D7);  //RS,Enable,D4,D5,D6,D7
145
 #endif
143
 #endif
146
 
144
 
147
 /* Custom characters defined in the first 8 characters of the LCD */
145
 /* Custom characters defined in the first 8 characters of the LCD */
247
     lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
245
     lcd.setBacklightPin(LCD_I2C_PIN_BL,POSITIVE);
248
     lcd.setBacklight(HIGH);
246
     lcd.setBacklight(HIGH);
249
   #endif
247
   #endif
248
+  
250
 #elif defined(LCD_I2C_TYPE_MCP23017)
249
 #elif defined(LCD_I2C_TYPE_MCP23017)
251
   	lcd.setMCPType(LTI_TYPE_MCP23017);
250
   	lcd.setMCPType(LTI_TYPE_MCP23017);
252
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
251
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
253
     lcd.setBacklight(0); //set all the LEDs off to begin with
252
     lcd.setBacklight(0); //set all the LEDs off to begin with
253
+    
254
 #elif defined(LCD_I2C_TYPE_MCP23008)
254
 #elif defined(LCD_I2C_TYPE_MCP23008)
255
   	lcd.setMCPType(LTI_TYPE_MCP23008);
255
   	lcd.setMCPType(LTI_TYPE_MCP23008);
256
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
256
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
257
+    
257
 #else
258
 #else
258
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
259
     lcd.begin(LCD_WIDTH, LCD_HEIGHT);
259
 #endif
260
 #endif
439
     //Status message line on the last line
440
     //Status message line on the last line
440
     lcd.setCursor(0, LCD_HEIGHT - 1);
441
     lcd.setCursor(0, LCD_HEIGHT - 1);
441
     lcd.print(lcd_status_message);
442
     lcd.print(lcd_status_message);
442
-#ifdef LCD_HAS_STATUS_INDICATORS
443
-    lcd_implementation_update_indicators();
444
-#endif    
445
 }
443
 }
446
 static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
444
 static void lcd_implementation_drawmenu_generic(uint8_t row, const char* pstr, char pre_char, char post_char)
447
 {
445
 {
630
 
628
 
631
 static void lcd_implementation_quick_feedback()
629
 static void lcd_implementation_quick_feedback()
632
 {
630
 {
633
-#ifdef LCD_HAS_I2C_BUZZ
631
+#ifdef LCD_USE_I2C_BUZZER
634
     lcd.buzz(300,4000);
632
     lcd.buzz(300,4000);
635
 #elif defined(BEEPER) && BEEPER > -1
633
 #elif defined(BEEPER) && BEEPER > -1
636
     SET_OUTPUT(BEEPER);
634
     SET_OUTPUT(BEEPER);
665
 }
663
 }
666
 #endif
664
 #endif
667
 
665
 
668
-#ifdef LCD_HAS_EXTRA_BUTTONS
669
-static uint8_t lcd_read_extra_buttons()
666
+#ifdef LCD_HAS_SLOW_BUTTONS
667
+static uint8_t lcd_implementation_read_slow_buttons()
670
 {
668
 {
671
   #ifdef LCD_I2C_TYPE_MCP23017
669
   #ifdef LCD_I2C_TYPE_MCP23017
672
-    // the I2C button bit positions are shifted by three bits from the native LiquidTWI2 position
673
-    // this is potentially too slow to call inside interrupt context
670
+    // Reading these buttons this is likely to be too slow to call inside interrupt context
671
+    // so they are called during normal lcd_update
674
     return lcd.readButtons() << B_I2C_BTN_OFFSET; 
672
     return lcd.readButtons() << B_I2C_BTN_OFFSET; 
675
   #endif
673
   #endif
676
 }
674
 }

Loading…
Cancel
Save