|
@@ -10,6 +10,9 @@
|
10
|
10
|
|
11
|
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
|
16
|
/* Configuration settings */
|
14
|
17
|
int plaPreheatHotendTemp;
|
15
|
18
|
int plaPreheatHPBTemp;
|
|
@@ -41,11 +44,6 @@ char lcd_status_message[LCD_WIDTH+1] = WELCOME_MSG;
|
41
|
44
|
#include "ultralcd_implementation_hitachi_HD44780.h"
|
42
|
45
|
#endif
|
43
|
46
|
|
44
|
|
-/** forward declarations **/
|
45
|
|
-
|
46
|
|
-void copy_and_scalePID_i();
|
47
|
|
-void copy_and_scalePID_d();
|
48
|
|
-
|
49
|
47
|
/* Different menus */
|
50
|
48
|
static void lcd_status_screen();
|
51
|
49
|
#ifdef ULTIPANEL
|
|
@@ -119,6 +117,7 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
|
119
|
117
|
|
120
|
118
|
/* Helper macros for menus */
|
121
|
119
|
#define START_MENU() do { \
|
|
120
|
+ encoderRateMultiplierEnabled = false; \
|
122
|
121
|
if (encoderPosition > 0x8000) encoderPosition = 0; \
|
123
|
122
|
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM < currentMenuViewOffset) currentMenuViewOffset = encoderPosition / ENCODER_STEPS_PER_MENU_ITEM;\
|
124
|
123
|
uint8_t _lineNr = currentMenuViewOffset, _menuItemNr; \
|
|
@@ -143,9 +142,39 @@ static void menu_action_setting_edit_callback_long5(const char* pstr, unsigned l
|
143
|
142
|
}\
|
144
|
143
|
_menuItemNr++;\
|
145
|
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
|
146
|
168
|
#define MENU_ITEM_DUMMY() do { _menuItemNr++; } while(0)
|
147
|
169
|
#define MENU_ITEM_EDIT(type, label, args...) MENU_ITEM(setting_edit_ ## type, label, PSTR(label) , ## args )
|
148
|
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
|
149
|
178
|
#define END_MENU() \
|
150
|
179
|
if (encoderPosition / ENCODER_STEPS_PER_MENU_ITEM >= _menuItemNr) encoderPosition = _menuItemNr * ENCODER_STEPS_PER_MENU_ITEM - 1; \
|
151
|
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; } \
|
|
@@ -185,9 +214,8 @@ void* editValue;
|
185
|
214
|
int32_t minEditValue, maxEditValue;
|
186
|
215
|
menuFunc_t callbackFunc;
|
187
|
216
|
|
188
|
|
-// place-holders for Ki and Kd edits, and the extruder # being edited
|
|
217
|
+// place-holders for Ki and Kd edits
|
189
|
218
|
float raw_Ki, raw_Kd;
|
190
|
|
-int pid_current_extruder;
|
191
|
219
|
|
192
|
220
|
static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool feedback=true) {
|
193
|
221
|
if (currentMenu != menu) {
|
|
@@ -205,6 +233,7 @@ static void lcd_goto_menu(menuFunc_t menu, const uint32_t encoder=0, const bool
|
205
|
233
|
/* Main status screen. It's up to the implementation specific part to show what is needed. As this is very display dependent */
|
206
|
234
|
static void lcd_status_screen()
|
207
|
235
|
{
|
|
236
|
+ encoderRateMultiplierEnabled = false;
|
208
|
237
|
#if defined(LCD_PROGRESS_BAR) && defined(SDSUPPORT) && !defined(DOGLCD)
|
209
|
238
|
uint16_t mil = millis();
|
210
|
239
|
#ifndef PROGRESS_MSG_ONCE
|
|
@@ -423,23 +452,23 @@ static void lcd_tune_menu()
|
423
|
452
|
MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
424
|
453
|
MENU_ITEM_EDIT(int3, MSG_SPEED, &feedmultiply, 10, 999);
|
425
|
454
|
#if TEMP_SENSOR_0 != 0
|
426
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
|
|
455
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
|
427
|
456
|
#endif
|
428
|
457
|
#if TEMP_SENSOR_1 != 0
|
429
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
|
|
458
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
|
430
|
459
|
#endif
|
431
|
460
|
#if TEMP_SENSOR_2 != 0
|
432
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
|
|
461
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
|
433
|
462
|
#endif
|
434
|
463
|
#if TEMP_SENSOR_3 != 0
|
435
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
|
|
464
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
|
436
|
465
|
#endif
|
437
|
466
|
|
438
|
467
|
|
439
|
468
|
#if TEMP_SENSOR_BED != 0
|
440
|
|
- MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
|
469
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
441
|
470
|
#endif
|
442
|
|
- MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
|
471
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
443
|
472
|
MENU_ITEM_EDIT(int3, MSG_FLOW, &extrudemultiply, 10, 999);
|
444
|
473
|
MENU_ITEM_EDIT(int3, MSG_FLOW " 0", &extruder_multiply[0], 10, 999);
|
445
|
474
|
#if TEMP_SENSOR_1 != 0
|
|
@@ -616,7 +645,7 @@ static void lcd_preheat_abs_menu()
|
616
|
645
|
MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
617
|
646
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N "1", lcd_preheat_abs0);
|
618
|
647
|
#if TEMP_SENSOR_1 != 0 //2 extruder preheat
|
619
|
|
- MENU_ITEM(function, MSG_PREHEAT_ABS_N "2", lcd_preheat_abs1);
|
|
648
|
+ MENU_ITEM(function, MSG_PREHEAT_ABS_N "2", lcd_preheat_abs1);
|
620
|
649
|
#endif //2 extruder preheat
|
621
|
650
|
#if TEMP_SENSOR_2 != 0 //3 extruder preheat
|
622
|
651
|
MENU_ITEM(function, MSG_PREHEAT_ABS_N "3", lcd_preheat_abs2);
|
|
@@ -811,76 +840,124 @@ static void lcd_control_menu()
|
811
|
840
|
END_MENU();
|
812
|
841
|
}
|
813
|
842
|
|
|
843
|
+#ifdef PIDTEMP
|
|
844
|
+
|
|
845
|
+ // Helpers for editing PID Ki & Kd values
|
|
846
|
+ // grab the PID value out of the temp variable; scale it; then update the PID driver
|
|
847
|
+ void copy_and_scalePID_i(int e) {
|
|
848
|
+ PID_PARAM(Ki, e) = scalePID_i(raw_Ki);
|
|
849
|
+ updatePID();
|
|
850
|
+ }
|
|
851
|
+ void copy_and_scalePID_d(int e) {
|
|
852
|
+ PID_PARAM(Kd, e) = scalePID_d(raw_Kd);
|
|
853
|
+ updatePID();
|
|
854
|
+ }
|
|
855
|
+ void copy_and_scalePID_i_E1() { copy_and_scalePID_i(0); }
|
|
856
|
+ void copy_and_scalePID_d_E1() { copy_and_scalePID_d(0); }
|
|
857
|
+ #ifdef PID_PARAMS_PER_EXTRUDER
|
|
858
|
+ #if EXTRUDERS > 1
|
|
859
|
+ void copy_and_scalePID_i_E2() { copy_and_scalePID_i(1); }
|
|
860
|
+ void copy_and_scalePID_d_E2() { copy_and_scalePID_d(1); }
|
|
861
|
+ #if EXTRUDERS > 2
|
|
862
|
+ void copy_and_scalePID_i_E3() { copy_and_scalePID_i(2); }
|
|
863
|
+ void copy_and_scalePID_d_E3() { copy_and_scalePID_d(2); }
|
|
864
|
+ #if EXTRUDERS > 3
|
|
865
|
+ void copy_and_scalePID_i_E4() { copy_and_scalePID_i(3); }
|
|
866
|
+ void copy_and_scalePID_d_E4() { copy_and_scalePID_d(3); }
|
|
867
|
+ #endif //EXTRUDERS > 3
|
|
868
|
+ #endif //EXTRUDERS > 2
|
|
869
|
+ #endif //EXTRUDERS > 1
|
|
870
|
+ #endif //PID_PARAMS_PER_EXTRUDER
|
|
871
|
+
|
|
872
|
+#endif //PIDTEMP
|
|
873
|
+
|
814
|
874
|
static void lcd_control_temperature_menu()
|
815
|
875
|
{
|
816
|
876
|
START_MENU();
|
817
|
877
|
MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
818
|
|
-#if TEMP_SENSOR_0 != 0
|
819
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
|
820
|
|
-#endif
|
821
|
|
-#if TEMP_SENSOR_1 != 0 && EXTRUDERS > 1
|
822
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
|
823
|
|
-#endif
|
824
|
|
-#if TEMP_SENSOR_2 != 0 && EXTRUDERS > 2
|
825
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
|
826
|
|
-#endif
|
827
|
|
-#if TEMP_SENSOR_3 != 0 && EXTRUDERS > 3
|
828
|
|
- MENU_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
|
829
|
|
-#endif
|
830
|
|
-#if TEMP_SENSOR_BED != 0
|
831
|
|
- MENU_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
832
|
|
-#endif
|
833
|
|
- MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
834
|
|
-#if defined AUTOTEMP && (TEMP_SENSOR_0 != 0)
|
835
|
|
- MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
|
836
|
|
- MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
|
837
|
|
- MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
|
838
|
|
- MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
|
839
|
|
-#endif
|
840
|
|
-#ifdef PIDTEMP
|
841
|
|
- // set up temp variables - undo the default scaling
|
842
|
|
- pid_current_extruder = 0;
|
843
|
|
- raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
|
844
|
|
- raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
|
845
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
|
846
|
|
- // i is typically a small value so allows values below 1
|
847
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
848
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
878
|
+ #if TEMP_SENSOR_0 != 0
|
|
879
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE, &target_temperature[0], 0, HEATER_0_MAXTEMP - 15);
|
|
880
|
+ #endif
|
|
881
|
+ #if EXTRUDERS > 1
|
|
882
|
+ #if TEMP_SENSOR_1 != 0
|
|
883
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 2", &target_temperature[1], 0, HEATER_1_MAXTEMP - 15);
|
|
884
|
+ #endif
|
|
885
|
+ #if EXTRUDERS > 2
|
|
886
|
+ #if TEMP_SENSOR_2 != 0
|
|
887
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 3", &target_temperature[2], 0, HEATER_2_MAXTEMP - 15);
|
|
888
|
+ #endif
|
|
889
|
+ #if EXTRUDERS > 3
|
|
890
|
+ #if TEMP_SENSOR_3 != 0
|
|
891
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_NOZZLE " 4", &target_temperature[3], 0, HEATER_3_MAXTEMP - 15);
|
|
892
|
+ #endif
|
|
893
|
+ #endif
|
|
894
|
+ #endif
|
|
895
|
+ #endif
|
|
896
|
+ #if TEMP_SENSOR_BED != 0
|
|
897
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_BED, &target_temperature_bed, 0, BED_MAXTEMP - 15);
|
|
898
|
+ #endif
|
|
899
|
+ MENU_MULTIPLIER_ITEM_EDIT(int3, MSG_FAN_SPEED, &fanSpeed, 0, 255);
|
|
900
|
+ #if defined(AUTOTEMP) && (TEMP_SENSOR_0 != 0)
|
|
901
|
+ MENU_ITEM_EDIT(bool, MSG_AUTOTEMP, &autotemp_enabled);
|
|
902
|
+ MENU_ITEM_EDIT(float3, MSG_MIN, &autotemp_min, 0, HEATER_0_MAXTEMP - 15);
|
|
903
|
+ MENU_ITEM_EDIT(float3, MSG_MAX, &autotemp_max, 0, HEATER_0_MAXTEMP - 15);
|
|
904
|
+ MENU_ITEM_EDIT(float32, MSG_FACTOR, &autotemp_factor, 0.0, 1.0);
|
|
905
|
+ #endif
|
|
906
|
+ #ifdef PIDTEMP
|
|
907
|
+ // set up temp variables - undo the default scaling
|
|
908
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,0));
|
|
909
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,0));
|
|
910
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P, &PID_PARAM(Kp,0), 1, 9990);
|
|
911
|
+ // i is typically a small value so allows values below 1
|
|
912
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I, &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E1);
|
|
913
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D, &raw_Kd, 1, 9990, copy_and_scalePID_d_E1);
|
849
|
914
|
#ifdef PID_ADD_EXTRUSION_RATE
|
850
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
|
|
915
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C, &PID_PARAM(Kc,0), 1, 9990);
|
851
|
916
|
#endif//PID_ADD_EXTRUSION_RATE
|
852
|
|
-#ifdef PID_PARAMS_PER_EXTRUDER
|
853
|
|
- #if EXTRUDERS > 1
|
854
|
|
- // set up temp variables - undo the default scaling
|
855
|
|
- pid_current_extruder = 0;
|
856
|
|
- raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
|
857
|
|
- raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
|
858
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990);
|
859
|
|
- // i is typically a small value so allows values below 1
|
860
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
861
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
862
|
|
- #ifdef PID_ADD_EXTRUSION_RATE
|
863
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990);
|
864
|
|
- #endif//PID_ADD_EXTRUSION_RATE
|
865
|
|
- #endif//EXTRUDERS > 1
|
866
|
|
- #if EXTRUDERS > 2
|
867
|
|
- // set up temp variables - undo the default scaling
|
868
|
|
- pid_current_extruder = 0;
|
869
|
|
- raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
|
870
|
|
- raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
|
871
|
|
- MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990);
|
872
|
|
- // i is typically a small value so allows values below 1
|
873
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i);
|
874
|
|
- MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d);
|
|
917
|
+ #ifdef PID_PARAMS_PER_EXTRUDER
|
|
918
|
+ #if EXTRUDERS > 1
|
|
919
|
+ // set up temp variables - undo the default scaling
|
|
920
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,1));
|
|
921
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,1));
|
|
922
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P " E2", &PID_PARAM(Kp,1), 1, 9990);
|
|
923
|
+ // i is typically a small value so allows values below 1
|
|
924
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E2", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E2);
|
|
925
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E2", &raw_Kd, 1, 9990, copy_and_scalePID_d_E2);
|
875
|
926
|
#ifdef PID_ADD_EXTRUSION_RATE
|
876
|
|
- MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990);
|
|
927
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C " E2", &PID_PARAM(Kc,1), 1, 9990);
|
877
|
928
|
#endif//PID_ADD_EXTRUSION_RATE
|
878
|
|
- #endif//EXTRUDERS > 2
|
879
|
|
-#endif // PID_PARAMS_PER_EXTRUDER
|
880
|
|
-#endif//PIDTEMP
|
881
|
|
- MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
|
882
|
|
- MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
|
883
|
|
- END_MENU();
|
|
929
|
+
|
|
930
|
+ #if EXTRUDERS > 2
|
|
931
|
+ // set up temp variables - undo the default scaling
|
|
932
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,2));
|
|
933
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,2));
|
|
934
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P " E3", &PID_PARAM(Kp,2), 1, 9990);
|
|
935
|
+ // i is typically a small value so allows values below 1
|
|
936
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E3", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E3);
|
|
937
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E3", &raw_Kd, 1, 9990, copy_and_scalePID_d_E3);
|
|
938
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
939
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C " E3", &PID_PARAM(Kc,2), 1, 9990);
|
|
940
|
+ #endif//PID_ADD_EXTRUSION_RATE
|
|
941
|
+
|
|
942
|
+ #if EXTRUDERS > 3
|
|
943
|
+ // set up temp variables - undo the default scaling
|
|
944
|
+ raw_Ki = unscalePID_i(PID_PARAM(Ki,3));
|
|
945
|
+ raw_Kd = unscalePID_d(PID_PARAM(Kd,3));
|
|
946
|
+ MENU_ITEM_EDIT(float52, MSG_PID_P " E4", &PID_PARAM(Kp,3), 1, 9990);
|
|
947
|
+ // i is typically a small value so allows values below 1
|
|
948
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_I " E4", &raw_Ki, 0.01, 9990, copy_and_scalePID_i_E4);
|
|
949
|
+ MENU_ITEM_EDIT_CALLBACK(float52, MSG_PID_D " E4", &raw_Kd, 1, 9990, copy_and_scalePID_d_E4);
|
|
950
|
+ #ifdef PID_ADD_EXTRUSION_RATE
|
|
951
|
+ MENU_ITEM_EDIT(float3, MSG_PID_C " E4", &PID_PARAM(Kc,3), 1, 9990);
|
|
952
|
+ #endif//PID_ADD_EXTRUSION_RATE
|
|
953
|
+ #endif//EXTRUDERS > 3
|
|
954
|
+ #endif//EXTRUDERS > 2
|
|
955
|
+ #endif//EXTRUDERS > 1
|
|
956
|
+ #endif //PID_PARAMS_PER_EXTRUDER
|
|
957
|
+ #endif//PIDTEMP
|
|
958
|
+ MENU_ITEM(submenu, MSG_PREHEAT_PLA_SETTINGS, lcd_control_temperature_preheat_pla_settings_menu);
|
|
959
|
+ MENU_ITEM(submenu, MSG_PREHEAT_ABS_SETTINGS, lcd_control_temperature_preheat_abs_settings_menu);
|
|
960
|
+ END_MENU();
|
884
|
961
|
}
|
885
|
962
|
|
886
|
963
|
static void lcd_control_temperature_preheat_pla_settings_menu()
|
|
@@ -961,16 +1038,16 @@ static void lcd_control_volumetric_menu()
|
961
|
1038
|
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
|
962
|
1039
|
|
963
|
1040
|
if (volumetric_enabled) {
|
964
|
|
- 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);
|
965
|
|
-#if EXTRUDERS > 1
|
966
|
|
- 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);
|
967
|
|
-#if EXTRUDERS > 2
|
968
|
|
- 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);
|
969
|
|
-#if EXTRUDERS > 3
|
970
|
|
- 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);
|
971
|
|
-#endif //EXTRUDERS > 3
|
972
|
|
-#endif //EXTRUDERS > 2
|
973
|
|
-#endif //EXTRUDERS > 1
|
|
1041
|
+ MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_0, &filament_size[0], 1.5, 3.25, calculate_volumetric_multipliers);
|
|
1042
|
+ #if EXTRUDERS > 1
|
|
1043
|
+ MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_1, &filament_size[1], 1.5, 3.25, calculate_volumetric_multipliers);
|
|
1044
|
+ #if EXTRUDERS > 2
|
|
1045
|
+ MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_2, &filament_size[2], 1.5, 3.25, calculate_volumetric_multipliers);
|
|
1046
|
+ #if EXTRUDERS > 3
|
|
1047
|
+ MENU_MULTIPLIER_ITEM_EDIT_CALLBACK(float43, MSG_FILAMENT_SIZE_EXTRUDER_3, &filament_size[3], 1.5, 3.25, calculate_volumetric_multipliers);
|
|
1048
|
+ #endif //EXTRUDERS > 3
|
|
1049
|
+ #endif //EXTRUDERS > 2
|
|
1050
|
+ #endif //EXTRUDERS > 1
|
974
|
1051
|
}
|
975
|
1052
|
|
976
|
1053
|
END_MENU();
|
|
@@ -1260,6 +1337,26 @@ void lcd_init()
|
1260
|
1337
|
#endif
|
1261
|
1338
|
}
|
1262
|
1339
|
|
|
1340
|
+int lcd_strlen(char *s) {
|
|
1341
|
+ int i = 0, j = 0;
|
|
1342
|
+ while (s[i]) {
|
|
1343
|
+ if ((s[i] & 0xc0) != 0x80) j++;
|
|
1344
|
+ i++;
|
|
1345
|
+ }
|
|
1346
|
+ return j;
|
|
1347
|
+}
|
|
1348
|
+
|
|
1349
|
+int lcd_strlen_P(const char *s) {
|
|
1350
|
+ int j = 0;
|
|
1351
|
+ while (pgm_read_byte(s)) {
|
|
1352
|
+ if ((pgm_read_byte(s) & 0xc0) != 0x80) j++;
|
|
1353
|
+ s++;
|
|
1354
|
+ }
|
|
1355
|
+ return j;
|
|
1356
|
+}
|
|
1357
|
+
|
|
1358
|
+
|
|
1359
|
+
|
1263
|
1360
|
void lcd_update()
|
1264
|
1361
|
{
|
1265
|
1362
|
static unsigned long timeoutToStatus = 0;
|
|
@@ -1322,8 +1419,41 @@ void lcd_update()
|
1322
|
1419
|
#endif
|
1323
|
1420
|
if (abs(encoderDiff) >= ENCODER_PULSES_PER_STEP)
|
1324
|
1421
|
{
|
|
1422
|
+ int32_t encoderMultiplier = 1;
|
|
1423
|
+
|
|
1424
|
+ #ifdef ENCODER_RATE_MULTIPLIER
|
|
1425
|
+
|
|
1426
|
+ if (encoderRateMultiplierEnabled) {
|
|
1427
|
+ int32_t encoderMovementSteps = abs(encoderDiff) / ENCODER_PULSES_PER_STEP;
|
|
1428
|
+
|
|
1429
|
+ if (lastEncoderMovementMillis != 0) {
|
|
1430
|
+ // Note that the rate is always calculated between to passes through the
|
|
1431
|
+ // loop and that the abs of the encoderDiff value is tracked.
|
|
1432
|
+ float encoderStepRate =
|
|
1433
|
+ (float)(encoderMovementSteps) / ((float)(millis() - lastEncoderMovementMillis)) * 1000.0;
|
|
1434
|
+
|
|
1435
|
+ if (encoderStepRate >= ENCODER_100X_STEPS_PER_SEC) encoderMultiplier = 100;
|
|
1436
|
+ else if (encoderStepRate >= ENCODER_10X_STEPS_PER_SEC) encoderMultiplier = 10;
|
|
1437
|
+
|
|
1438
|
+ #ifdef ENCODER_RATE_MULTIPLIER_DEBUG
|
|
1439
|
+ SERIAL_ECHO_START;
|
|
1440
|
+ SERIAL_ECHO("Enc Step Rate: ");
|
|
1441
|
+ SERIAL_ECHO(encoderStepRate);
|
|
1442
|
+ SERIAL_ECHO(" Multiplier: ");
|
|
1443
|
+ SERIAL_ECHO(encoderMultiplier);
|
|
1444
|
+ SERIAL_ECHO(" ENCODER_10X_STEPS_PER_SEC: ");
|
|
1445
|
+ SERIAL_ECHO(ENCODER_10X_STEPS_PER_SEC);
|
|
1446
|
+ SERIAL_ECHO(" ENCODER_100X_STEPS_PER_SEC: ");
|
|
1447
|
+ SERIAL_ECHOLN(ENCODER_100X_STEPS_PER_SEC);
|
|
1448
|
+ #endif //ENCODER_RATE_MULTIPLIER_DEBUG
|
|
1449
|
+ }
|
|
1450
|
+
|
|
1451
|
+ lastEncoderMovementMillis = millis();
|
|
1452
|
+ }
|
|
1453
|
+ #endif //ENCODER_RATE_MULTIPLIER
|
|
1454
|
+
|
1325
|
1455
|
lcdDrawUpdate = 1;
|
1326
|
|
- encoderPosition += encoderDiff / ENCODER_PULSES_PER_STEP;
|
|
1456
|
+ encoderPosition += (encoderDiff * encoderMultiplier) / ENCODER_PULSES_PER_STEP;
|
1327
|
1457
|
encoderDiff = 0;
|
1328
|
1458
|
timeoutToStatus = millis() + LCD_TIMEOUT_TO_STATUS;
|
1329
|
1459
|
}
|
|
@@ -1372,7 +1502,7 @@ void lcd_ignore_click(bool b)
|
1372
|
1502
|
}
|
1373
|
1503
|
|
1374
|
1504
|
void lcd_finishstatus() {
|
1375
|
|
- int len = strlen(lcd_status_message);
|
|
1505
|
+ int len = lcd_strlen(lcd_status_message);
|
1376
|
1506
|
if (len > 0) {
|
1377
|
1507
|
while (len < LCD_WIDTH) {
|
1378
|
1508
|
lcd_status_message[len++] = ' ';
|
|
@@ -1785,24 +1915,4 @@ char *ftostr52(const float &x)
|
1785
|
1915
|
return conv;
|
1786
|
1916
|
}
|
1787
|
1917
|
|
1788
|
|
-// Callback for after editing PID i value
|
1789
|
|
-// grab the PID i value out of the temp variable; scale it; then update the PID driver
|
1790
|
|
-void copy_and_scalePID_i()
|
1791
|
|
-{
|
1792
|
|
-#ifdef PIDTEMP
|
1793
|
|
- PID_PARAM(Ki, pid_current_extruder) = scalePID_i(raw_Ki);
|
1794
|
|
- updatePID();
|
1795
|
|
-#endif
|
1796
|
|
-}
|
1797
|
|
-
|
1798
|
|
-// Callback for after editing PID d value
|
1799
|
|
-// grab the PID d value out of the temp variable; scale it; then update the PID driver
|
1800
|
|
-void copy_and_scalePID_d()
|
1801
|
|
-{
|
1802
|
|
-#ifdef PIDTEMP
|
1803
|
|
- PID_PARAM(Kd, pid_current_extruder) = scalePID_d(raw_Kd);
|
1804
|
|
- updatePID();
|
1805
|
|
-#endif
|
1806
|
|
-}
|
1807
|
|
-
|
1808
|
1918
|
#endif //ULTRA_LCD
|