Browse Source

Merge in encoder multiplier

Scott Lahteine 10 years ago
parent
commit
40ef472a25

+ 5
- 0
Marlin/Configuration_adv.h View File

284
 //=============================Additional Features===========================
284
 //=============================Additional Features===========================
285
 //===========================================================================
285
 //===========================================================================
286
 
286
 
287
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
288
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
289
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
290
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
291
+
287
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
292
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
288
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
293
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
289
 
294
 

+ 5
- 0
Marlin/example_configurations/Hephestos/Configuration_adv.h View File

284
 //=============================Additional Features===========================
284
 //=============================Additional Features===========================
285
 //===========================================================================
285
 //===========================================================================
286
 
286
 
287
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
288
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
289
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
290
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
291
+
287
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
292
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
288
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
293
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
289
 
294
 

+ 5
- 0
Marlin/example_configurations/K8200/Configuration_adv.h View File

284
 //=============================Additional Features===========================
284
 //=============================Additional Features===========================
285
 //===========================================================================
285
 //===========================================================================
286
 
286
 
287
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
288
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
289
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
290
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
291
+
287
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
292
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
288
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
293
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
289
 
294
 

+ 5
- 0
Marlin/example_configurations/SCARA/Configuration_adv.h View File

287
 //=============================Additional Features===========================
287
 //=============================Additional Features===========================
288
 //===========================================================================
288
 //===========================================================================
289
 
289
 
290
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
291
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
292
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
293
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
294
+
290
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
295
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
291
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
296
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
292
 
297
 

+ 5
- 0
Marlin/example_configurations/WITBOX/Configuration_adv.h View File

284
 //=============================Additional Features===========================
284
 //=============================Additional Features===========================
285
 //===========================================================================
285
 //===========================================================================
286
 
286
 
287
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
288
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
289
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
290
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
291
+
287
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
292
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
288
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
293
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
289
 
294
 

+ 5
- 0
Marlin/example_configurations/delta/Configuration_adv.h View File

279
 //=============================Additional Features===========================
279
 //=============================Additional Features===========================
280
 //===========================================================================
280
 //===========================================================================
281
 
281
 
282
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
283
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
284
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
285
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
286
+
282
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
287
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
283
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
288
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
284
 
289
 

+ 5
- 0
Marlin/example_configurations/makibox/Configuration_adv.h View File

283
 //=============================Additional Features===========================
283
 //=============================Additional Features===========================
284
 //===========================================================================
284
 //===========================================================================
285
 
285
 
286
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
287
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
288
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
289
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
290
+
286
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
291
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
287
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
292
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
288
 
293
 

+ 5
- 0
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h View File

284
 //=============================Additional Features===========================
284
 //=============================Additional Features===========================
285
 //===========================================================================
285
 //===========================================================================
286
 
286
 
287
+#define ENCODER_RATE_MULTIPLIER         // If defined, certain menu edit operations automatically multiply the steps when the encoder is moved quickly
288
+#define ENCODER_10X_STEPS_PER_SEC 75    // If the encoder steps per sec exceed this value, multiple the steps moved by ten to quickly advance the value
289
+#define ENCODER_100X_STEPS_PER_SEC 160  // If the encoder steps per sec exceed this value, multiple the steps moved by 100 to really quickly advance the value
290
+//#define ENCODER_RATE_MULTIPLIER_DEBUG  // If defined, output the encoder steps per second value
291
+
287
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
292
 //#define CHDK 4        //Pin for triggering CHDK to take a picture see how to use it here http://captain-slow.dk/2014/03/09/3d-printing-timelapses/
288
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
293
 #define CHDK_DELAY 50 //How long in ms the pin should stay HIGH before going LOW again
289
 
294
 

+ 94
- 27
Marlin/ultralcd.cpp View File

10
 
10
 
11
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
11
 int8_t encoderDiff; /* encoderDiff is updated from interrupt context and added to encoderPosition every LCD update */
12
 
12
 
13
+bool encoderRateMultiplierEnabled;
14
+int32_t lastEncoderMovementMillis;
15
+
13
 /* Configuration settings */
16
 /* Configuration settings */
14
 int plaPreheatHotendTemp;
17
 int plaPreheatHotendTemp;
15
 int plaPreheatHPBTemp;
18
 int plaPreheatHPBTemp;
114
 
117
 
115
 /* Helper macros for menus */
118
 /* Helper macros for menus */
116
 #define START_MENU() do { \
119
 #define START_MENU() do { \
120
+	encoderRateMultiplierEnabled = false; \
117
     if (encoderPosition > 0x8000) encoderPosition = 0; \
121
     if (encoderPosition > 0x8000) encoderPosition = 0; \
118
     if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
122
     if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
119
     uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
123
     uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
138
     }\
142
     }\
139
     _menuItemNr++;\
143
     _menuItemNr++;\
140
 } while(0)
144
 } while(0)
145
+#ifdef ENCODER_RATE_MULTIPLIER
146
+  #define MENU_MULTIPLIER_ITEM(type, label, args...) do { \
147
+    if (_menuItemNr == _lineNr) { \
148
+      if (lcdDrawUpdate) { \
149
+        const char* _label_pstr = PSTR(label); \
150
+        if ((encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
151
+          lcd_implementation_drawmenu_ ## type ## _selected (_drawLineNr, _label_pstr , ## args ); \
152
+        } \
153
+        else { \
154
+          lcd_implementation_drawmenu_ ## type (_drawLineNr, _label_pstr , ## args ); \
155
+        } \
156
+      } \
157
+      if (wasClicked && (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) == _menuItemNr) { \
158
+        lcd_quick_feedback(); \
159
+        encoderRateMultiplierEnabled = true; \
160
+        lastEncoderMovementMillis = 0; \
161
+        menu_action_ ## type ( args ); \
162
+        return; \
163
+      } \
164
+    } \
165
+    _menuItemNr++; \
166
+  } while(0)
167
+#endif //ENCODER_RATE_MULTIPLIER
141
 #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
168
 #define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
142
 #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
169
 #define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
143
 #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
170
 #define MENU_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
171
+#ifdef ENCODER_RATE_MULTIPLIER
172
+  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
173
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_MULTIPLIER_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
174
+#else //!ENCODER_RATE_MULTIPLIER
175
+  #define MENU_MULTIPLIER_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
176
+  #define MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(type, label, args...) MENU_ITEM(setting_edit_callback_ ## type, label, PSTR(label) , ## args )
177
+#endif //!ENCODER_RATE_MULTIPLIER
144
 #define END_MENU() \
178
 #define END_MENU() \
145
     if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
179
     if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
146
     if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
180
     if ((uint8_t)(encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) >= currentMenuViewOffset + LCD_HEIGHT) { currentMenuViewOffset = (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM) - LCD_HEIGHT + 1; lcdDrawUpdate = 1; _lineNr = currentMenuViewOffset - 1; _drawLineNr = -1; } \
199
 /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
233
 /* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
200
 static void lcd_status_screen()
234
 static void lcd_status_screen()
201
 {
235
 {
236
+	encoderRateMultiplierEnabled = false;
202
   #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
237
   #if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
203
     uint16_t mil = millis();
238
     uint16_t mil = millis();
204
     #ifndef PROGRESS_MSG_ONCE
239
     #ifndef PROGRESS_MSG_ONCE
412
   MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
447
   MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
413
   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999);
448
   MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999);
414
   #if TEMP_SENSOR_0 != 0
449
   #if TEMP_SENSOR_0 != 0
415
-    MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
450
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
416
   #endif
451
   #endif
417
   #if TEMP_SENSOR_1 != 0
452
   #if TEMP_SENSOR_1 != 0
418
-    MENU_ITEM_EDIT(int3, MSG_NOZZLE MSG_N2, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
453
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N2, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
419
   #endif
454
   #endif
420
   #if TEMP_SENSOR_2 != 0
455
   #if TEMP_SENSOR_2 != 0
421
-    MENU_ITEM_EDIT(int3, MSG_NOZZLE MSG_N3, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
456
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N3, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
422
   #endif
457
   #endif
423
   #if TEMP_SENSOR_3 != 0
458
   #if TEMP_SENSOR_3 != 0
424
-    MENU_ITEM_EDIT(int3, MSG_NOZZLE MSG_N4, &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
459
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N4, &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
425
   #endif
460
   #endif
426
   #if TEMP_SENSOR_BED != 0
461
   #if TEMP_SENSOR_BED != 0
427
-    MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
462
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
428
   #endif
463
   #endif
429
-    MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
464
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
430
     MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
465
     MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
431
     MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
466
     MENU_ITEM_EDIT(int3, MSG_FLOW MSG_F0, &extruder_multiply[0], 10, 999);
432
   #if TEMP_SENSOR_1 != 0
467
   #if TEMP_SENSOR_1 != 0
725
         void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); }
760
         void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); }
726
         #if EXTRUDERS > 3
761
         #if EXTRUDERS > 3
727
           void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); }
762
           void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); }
728
-          void copy_and_scalePID_d_E5() { copy_and_scalePID_d(3); }
763
+          void copy_and_scalePID_d_E4() { copy_and_scalePID_d(3); }
729
         #endif //EXTRUDERS > 3
764
         #endif //EXTRUDERS > 3
730
       #endif //EXTRUDERS > 2
765
       #endif //EXTRUDERS > 2
731
     #endif //EXTRUDERS > 1
766
     #endif //EXTRUDERS > 1
737
   START_MENU();
772
   START_MENU();
738
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
773
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
739
   #if TEMP_SENSOR_0 != 0
774
   #if TEMP_SENSOR_0 != 0
740
-    MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
775
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
741
   #endif
776
   #endif
742
   #if EXTRUDERS > 1
777
   #if EXTRUDERS > 1
743
     #if TEMP_SENSOR_1 != 0
778
     #if TEMP_SENSOR_1 != 0
744
-      MENU_ITEM_EDIT(int3, MSG_NOZZLE MSG_N2, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
779
+      MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N2, &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
745
     #endif
780
     #endif
746
     #if EXTRUDERS > 2
781
     #if EXTRUDERS > 2
747
       #if TEMP_SENSOR_2 != 0
782
       #if TEMP_SENSOR_2 != 0
748
-        MENU_ITEM_EDIT(int3, MSG_NOZZLE MSG_N3, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
783
+        MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N3, &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
749
       #endif
784
       #endif
750
       #if EXTRUDERS > 3
785
       #if EXTRUDERS > 3
751
         #if TEMP_SENSOR_3 != 0
786
         #if TEMP_SENSOR_3 != 0
752
-          MENU_ITEM_EDIT(int3, MSG_NOZZLE MSG_N4, &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
787
+          MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE MSG_N4, &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
753
         #endif
788
         #endif
754
-      #endif
755
-    #endif
756
-  #endif
789
+      #endif // EXTRUDERS > 3
790
+    #endif // EXTRUDERS > 2
791
+  #endif // EXTRUDERS > 1
757
   #if TEMP_SENSOR_BED != 0
792
   #if TEMP_SENSOR_BED != 0
758
-    MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
793
+    MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
759
   #endif
794
   #endif
760
-  MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
795
+  MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
761
   #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
796
   #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
762
     MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
797
     MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
763
     MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
798
     MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
888
   END_MENU();
923
   END_MENU();
889
 }
924
 }
890
 
925
 
891
-static void lcd_control_volumetric_menu()
892
-{
926
+static void lcd_control_volumetric_menu() {
893
   START_MENU();
927
   START_MENU();
894
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
928
   MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
895
 
929
 
896
   MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
930
   MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
897
 
931
 
898
   if (volumetric_enabled) {
932
   if (volumetric_enabled) {
899
-    MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_0, &filament_size[0], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
933
+    MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_0, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers);
900
     #if EXTRUDERS > 1
934
     #if EXTRUDERS > 1
901
-      MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_1, &filament_size[1], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
935
+      MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_1, &filament_size[1], 1.5, 3.25, calculate_volumetric_multipliers);
902
       #if EXTRUDERS > 2
936
       #if EXTRUDERS > 2
903
-        MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_2, &filament_size[2], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
937
+        MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_2, &filament_size[2], 1.5, 3.25, calculate_volumetric_multipliers);
904
         #if EXTRUDERS > 3
938
         #if EXTRUDERS > 3
905
-          MENU_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_3, &filament_size[3], DEFAULT_NOMINAL_FILAMENT_DIA - .5, DEFAULT_NOMINAL_FILAMENT_DIA + .5, calculate_volumetric_multipliers);
939
+          MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_3, &filament_size[3], 1.5, 3.25, calculate_volumetric_multipliers);
906
         #endif //EXTRUDERS > 3
940
         #endif //EXTRUDERS > 3
907
       #endif //EXTRUDERS > 2
941
       #endif //EXTRUDERS > 2
908
     #endif //EXTRUDERS > 1
942
     #endif //EXTRUDERS > 1
1217
     }
1251
     }
1218
   #endif//CARDINSERTED
1252
   #endif//CARDINSERTED
1219
 
1253
 
1220
-  if (millis() > lcd_next_update_millis) {
1254
+  long ms = millis();
1255
+  if (ms > lcd_next_update_millis) {
1221
 
1256
 
1222
     #ifdef ULTIPANEL
1257
     #ifdef ULTIPANEL
1223
 
1258
 
1224
-  	  #ifdef REPRAPWORLD_KEYPAD
1259
+      #ifdef REPRAPWORLD_KEYPAD
1225
         if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up();
1260
         if (REPRAPWORLD_KEYPAD_MOVE_Z_UP)     reprapworld_keypad_move_z_up();
1226
         if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down();
1261
         if (REPRAPWORLD_KEYPAD_MOVE_Z_DOWN)   reprapworld_keypad_move_z_down();
1227
         if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left();
1262
         if (REPRAPWORLD_KEYPAD_MOVE_X_LEFT)   reprapworld_keypad_move_x_left();
1229
         if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)   reprapworld_keypad_move_y_down();
1264
         if (REPRAPWORLD_KEYPAD_MOVE_Y_DOWN)   reprapworld_keypad_move_y_down();
1230
         if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)     reprapworld_keypad_move_y_up();
1265
         if (REPRAPWORLD_KEYPAD_MOVE_Y_UP)     reprapworld_keypad_move_y_up();
1231
         if (REPRAPWORLD_KEYPAD_MOVE_HOME)     reprapworld_keypad_move_home();
1266
         if (REPRAPWORLD_KEYPAD_MOVE_HOME)     reprapworld_keypad_move_home();
1232
-  	  #endif
1267
+      #endif
1233
 
1268
 
1234
       bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
1269
       bool encoderPastThreshold = (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP);
1235
       if (encoderPastThreshold || LCD_CLICKED) {
1270
       if (encoderPastThreshold || LCD_CLICKED) {
1236
         if (encoderPastThreshold) {
1271
         if (encoderPastThreshold) {
1272
+          int32_t encoderMultiplier = 1;
1273
+
1274
+          #ifdef ENCODER_RATE_MULTIPLIER
1275
+
1276
+            if (encoderRateMultiplierEnabled) {
1277
+              int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
1278
+
1279
+              if (lastEncoderMovementMillis != 0) {
1280
+                // Note that the rate is always calculated between to passes through the 
1281
+                // loop and that the abs of the encoderDiff value is tracked.
1282
+                float encoderStepRate = (float)(encoderMovementSteps) / ((float)(ms - lastEncoderMovementMillis)) * 1000.0;
1283
+
1284
+                if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC)     encoderMultiplier = 100;
1285
+                else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
1286
+
1287
+                #ifdef ENCODER_RATE_MULTIPLIER_DEBUG
1288
+                  SERIAL_ECHO_START;
1289
+                  SERIAL_ECHO("Enc Step Rate: ");
1290
+                  SERIAL_ECHO(encoderStepRate);
1291
+                  SERIAL_ECHO("  Multiplier: ");
1292
+                  SERIAL_ECHO(encoderMultiplier);
1293
+                  SERIAL_ECHO("  ENCODER_10X_STEPS_PER_SEC: ");
1294
+                  SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC);
1295
+                  SERIAL_ECHO("  ENCODER_100X_STEPS_PER_SEC: ");
1296
+                  SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC);
1297
+                #endif //ENCODER_RATE_MULTIPLIER_DEBUG
1298
+              }
1299
+
1300
+              lastEncoderMovementMillis = ms;
1301
+            }
1302
+          #endif //ENCODER_RATE_MULTIPLIER
1303
+
1237
           lcdDrawUpdate = 1;
1304
           lcdDrawUpdate = 1;
1238
-          encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP;
1305
+          encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
1239
           encoderDiff = 0;
1306
           encoderDiff = 0;
1240
         }
1307
         }
1241
-        timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
1308
+        timeoutToStatus = ms + LCD_TIMEOUT_TO_STATUS;
1242
       }
1309
       }
1243
 
1310
 
1244
     #endif //ULTIPANEL
1311
     #endif //ULTIPANEL

Loading…
Cancel
Save