Browse Source

Allow encoder pulse/step override for more LCDs

Scott Lahteine 8 years ago
parent
commit
3cccaa9885
2 changed files with 25 additions and 27 deletions
  1. 15
    4
      Marlin/Conditionals_LCD.h
  2. 10
    23
      Marlin/ultralcd.cpp

+ 15
- 4
Marlin/Conditionals_LCD.h View File

@@ -65,8 +65,12 @@
65 65
       #define SD_DETECT_INVERTED
66 66
     #endif
67 67
 
68
-    #define ENCODER_PULSES_PER_STEP 4
69
-    #define ENCODER_STEPS_PER_MENU_ITEM 1
68
+    #ifndef ENCODER_PULSES_PER_STEP
69
+      #define ENCODER_PULSES_PER_STEP 4
70
+    #endif
71
+    #ifndef ENCODER_STEPS_PER_MENU_ITEM
72
+      #define ENCODER_STEPS_PER_MENU_ITEM 1
73
+    #endif
70 74
   #endif
71 75
 
72 76
   // Generic support for SSD1306 / SH1106 OLED based LCDs.
@@ -85,7 +89,6 @@
85 89
     #ifndef ENCODER_PULSES_PER_STEP
86 90
       #define ENCODER_PULSES_PER_STEP 4
87 91
     #endif
88
-
89 92
     #ifndef ENCODER_STEPS_PER_MENU_ITEM
90 93
       #define ENCODER_STEPS_PER_MENU_ITEM 1
91 94
     #endif
@@ -146,7 +149,6 @@
146 149
     #ifndef ENCODER_PULSES_PER_STEP
147 150
       #define ENCODER_PULSES_PER_STEP 4
148 151
     #endif
149
-
150 152
     #ifndef ENCODER_STEPS_PER_MENU_ITEM
151 153
       #define ENCODER_STEPS_PER_MENU_ITEM 1
152 154
     #endif
@@ -166,6 +168,15 @@
166 168
     #define LCD_USE_I2C_BUZZER //comment out to disable buzzer on LCD (requires LiquidTWI2 v1.2.3 or later)
167 169
     #define ULTIPANEL
168 170
     #define NEWPANEL
171
+
172
+    #define ENCODER_FEEDRATE_DEADZONE 4
173
+
174
+    #ifndef ENCODER_PULSES_PER_STEP
175
+      #define ENCODER_PULSES_PER_STEP 1
176
+    #endif
177
+    #ifndef ENCODER_STEPS_PER_MENU_ITEM
178
+      #define ENCODER_STEPS_PER_MENU_ITEM 2
179
+    #endif
169 180
   #endif
170 181
 
171 182
   // Shift register panels

+ 10
- 23
Marlin/ultralcd.cpp View File

@@ -177,31 +177,18 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
177 177
     static void menu_action_sddirectory(const char* filename, char* longFilename);
178 178
   #endif
179 179
 
180
-  #if DISABLED(LCD_I2C_VIKI)
181
-    #ifndef ENCODER_FEEDRATE_DEADZONE
182
-      #define ENCODER_FEEDRATE_DEADZONE 10
183
-    #endif
184
-    #ifndef ENCODER_STEPS_PER_MENU_ITEM
185
-      #define ENCODER_STEPS_PER_MENU_ITEM 5
186
-    #endif
187
-    #ifndef ENCODER_PULSES_PER_STEP
188
-      #define ENCODER_PULSES_PER_STEP 1
189
-    #endif
190
-  #else
191
-    #ifndef ENCODER_FEEDRATE_DEADZONE
192
-      #define ENCODER_FEEDRATE_DEADZONE 4
193
-    #endif
194
-    #ifndef ENCODER_STEPS_PER_MENU_ITEM
195
-      #define ENCODER_STEPS_PER_MENU_ITEM 2 // VIKI LCD rotary encoder uses a different number of steps per rotation
196
-    #endif
197
-    #ifndef ENCODER_PULSES_PER_STEP
198
-      #define ENCODER_PULSES_PER_STEP 1
199
-    #endif
200
-  #endif
201
-
202
-
203 180
   /* Helper macros for menus */
204 181
 
182
+  #ifndef ENCODER_FEEDRATE_DEADZONE
183
+    #define ENCODER_FEEDRATE_DEADZONE 10
184
+  #endif
185
+  #ifndef ENCODER_STEPS_PER_MENU_ITEM
186
+    #define ENCODER_STEPS_PER_MENU_ITEM 5
187
+  #endif
188
+  #ifndef ENCODER_PULSES_PER_STEP
189
+    #define ENCODER_PULSES_PER_STEP 1
190
+  #endif
191
+
205 192
   /**
206 193
    * START_SCREEN generates the init code for a screen function
207 194
    *

Loading…
Cancel
Save