Browse Source

Merge pull request #4445 from thinkyhead/rc_fix_rdfgsc_mega3

Fix for R.D.F.G.S.C. with MEGATRONICS 3 board
Scott Lahteine 8 years ago
parent
commit
ae1c7bca1b

+ 1
- 1
Marlin/pins_3DRAG.h View File

86
   #undef BTN_ENC
86
   #undef BTN_ENC
87
   #define BTN_EN1 16
87
   #define BTN_EN1 16
88
   #define BTN_EN2 17
88
   #define BTN_EN2 17
89
-  #define BTN_ENC 23 //the click
89
+  #define BTN_ENC 23
90
 
90
 
91
 #else
91
 #else
92
 
92
 

+ 0
- 4
Marlin/pins_CHEAPTRONIC.h View File

84
 #define BTN_EN2 -1
84
 #define BTN_EN2 -1
85
 #define BTN_ENC -1
85
 #define BTN_ENC -1
86
 
86
 
87
-#define BLEN_C 2
88
-#define BLEN_B 1
89
-#define BLEN_A 0
90
-
91
 // Cheaptronic v1.0 doesn't use this
87
 // Cheaptronic v1.0 doesn't use this

+ 1
- 5
Marlin/pins_ELEFU_3.h View File

87
 
87
 
88
   #define BTN_EN1          14
88
   #define BTN_EN1          14
89
   #define BTN_EN2          39
89
   #define BTN_EN2          39
90
-  #define BTN_ENC          15  //the click
91
-
92
-  #define BLEN_C            2
93
-  #define BLEN_B            1
94
-  #define BLEN_A            0
90
+  #define BTN_ENC          15
95
 
91
 
96
 #endif // RA_CONTROL_PANEL
92
 #endif // RA_CONTROL_PANEL
97
 
93
 

+ 0
- 3
Marlin/pins_FELIX2.h View File

38
 
38
 
39
 #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
39
 #if ENABLED(ULTRA_LCD) && ENABLED(NEWPANEL)
40
 
40
 
41
-  #define BLEN_C 2
42
-  #define BLEN_B 1
43
-  #define BLEN_A 0
44
   #define SD_DETECT_PIN 6
41
   #define SD_DETECT_PIN 6
45
 
42
 
46
 #endif // NEWPANEL && ULTRA_LCD
43
 #endif // NEWPANEL && ULTRA_LCD

+ 1
- 1
Marlin/pins_GEN7_CUSTOM.h View File

86
 //buttons are directly attached
86
 //buttons are directly attached
87
 #define BTN_EN1 11
87
 #define BTN_EN1 11
88
 #define BTN_EN2 10
88
 #define BTN_EN2 10
89
-#define BTN_ENC 12  //the click
89
+#define BTN_ENC 12
90
 
90
 

+ 4
- 4
Marlin/pins_MEGACONTROLLER.h View File

113
   //#define LCD_SCREEN_ROT_90
113
   //#define LCD_SCREEN_ROT_90
114
   //#define LCD_SCREEN_ROT_180
114
   //#define LCD_SCREEN_ROT_180
115
   //#define LCD_SCREEN_ROT_270
115
   //#define LCD_SCREEN_ROT_270
116
-  //The encoder and click button
116
+
117
   #define BTN_EN1 48
117
   #define BTN_EN1 48
118
   #define BTN_EN2 11
118
   #define BTN_EN2 11
119
-  #define BTN_ENC 10  //the click switch
120
-  //not connected to a pin
119
+  #define BTN_ENC 10
120
+
121
   #define SD_DETECT_PIN 49
121
   #define SD_DETECT_PIN 49
122
-#endif //Minipanel
122
+#endif // MINIPANEL
123
 
123
 

+ 0
- 4
Marlin/pins_MEGATRONICS.h View File

92
   #define BTN_EN2         64
92
   #define BTN_EN2         64
93
   #define BTN_ENC         43
93
   #define BTN_ENC         43
94
 
94
 
95
-  #define BLEN_C           2
96
-  #define BLEN_B           1
97
-  #define BLEN_A           0
98
-
99
   #define SD_DETECT_PIN   -1   // RAMPS doesn't use this
95
   #define SD_DETECT_PIN   -1   // RAMPS doesn't use this
100
 
96
 
101
 #endif // ULTRA_LCD && NEWPANEL
97
 #endif // ULTRA_LCD && NEWPANEL

+ 1
- 6
Marlin/pins_MEGATRONICS_2.h View File

101
 // Buttons are directly attached using keypad
101
 // Buttons are directly attached using keypad
102
 #define BTN_EN1 61
102
 #define BTN_EN1 61
103
 #define BTN_EN2 59
103
 #define BTN_EN2 59
104
-#define BTN_ENC 43 //the click
105
-
106
-#define BLEN_C 2
107
-#define BLEN_B 1
108
-#define BLEN_A 0
109
-
104
+#define BTN_ENC 43

+ 41
- 37
Marlin/pins_MEGATRONICS_3.h View File

28
   #error "Oops!  Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."
28
   #error "Oops!  Make sure you have 'Arduino Mega' selected from the 'Tools -> Boards' menu."
29
 #endif
29
 #endif
30
 
30
 
31
-#define BOARD_NAME         "Megatronics v3.0"
31
+#define MEGATRONICS_31
32
+
33
+#if ENABLED(MEGATRONICS_31)
34
+  #define BOARD_NAME       "Megatronics v3.1"
35
+#else
36
+  #define BOARD_NAME       "Megatronics v3.0"
37
+#endif
38
+
32
 #define LARGE_FLASH        true
39
 #define LARGE_FLASH        true
33
 
40
 
34
 #if ENABLED(Z_PROBE_SLED)
41
 #if ENABLED(Z_PROBE_SLED)
36
 #endif
43
 #endif
37
 
44
 
38
 // Servo support
45
 // Servo support
39
-#define SERVO0_PIN         46 //AUX3-6
40
-#define SERVO1_PIN         47 //AUX3-5
41
-#define SERVO2_PIN         48 //AUX3-4
42
-#define SERVO3_PIN         49 //AUX3-3
46
+#define SERVO0_PIN         46 // AUX3-6
47
+#define SERVO1_PIN         47 // AUX3-5
48
+#define SERVO2_PIN         48 // AUX3-4
49
+#define SERVO3_PIN         49 // AUX3-3
43
 
50
 
44
 #define X_STEP_PIN         58
51
 #define X_STEP_PIN         58
45
 #define X_DIR_PIN          57
52
 #define X_DIR_PIN          57
46
 #define X_ENABLE_PIN       59
53
 #define X_ENABLE_PIN       59
47
 #define X_MIN_PIN          37
54
 #define X_MIN_PIN          37
48
-#define X_MAX_PIN          40 // put to -1 to disable
55
+#define X_MAX_PIN          40
49
 
56
 
50
 #define Y_STEP_PIN         5
57
 #define Y_STEP_PIN         5
51
 #define Y_DIR_PIN          17
58
 #define Y_DIR_PIN          17
52
 #define Y_ENABLE_PIN       4
59
 #define Y_ENABLE_PIN       4
53
 #define Y_MIN_PIN          41
60
 #define Y_MIN_PIN          41
54
-#define Y_MAX_PIN          38 // put to -1 to disable
61
+#define Y_MAX_PIN          38
55
 
62
 
56
 #define Z_STEP_PIN         16
63
 #define Z_STEP_PIN         16
57
 #define Z_DIR_PIN          11
64
 #define Z_DIR_PIN          11
58
 #define Z_ENABLE_PIN       3
65
 #define Z_ENABLE_PIN       3
59
 #define Z_MIN_PIN          18
66
 #define Z_MIN_PIN          18
60
-#define Z_MAX_PIN          19 // put to -1 to disable
67
+#define Z_MAX_PIN          19
61
 
68
 
62
 #define E0_STEP_PIN        28
69
 #define E0_STEP_PIN        28
63
 #define E0_DIR_PIN         27
70
 #define E0_DIR_PIN         27
104
   #define TEMP_BED_PIN 14 // ANALOG NUMBERING
111
   #define TEMP_BED_PIN 14 // ANALOG NUMBERING
105
 #endif
112
 #endif
106
 
113
 
114
+/**
115
+ * Controllers and LCDs
116
+ */
107
 #define BEEPER_PIN 61
117
 #define BEEPER_PIN 61
108
 
118
 
109
-#if ENABLED(DOGLCD)
110
-
111
-  #if ENABLED(U8GLIB_ST7920)
112
-    #define LCD_PINS_RS     56 //CS chip select /SS chip slave select
113
-    #define LCD_PINS_ENABLE 51 //SID (MOSI)
114
-    #define LCD_PINS_D4     52 //SCK (CLK) clock
115
-    #define SD_DETECT_PIN 35
116
-  #endif
119
+#define BTN_EN1 44
120
+#define BTN_EN2 45
121
+#define BTN_ENC 33
117
 
122
 
123
+#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
124
+  #define LCD_PINS_RS     56 // CS chip select / SS chip slave select
125
+  #define LCD_PINS_ENABLE 51 // SID (MOSI)
126
+  #define LCD_PINS_D4     52 // SCK (CLK) clock
127
+  #define SD_DETECT_PIN   35
118
 #else
128
 #else
119
-
120
-  #define LCD_PINS_RS 32
129
+  #define LCD_PINS_RS     32
121
   #define LCD_PINS_ENABLE 31
130
   #define LCD_PINS_ENABLE 31
122
-  #define LCD_PINS_D4 14
123
-  #define LCD_PINS_D5 30
124
-  #define LCD_PINS_D6 39
125
-  #define LCD_PINS_D7 15
131
+  #define LCD_PINS_D4     14
132
+  #define LCD_PINS_D5     30
133
+  #define LCD_PINS_D6     39
134
+  #define LCD_PINS_D7     15
126
   
135
   
127
-  #define SHIFT_CLK 43
128
-  #define SHIFT_LD 35
129
-  #define SHIFT_OUT 34
130
-  #define SHIFT_EN 44
131
-
132
-  #define SD_DETECT_PIN 56 // Megatronics v3.1 only
136
+  #define SHIFT_CLK       43
137
+  #define SHIFT_LD        35
138
+  #define SHIFT_OUT       34
139
+  #define SHIFT_EN        44
140
+
141
+  #if ENABLED(MEGATRONICS_31)
142
+    #define SD_DETECT_PIN 56
143
+  #else
144
+    #define SD_DETECT_PIN -1
145
+  #endif
133
 
146
 
134
 #endif
147
 #endif
135
-
136
-// Buttons are directly attached using keypad
137
-#define BTN_EN1 44
138
-#define BTN_EN2 45
139
-#define BTN_ENC 33
140
-
141
-#define BLEN_C 2
142
-#define BLEN_B 1
143
-#define BLEN_A 0

+ 19
- 23
Marlin/pins_MINITRONICS.h View File

74
 #define HEATER_1_PIN   8 // EXTRUDER 2
74
 #define HEATER_1_PIN   8 // EXTRUDER 2
75
 #define HEATER_BED_PIN 3 // BED
75
 #define HEATER_BED_PIN 3 // BED
76
 
76
 
77
+/**
78
+ * Controllers and LCDs
79
+ */
77
 #define BEEPER_PIN -1
80
 #define BEEPER_PIN -1
78
 
81
 
79
-#if ENABLED(DOGLCD)
82
+#if ENABLED(REPRAPWORLD_GRAPHICAL_LCD)
80
 
83
 
81
-  #if ENABLED(U8GLIB_ST7920)
82
-    #define LCD_PINS_RS     15 //CS chip select /SS chip slave select
83
-    #define LCD_PINS_ENABLE 11 //SID (MOSI)
84
-    #define LCD_PINS_D4     10 //SCK (CLK) clock     
84
+  #define LCD_PINS_RS     15 // CS chip select /SS chip slave select
85
+  #define LCD_PINS_ENABLE 11 // SID (MOSI)
86
+  #define LCD_PINS_D4     10 // SCK (CLK) clock
85
 
87
 
86
-    #define BTN_EN1 18
87
-    #define BTN_EN2 17
88
-    #define BTN_ENC 25
88
+  #define BTN_EN1         18
89
+  #define BTN_EN2         17
90
+  #define BTN_ENC         25
89
 
91
 
90
-    #define SD_DETECT_PIN 30
91
-  #endif
92
+  #define SD_DETECT_PIN   30
92
 
93
 
93
 #else
94
 #else
94
 
95
 
95
-  #define LCD_PINS_RS -1
96
+  #define LCD_PINS_RS     -1
96
   #define LCD_PINS_ENABLE -1
97
   #define LCD_PINS_ENABLE -1
97
-  #define LCD_PINS_D4 -1
98
-  #define LCD_PINS_D5 -1
99
-  #define LCD_PINS_D6 -1
100
-  #define LCD_PINS_D7 -1
98
+  #define LCD_PINS_D4     -1
99
+  #define LCD_PINS_D5     -1
100
+  #define LCD_PINS_D6     -1
101
+  #define LCD_PINS_D7     -1
101
 
102
 
102
   // Buttons are directly attached using keypad
103
   // Buttons are directly attached using keypad
103
-  #define BTN_EN1 -1
104
-  #define BTN_EN2 -1
105
-  #define BTN_ENC -1
106
-
107
-  #define BLEN_C 2
108
-  #define BLEN_B 1
109
-  #define BLEN_A 0
104
+  #define BTN_EN1         -1
105
+  #define BTN_EN2         -1
106
+  #define BTN_ENC         -1
110
 
107
 
111
   #define SD_DETECT_PIN -1  // Minitronics doesn't use this
108
   #define SD_DETECT_PIN -1  // Minitronics doesn't use this
112
-
113
 #endif
109
 #endif

+ 1
- 1
Marlin/pins_PRINTRBOARD.h View File

132
   //The encoder and click button (FastIO Pins)
132
   //The encoder and click button (FastIO Pins)
133
   #define BTN_EN1 26
133
   #define BTN_EN1 26
134
   #define BTN_EN2 27
134
   #define BTN_EN2 27
135
-  #define BTN_ENC 47  //the click switch
135
+  #define BTN_ENC 47
136
 
136
 
137
   #define SDSS 45
137
   #define SDSS 45
138
   #define SD_DETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test)
138
   #define SD_DETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test)

+ 1
- 5
Marlin/pins_PRINTRBOARD_REVF.h View File

113
   #define BTN_EN2   17
113
   #define BTN_EN2   17
114
   #define BTN_ENC   18//the click
114
   #define BTN_ENC   18//the click
115
 
115
 
116
-  #define BLEN_C 2
117
-  #define BLEN_B 1
118
-  #define BLEN_A 0
119
-
120
   #define SD_DETECT_PIN -1
116
   #define SD_DETECT_PIN -1
121
 
117
 
122
   //encoder rotation values
118
   //encoder rotation values
136
   //The encoder and click button (FastIO Pins)
132
   //The encoder and click button (FastIO Pins)
137
   #define BTN_EN1 26
133
   #define BTN_EN1 26
138
   #define BTN_EN2 27
134
   #define BTN_EN2 27
139
-  #define BTN_ENC 47  //the click switch
135
+  #define BTN_ENC 47
140
 
136
 
141
   #define SDSS 45
137
   #define SDSS 45
142
   #define SD_DETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test)
138
   #define SD_DETECT_PIN -1 // FastIO (Manual says 72 I'm not certain cause I can't test)

+ 2
- 17
Marlin/pins_RAMBO.h View File

127
     //buttons are directly attached using AUX-2
127
     //buttons are directly attached using AUX-2
128
     #define BTN_EN1 76
128
     #define BTN_EN1 76
129
     #define BTN_EN2 77
129
     #define BTN_EN2 77
130
-    #define BTN_ENC 78  //the click
131
-
132
-    #define BLEN_C 2
133
-    #define BLEN_B 1
134
-    #define BLEN_A 0
130
+    #define BTN_ENC 78
135
 
131
 
136
     #define SD_DETECT_PIN 81 // Ramps doesn't use this
132
     #define SD_DETECT_PIN 81 // Ramps doesn't use this
137
 
133
 
154
     #define LCD_PINS_D6 27
150
     #define LCD_PINS_D6 27
155
     #define LCD_PINS_D7 29
151
     #define LCD_PINS_D7 29
156
 
152
 
157
-    //bits in the shift register that carry the buttons for:
158
-    // left up center down right red
159
-    #define BL_LE 7
160
-    #define BL_UP 6
161
-    #define BL_MI 5
162
-    #define BL_DW 4
163
-    #define BL_RI 3
164
-    #define BL_ST 2
165
-    #define BLEN_B 1
166
-    #define BLEN_A 0
167
-
168
   #endif // !NEWPANEL
153
   #endif // !NEWPANEL
169
 
154
 
170
 #endif // ULTRA_LCD
155
 #endif // ULTRA_LCD
179
   //The encoder and click button
164
   //The encoder and click button
180
   #define BTN_EN1 85
165
   #define BTN_EN1 85
181
   #define BTN_EN2 84
166
   #define BTN_EN2 84
182
-  #define BTN_ENC 83  //the click switch
167
+  #define BTN_ENC 83
183
 
168
 
184
   #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board
169
   #define SD_DETECT_PIN -1 // Pin 72 if using easy adapter board
185
 
170
 

+ 1
- 1
Marlin/pins_RAMPS_14.h View File

256
       //The encoder and click button
256
       //The encoder and click button
257
       #define BTN_EN1 40
257
       #define BTN_EN1 40
258
       #define BTN_EN2 63
258
       #define BTN_EN2 63
259
-      #define BTN_ENC 59  //the click switch
259
+      #define BTN_ENC 59
260
       //not connected to a pin
260
       //not connected to a pin
261
       #define SD_DETECT_PIN 49
261
       #define SD_DETECT_PIN 49
262
 
262
 

+ 1
- 5
Marlin/pins_ULTIMAIN_2.h View File

89
 //buttons are directly attached
89
 //buttons are directly attached
90
 #define BTN_EN1 40
90
 #define BTN_EN1 40
91
 #define BTN_EN2 41
91
 #define BTN_EN2 41
92
-#define BTN_ENC 19  //the click
93
-
94
-#define BLEN_C 2
95
-#define BLEN_B 1
96
-#define BLEN_A 0
92
+#define BTN_ENC 19
97
 
93
 
98
 #define SD_DETECT_PIN 39
94
 #define SD_DETECT_PIN 39

+ 18
- 31
Marlin/ultralcd.h View File

58
     void bootscreen();
58
     void bootscreen();
59
   #endif
59
   #endif
60
 
60
 
61
-
62
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
61
   #define LCD_MESSAGEPGM(x) lcd_setstatuspgm(PSTR(x))
63
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
62
   #define LCD_ALERTMESSAGEPGM(x) lcd_setalertstatuspgm(PSTR(x))
64
 
63
 
93
 
92
 
94
   bool lcd_blink();
93
   bool lcd_blink();
95
 
94
 
96
-  #if ENABLED(REPRAPWORLD_KEYPAD)
95
+  #if ENABLED(ULTIPANEL)
96
+    #define BLEN_A 0
97
+    #define BLEN_B 1
98
+    // Encoder click is directly connected
99
+    #if BUTTON_EXISTS(ENC)
100
+      #define BLEN_C 2
101
+      #define EN_C (_BV(BLEN_C))
102
+    #endif
103
+    #define EN_A (_BV(BLEN_A))
104
+    #define EN_B (_BV(BLEN_B))
105
+    #define EN_C (_BV(BLEN_C))
106
+  #endif
107
+
108
+  #if ENABLED(REPRAPWORLD_KEYPAD) // is also ULTIPANEL and NEWPANEL
97
 
109
 
98
     #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
110
     #define REPRAPWORLD_BTN_OFFSET 0 // bit offset into buttons for shift register values
99
 
111
 
135
                                               EN_REPRAPWORLD_KEYPAD_LEFT) \
147
                                               EN_REPRAPWORLD_KEYPAD_LEFT) \
136
                                             )
148
                                             )
137
 
149
 
138
-  #endif // REPRAPWORLD_KEYPAD
139
-
140
-  #if ENABLED(NEWPANEL)
141
-
142
-    #define EN_C (_BV(BLEN_C))
143
-    #define EN_B (_BV(BLEN_B))
144
-    #define EN_A (_BV(BLEN_A))
145
-
146
-    #if ENABLED(REPRAPWORLD_KEYPAD)
147
-      #define LCD_CLICKED ((buttons&EN_C) || (buttons_reprapworld_keypad&EN_REPRAPWORLD_KEYPAD_F1))
148
-    #else
149
-      #define LCD_CLICKED (buttons&EN_C)
150
-    #endif
151
-
152
-  #else //!NEWPANEL
153
-
154
-    //atomic, do not change
155
-    #define B_LE (_BV(BL_LE))
156
-    #define B_UP (_BV(BL_UP))
157
-    #define B_MI (_BV(BL_MI))
158
-    #define B_DW (_BV(BL_DW))
159
-    #define B_RI (_BV(BL_RI))
160
-    #define B_ST (_BV(BL_ST))
161
-    #define EN_B (_BV(BLEN_B))
162
-    #define EN_A (_BV(BLEN_A))
163
-
164
-    #define LCD_CLICKED ((buttons&B_MI)||(buttons&B_ST))
165
-
166
-  #endif //!NEWPANEL
150
+    #define LCD_CLICKED ((buttons & EN_C) || (buttons_reprapworld_keypad & EN_REPRAPWORLD_KEYPAD_F1))
151
+  #elif ENABLED(NEWPANEL)
152
+    #define LCD_CLICKED (buttons & EN_C)
153
+  #endif
167
 
154
 
168
 #else //no LCD
155
 #else //no LCD
169
   FORCE_INLINE void lcd_update() {}
156
   FORCE_INLINE void lcd_update() {}

+ 1
- 12
Marlin/ultralcd_impl_DOGM.h View File

42
  * Implementation of the LCD display routines for a DOGM128 graphic display.
42
  * Implementation of the LCD display routines for a DOGM128 graphic display.
43
  * These are common LCD 128x64 pixel graphic displays.
43
  * These are common LCD 128x64 pixel graphic displays.
44
  */
44
  */
45
-
46
-#if ENABLED(ULTIPANEL)
47
-  #define BLEN_A 0
48
-  #define BLEN_B 1
49
-  #define BLEN_C 2
50
-  #define EN_A (_BV(BLEN_A))
51
-  #define EN_B (_BV(BLEN_B))
52
-  #define EN_C (_BV(BLEN_C))
53
-  #define LCD_CLICKED (buttons&EN_C)
54
-#endif
55
-
56
-#include "dogm_bitmaps.h"
57
 #include "ultralcd.h"
45
 #include "ultralcd.h"
58
 #include "ultralcd_st7920_u8glib_rrd.h"
46
 #include "ultralcd_st7920_u8glib_rrd.h"
47
+#include "dogm_bitmaps.h"
59
 #include "duration_t.h"
48
 #include "duration_t.h"
60
 
49
 
61
 #include <U8glib.h>
50
 #include <U8glib.h>

+ 11
- 39
Marlin/ultralcd_impl_HD44780.h View File

39
 // via a shift/i2c register.
39
 // via a shift/i2c register.
40
 
40
 
41
 #if ENABLED(ULTIPANEL)
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
   // Setup other button mappings of each panel
44
   // Setup other button mappings of each panel
80
 
68
 
81
   #elif ENABLED(LCD_I2C_PANELOLU2)
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
       #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
73
       #define B_I2C_BTN_OFFSET 3 // (the first three bit positions reserved for EN_A, EN_B, EN_C)
91
 
74
 
92
       #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
75
       #define B_MI (PANELOLU2_ENCODER_C<<B_I2C_BTN_OFFSET) // requires LiquidTWI2 library v1.2.3 or later
93
 
76
 
94
       #undef LCD_CLICKED
77
       #undef LCD_CLICKED
95
-      #define LCD_CLICKED (buttons&B_MI)
78
+      #define LCD_CLICKED (buttons & B_MI)
96
 
79
 
97
       // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
80
       // I2C buttons take too long to read inside an interrupt context and so we read them during lcd_update
98
       #define LCD_HAS_SLOW_BUTTONS
81
       #define LCD_HAS_SLOW_BUTTONS
99
 
82
 
100
     #endif
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
     #define B_LE (_BV(BL_LE))
93
     #define B_LE (_BV(BL_LE))
121
     #define B_UP (_BV(BL_UP))
94
     #define B_UP (_BV(BL_UP))
122
     #define B_MI (_BV(BL_MI))
95
     #define B_MI (_BV(BL_MI))
123
     #define B_DW (_BV(BL_DW))
96
     #define B_DW (_BV(BL_DW))
124
     #define B_RI (_BV(BL_RI))
97
     #define B_RI (_BV(BL_RI))
125
     #define B_ST (_BV(BL_ST))
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
   #endif
100
   #endif
129
 
101
 
130
 #endif //ULTIPANEL
102
 #endif //ULTIPANEL

Loading…
Cancel
Save