|
@@ -111,13 +111,10 @@ static void lcd_status_screen();
|
111
|
111
|
|
112
|
112
|
#if ENABLED(MANUAL_BED_LEVELING)
|
113
|
113
|
#include "mesh_bed_leveling.h"
|
114
|
|
- static void _lcd_level_bed();
|
115
|
|
- static void _lcd_level_bed_homing();
|
116
|
|
- static void lcd_level_bed();
|
117
|
114
|
#endif
|
118
|
115
|
|
119
|
116
|
/* Different types of actions that can be used in menu items. */
|
120
|
|
- static void menu_action_back(menuFunc_t data);
|
|
117
|
+ static void menu_action_back();
|
121
|
118
|
static void menu_action_submenu(menuFunc_t data);
|
122
|
119
|
static void menu_action_gcode(const char* pgcode);
|
123
|
120
|
static void menu_action_function(menuFunc_t data);
|
|
@@ -188,9 +185,9 @@ static void lcd_status_screen();
|
188
|
185
|
* menu_action_[type](arg3...)
|
189
|
186
|
*
|
190
|
187
|
* Examples:
|
191
|
|
- * MENU_ITEM(back, MSG_WATCH, lcd_status_screen)
|
192
|
|
- * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH), lcd_status_screen)
|
193
|
|
- * menu_action_back(lcd_status_screen)
|
|
188
|
+ * MENU_ITEM(back, MSG_WATCH)
|
|
189
|
+ * lcd_implementation_drawmenu_back(sel, row, PSTR(MSG_WATCH))
|
|
190
|
+ * menu_action_back()
|
194
|
191
|
*
|
195
|
192
|
* MENU_ITEM(function, MSG_PAUSE_PRINT, lcd_sdcard_pause)
|
196
|
193
|
* lcd_implementation_drawmenu_function(sel, row, PSTR(MSG_PAUSE_PRINT), lcd_sdcard_pause)
|
|
@@ -267,14 +264,25 @@ static void lcd_status_screen();
|
267
|
264
|
uint8_t currentMenuViewOffset; /* scroll offset in the current menu */
|
268
|
265
|
millis_t next_button_update_ms;
|
269
|
266
|
uint8_t lastEncoderBits;
|
270
|
|
- uint32_t encoderPosition, prevEncoderPosition;
|
|
267
|
+ uint32_t encoderPosition;
|
271
|
268
|
#if PIN_EXISTS(SD_DETECT)
|
272
|
269
|
uint8_t lcd_sd_status;
|
273
|
270
|
#endif
|
274
|
271
|
|
275
|
272
|
#endif // ULTIPANEL
|
276
|
273
|
|
277
|
|
-menuFunc_t currentMenu = lcd_status_screen; /* function pointer to the currently active menu */
|
|
274
|
+typedef struct {
|
|
275
|
+ menuFunc_t menu_function;
|
|
276
|
+ #if ENABLED(ULTIPANEL)
|
|
277
|
+ uint32_t encoder_position;
|
|
278
|
+ #endif
|
|
279
|
+} menuPosition;
|
|
280
|
+
|
|
281
|
+menuFunc_t currentMenu = lcd_status_screen; // pointer to the currently active menu handler
|
|
282
|
+
|
|
283
|
+menuPosition menu_history[10];
|
|
284
|
+uint8_t menu_history_depth = 0;
|
|
285
|
+
|
278
|
286
|
millis_t next_lcd_update_ms;
|
279
|
287
|
uint8_t lcd_status_update_delay;
|
280
|
288
|
bool ignore_click = false;
|
|
@@ -285,7 +293,7 @@ enum LCDHandlerAction {
|
285
|
293
|
LCD_DRAW_UPDATE_NONE,
|
286
|
294
|
LCD_DRAW_UPDATE_CALL_REDRAW,
|
287
|
295
|
LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW,
|
288
|
|
- LCD_DRAW_UPDATE_CALL_NO_REDRAW,
|
|
296
|
+ LCD_DRAW_UPDATE_CALL_NO_REDRAW
|
289
|
297
|
};
|
290
|
298
|
|
291
|
299
|
uint8_t lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW; // Set 1 or 2 when the LCD needs to draw, decrements after every draw. Set to 2 in LCD routines so the LCD gets at least 1 full redraw (first redraw is partial)
|
|
@@ -294,7 +302,6 @@ uint8_t lcdDrawUpdate = LCD_DRAW_UPDATE_CLEAR_CALL_REDRAW; // Set 1 or 2 when th
|
294
|
302
|
const char* editLabel;
|
295
|
303
|
void* editValue;
|
296
|
304
|
int32_t minEditValue, maxEditValue;
|
297
|
|
-menuFunc_t prevMenu = NULL; // return here after editing (also prevEncoderPosition)
|
298
|
305
|
menuFunc_t callbackFunc; // call this after editing
|
299
|
306
|
|
300
|
307
|
// place-holders for Ki and Kd edits
|
|
@@ -302,6 +309,7 @@ float raw_Ki, raw_Kd;
|
302
|
309
|
|
303
|
310
|
/**
|
304
|
311
|
* General function to go directly to a menu
|
|
312
|
+ * Remembers the previous position
|
305
|
313
|
*/
|
306
|
314
|
static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const uint32_t encoder = 0) {
|
307
|
315
|
if (currentMenu != menu) {
|
|
@@ -311,26 +319,40 @@ static void lcd_goto_menu(menuFunc_t menu, const bool feedback = false, const ui
|
311
|
319
|
encoderPosition = encoder;
|
312
|
320
|
if (feedback) lcd_quick_feedback();
|
313
|
321
|
#endif
|
314
|
|
- // For LCD_PROGRESS_BAR re-initialize the custom characters
|
|
322
|
+ if (menu == lcd_status_screen) menu_history_depth = 0;
|
315
|
323
|
#if ENABLED(LCD_PROGRESS_BAR)
|
|
324
|
+ // For LCD_PROGRESS_BAR re-initialize custom characters
|
316
|
325
|
lcd_set_custom_characters(menu == lcd_status_screen);
|
317
|
326
|
#endif
|
318
|
327
|
}
|
319
|
328
|
}
|
320
|
329
|
|
321
|
|
-inline void lcd_save_previous_menu() {
|
322
|
|
- prevMenu = currentMenu;
|
323
|
|
- #if ENABLED(ULTIPANEL)
|
324
|
|
- prevEncoderPosition = encoderPosition;
|
325
|
|
- #endif
|
|
330
|
+static void lcd_return_to_status() {
|
|
331
|
+ defer_return_to_status = false;
|
|
332
|
+ lcd_goto_menu(lcd_status_screen);
|
326
|
333
|
}
|
327
|
334
|
|
328
|
|
-static void lcd_goto_previous_menu() {
|
329
|
|
- lcd_goto_menu(prevMenu, true
|
|
335
|
+inline void lcd_save_previous_menu() {
|
|
336
|
+ if (menu_history_depth < COUNT(menu_history)) {
|
|
337
|
+ menu_history[menu_history_depth].menu_function = currentMenu;
|
330
|
338
|
#if ENABLED(ULTIPANEL)
|
331
|
|
- , prevEncoderPosition
|
|
339
|
+ menu_history[menu_history_depth].encoder_position = encoderPosition;
|
332
|
340
|
#endif
|
333
|
|
- );
|
|
341
|
+ ++menu_history_depth;
|
|
342
|
+ }
|
|
343
|
+}
|
|
344
|
+
|
|
345
|
+static void lcd_goto_previous_menu(bool feedback=false) {
|
|
346
|
+ if (menu_history_depth > 0) {
|
|
347
|
+ --menu_history_depth;
|
|
348
|
+ lcd_goto_menu(menu_history[menu_history_depth].menu_function, feedback
|
|
349
|
+ #if ENABLED(ULTIPANEL)
|
|
350
|
+ , menu_history[menu_history_depth].encoder_position
|
|
351
|
+ #endif
|
|
352
|
+ );
|
|
353
|
+ }
|
|
354
|
+ else
|
|
355
|
+ lcd_return_to_status();
|
334
|
356
|
}
|
335
|
357
|
|
336
|
358
|
/**
|
|
@@ -439,9 +461,13 @@ static void lcd_status_screen() {
|
439
|
461
|
|
440
|
462
|
#if ENABLED(ULTIPANEL)
|
441
|
463
|
|
442
|
|
-static void lcd_return_to_status() {
|
443
|
|
- defer_return_to_status = false;
|
444
|
|
- lcd_goto_menu(lcd_status_screen);
|
|
464
|
+inline void line_to_current(AxisEnum axis) {
|
|
465
|
+ #if ENABLED(DELTA)
|
|
466
|
+ calculate_delta(current_position);
|
|
467
|
+ plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
|
|
468
|
+ #else
|
|
469
|
+ plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
|
|
470
|
+ #endif
|
445
|
471
|
}
|
446
|
472
|
|
447
|
473
|
#if ENABLED(SDSUPPORT)
|
|
@@ -469,7 +495,7 @@ static void lcd_return_to_status() {
|
469
|
495
|
|
470
|
496
|
static void lcd_main_menu() {
|
471
|
497
|
START_MENU();
|
472
|
|
- MENU_ITEM(back, MSG_WATCH, lcd_status_screen);
|
|
498
|
+ MENU_ITEM(back, MSG_WATCH);
|
473
|
499
|
if (movesplanned() || IS_SD_PRINTING) {
|
474
|
500
|
MENU_ITEM(submenu, MSG_TUNE, lcd_tune_menu);
|
475
|
501
|
}
|
|
@@ -508,13 +534,11 @@ static void lcd_main_menu() {
|
508
|
534
|
END_MENU();
|
509
|
535
|
}
|
510
|
536
|
|
511
|
|
-#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
|
512
|
|
- static void lcd_autostart_sd() {
|
513
|
|
- card.autostart_index = 0;
|
514
|
|
- card.setroot();
|
515
|
|
- card.checkautostart(true);
|
516
|
|
- }
|
517
|
|
-#endif
|
|
537
|
+/**
|
|
538
|
+ *
|
|
539
|
+ * "Tune" submenu items
|
|
540
|
+ *
|
|
541
|
+ */
|
518
|
542
|
|
519
|
543
|
/**
|
520
|
544
|
* Set the home offset based on the current_position
|
|
@@ -612,7 +636,7 @@ static void lcd_tune_menu() {
|
612
|
636
|
//
|
613
|
637
|
// ^ Main
|
614
|
638
|
//
|
615
|
|
- MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
|
639
|
+ MENU_ITEM(back, MSG_MAIN);
|
616
|
640
|
|
617
|
641
|
//
|
618
|
642
|
// Speed:
|
|
@@ -722,6 +746,11 @@ static void lcd_tune_menu() {
|
722
|
746
|
END_MENU();
|
723
|
747
|
}
|
724
|
748
|
|
|
749
|
+/**
|
|
750
|
+ *
|
|
751
|
+ * "Prepare" submenu items
|
|
752
|
+ *
|
|
753
|
+ */
|
725
|
754
|
void _lcd_preheat(int endnum, const float temph, const float tempb, const int fan) {
|
726
|
755
|
if (temph > 0) setTargetHotend(temph, endnum);
|
727
|
756
|
#if TEMP_SENSOR_BED != 0
|
|
@@ -778,7 +807,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
|
778
|
807
|
|
779
|
808
|
static void lcd_preheat_pla_menu() {
|
780
|
809
|
START_MENU();
|
781
|
|
- MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
|
810
|
+ MENU_ITEM(back, MSG_PREPARE);
|
782
|
811
|
#if EXTRUDERS == 1
|
783
|
812
|
MENU_ITEM(function, MSG_PREHEAT_PLA, lcd_preheat_pla0);
|
784
|
813
|
#else
|
|
@@ -800,7 +829,7 @@ void _lcd_preheat(int endnum, const float temph, const float tempb, const int fa
|
800
|
829
|
|
801
|
830
|
static void lcd_preheat_abs_menu() {
|
802
|
831
|
START_MENU();
|
803
|
|
- MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
|
832
|
+ MENU_ITEM(back, MSG_PREPARE);
|
804
|
833
|
#if EXTRUDERS == 1
|
805
|
834
|
MENU_ITEM(function, MSG_PREHEAT_ABS, lcd_preheat_abs0);
|
806
|
835
|
#else
|
|
@@ -830,6 +859,158 @@ void lcd_cooldown() {
|
830
|
859
|
lcd_return_to_status();
|
831
|
860
|
}
|
832
|
861
|
|
|
862
|
+#if ENABLED(SDSUPPORT) && ENABLED(MENU_ADDAUTOSTART)
|
|
863
|
+
|
|
864
|
+ static void lcd_autostart_sd() {
|
|
865
|
+ card.autostart_index = 0;
|
|
866
|
+ card.setroot();
|
|
867
|
+ card.checkautostart(true);
|
|
868
|
+ }
|
|
869
|
+
|
|
870
|
+#endif
|
|
871
|
+
|
|
872
|
+#if ENABLED(MANUAL_BED_LEVELING)
|
|
873
|
+
|
|
874
|
+ /**
|
|
875
|
+ *
|
|
876
|
+ * "Prepare" > "Bed Leveling" handlers
|
|
877
|
+ *
|
|
878
|
+ */
|
|
879
|
+
|
|
880
|
+ static int _lcd_level_bed_position;
|
|
881
|
+
|
|
882
|
+ /**
|
|
883
|
+ * MBL Wait for controller movement and clicks:
|
|
884
|
+ * - Movement adjusts the Z axis
|
|
885
|
+ * - Click saves the Z and goes to the next mesh point
|
|
886
|
+ */
|
|
887
|
+ static void _lcd_level_bed_procedure() {
|
|
888
|
+ static bool mbl_wait_for_move = false;
|
|
889
|
+ // Menu handlers may be called in a re-entrant fashion
|
|
890
|
+ // if they call st_synchronize or plan_buffer_line. So
|
|
891
|
+ // while waiting for a move we just ignore new input.
|
|
892
|
+ if (mbl_wait_for_move) {
|
|
893
|
+ lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
|
894
|
+ return;
|
|
895
|
+ }
|
|
896
|
+
|
|
897
|
+ ENCODER_DIRECTION_NORMAL();
|
|
898
|
+
|
|
899
|
+ // Encoder wheel adjusts the Z position
|
|
900
|
+ if (encoderPosition != 0 && movesplanned() <= 3) {
|
|
901
|
+ refresh_cmd_timeout();
|
|
902
|
+ current_position[Z_AXIS] += float((int)encoderPosition) * (MBL_Z_STEP);
|
|
903
|
+ if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
|
|
904
|
+ if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
|
|
905
|
+ encoderPosition = 0;
|
|
906
|
+ line_to_current(Z_AXIS);
|
|
907
|
+ lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
|
908
|
+ }
|
|
909
|
+
|
|
910
|
+ // Update on first display, then only on updates to Z position
|
|
911
|
+ if (lcdDrawUpdate) {
|
|
912
|
+ float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z;
|
|
913
|
+ lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001), '+'));
|
|
914
|
+ }
|
|
915
|
+
|
|
916
|
+ // We want subsequent calls, but don't force redraw
|
|
917
|
+ // Set here so it can be overridden by lcd_return_to_status below
|
|
918
|
+ lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
|
919
|
+
|
|
920
|
+ // Click sets the current Z and moves to the next position
|
|
921
|
+ static bool debounce_click = false;
|
|
922
|
+ if (LCD_CLICKED) {
|
|
923
|
+ if (!debounce_click) {
|
|
924
|
+ debounce_click = true; // ignore multiple "clicks" in a row
|
|
925
|
+ int ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS),
|
|
926
|
+ iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
|
|
927
|
+ if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
|
928
|
+ mbl.set_z(ix, iy, current_position[Z_AXIS]);
|
|
929
|
+ _lcd_level_bed_position++;
|
|
930
|
+ if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
|
|
931
|
+ lcd_return_to_status();
|
|
932
|
+ LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
|
|
933
|
+ #if HAS_BUZZER
|
|
934
|
+ buzz(200, 659);
|
|
935
|
+ buzz(200, 698);
|
|
936
|
+ #endif
|
|
937
|
+ current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
938
|
+ line_to_current(Z_AXIS);
|
|
939
|
+ st_synchronize();
|
|
940
|
+ mbl.active = 1;
|
|
941
|
+ enqueue_and_echo_commands_P(PSTR("G28"));
|
|
942
|
+ }
|
|
943
|
+ else {
|
|
944
|
+ #if ENABLED(NEWPANEL)
|
|
945
|
+ lcd_quick_feedback();
|
|
946
|
+ #endif
|
|
947
|
+ mbl_wait_for_move = true;
|
|
948
|
+ current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
949
|
+ line_to_current(Z_AXIS);
|
|
950
|
+ ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
|
|
951
|
+ iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
|
|
952
|
+ if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
|
953
|
+ current_position[X_AXIS] = mbl.get_x(ix);
|
|
954
|
+ current_position[Y_AXIS] = mbl.get_y(iy);
|
|
955
|
+ line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
|
956
|
+ st_synchronize();
|
|
957
|
+ mbl_wait_for_move = false;
|
|
958
|
+ encoderPosition = 0;
|
|
959
|
+ }
|
|
960
|
+ }
|
|
961
|
+ }
|
|
962
|
+ else {
|
|
963
|
+ debounce_click = false;
|
|
964
|
+ }
|
|
965
|
+ }
|
|
966
|
+
|
|
967
|
+ static void _lcd_level_bed_homing_done() {
|
|
968
|
+ if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING), NULL);
|
|
969
|
+ lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
|
970
|
+ if (LCD_CLICKED) {
|
|
971
|
+ current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
|
972
|
+ plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
|
973
|
+ current_position[X_AXIS] = MESH_MIN_X;
|
|
974
|
+ current_position[Y_AXIS] = MESH_MIN_Y;
|
|
975
|
+ line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
|
976
|
+ _lcd_level_bed_position = 0;
|
|
977
|
+ lcd_goto_menu(_lcd_level_bed_procedure);
|
|
978
|
+ }
|
|
979
|
+ }
|
|
980
|
+
|
|
981
|
+ /**
|
|
982
|
+ * MBL Move to mesh starting point
|
|
983
|
+ */
|
|
984
|
+ static void _lcd_level_bed_homing() {
|
|
985
|
+ if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
|
986
|
+ lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
|
987
|
+ if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])
|
|
988
|
+ lcd_goto_menu(_lcd_level_bed_homing_done);
|
|
989
|
+ }
|
|
990
|
+
|
|
991
|
+ /**
|
|
992
|
+ * MBL Continue Bed Leveling...
|
|
993
|
+ */
|
|
994
|
+ static void _lcd_level_bed_continue() {
|
|
995
|
+ defer_return_to_status = true;
|
|
996
|
+ axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
|
|
997
|
+ mbl.reset();
|
|
998
|
+ enqueue_and_echo_commands_P(PSTR("G28"));
|
|
999
|
+ lcd_goto_menu(_lcd_level_bed_homing);
|
|
1000
|
+ }
|
|
1001
|
+
|
|
1002
|
+ /**
|
|
1003
|
+ * MBL entry-point
|
|
1004
|
+ */
|
|
1005
|
+ static void lcd_level_bed() {
|
|
1006
|
+ START_MENU();
|
|
1007
|
+ MENU_ITEM(back, MSG_LEVEL_BED_CANCEL);
|
|
1008
|
+ MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
|
|
1009
|
+ END_MENU();
|
|
1010
|
+ }
|
|
1011
|
+
|
|
1012
|
+#endif // MANUAL_BED_LEVELING
|
|
1013
|
+
|
833
|
1014
|
/**
|
834
|
1015
|
*
|
835
|
1016
|
* "Prepare" submenu
|
|
@@ -842,7 +1023,7 @@ static void lcd_prepare_menu() {
|
842
|
1023
|
//
|
843
|
1024
|
// ^ Main
|
844
|
1025
|
//
|
845
|
|
- MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
|
1026
|
+ MENU_ITEM(back, MSG_MAIN);
|
846
|
1027
|
|
847
|
1028
|
//
|
848
|
1029
|
// Auto Home
|
|
@@ -918,7 +1099,7 @@ static void lcd_prepare_menu() {
|
918
|
1099
|
|
919
|
1100
|
static void lcd_delta_calibrate_menu() {
|
920
|
1101
|
START_MENU();
|
921
|
|
- MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
|
1102
|
+ MENU_ITEM(back, MSG_MAIN);
|
922
|
1103
|
MENU_ITEM(gcode, MSG_AUTO_HOME, PSTR("G28"));
|
923
|
1104
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_X, PSTR("G0 F8000 X-77.94 Y-45 Z0"));
|
924
|
1105
|
MENU_ITEM(gcode, MSG_DELTA_CALIBRATE_Y, PSTR("G0 F8000 X77.94 Y-45 Z0"));
|
|
@@ -929,15 +1110,6 @@ static void lcd_prepare_menu() {
|
929
|
1110
|
|
930
|
1111
|
#endif // DELTA_CALIBRATION_MENU
|
931
|
1112
|
|
932
|
|
-inline void line_to_current(AxisEnum axis) {
|
933
|
|
- #if ENABLED(DELTA)
|
934
|
|
- calculate_delta(current_position);
|
935
|
|
- plan_buffer_line(delta[X_AXIS], delta[Y_AXIS], delta[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
|
936
|
|
- #else
|
937
|
|
- plan_buffer_line(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS], manual_feedrate[axis]/60, active_extruder);
|
938
|
|
- #endif
|
939
|
|
-}
|
940
|
|
-
|
941
|
1113
|
/**
|
942
|
1114
|
*
|
943
|
1115
|
* "Prepare" > "Move Axis" submenu
|
|
@@ -1030,7 +1202,7 @@ static void lcd_move_e(
|
1030
|
1202
|
|
1031
|
1203
|
static void lcd_move_menu_axis() {
|
1032
|
1204
|
START_MENU();
|
1033
|
|
- MENU_ITEM(back, MSG_MOVE_AXIS, lcd_move_menu);
|
|
1205
|
+ MENU_ITEM(back, MSG_MOVE_AXIS);
|
1034
|
1206
|
MENU_ITEM(submenu, MSG_MOVE_X, lcd_move_x);
|
1035
|
1207
|
MENU_ITEM(submenu, MSG_MOVE_Y, lcd_move_y);
|
1036
|
1208
|
if (move_menu_scale < 10.0) {
|
|
@@ -1072,7 +1244,7 @@ static void lcd_move_menu_01mm() {
|
1072
|
1244
|
|
1073
|
1245
|
static void lcd_move_menu() {
|
1074
|
1246
|
START_MENU();
|
1075
|
|
- MENU_ITEM(back, MSG_PREPARE, lcd_prepare_menu);
|
|
1247
|
+ MENU_ITEM(back, MSG_PREPARE);
|
1076
|
1248
|
MENU_ITEM(submenu, MSG_MOVE_10MM, lcd_move_menu_10mm);
|
1077
|
1249
|
MENU_ITEM(submenu, MSG_MOVE_1MM, lcd_move_menu_1mm);
|
1078
|
1250
|
MENU_ITEM(submenu, MSG_MOVE_01MM, lcd_move_menu_01mm);
|
|
@@ -1088,7 +1260,7 @@ static void lcd_move_menu() {
|
1088
|
1260
|
|
1089
|
1261
|
static void lcd_control_menu() {
|
1090
|
1262
|
START_MENU();
|
1091
|
|
- MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
|
1263
|
+ MENU_ITEM(back, MSG_MAIN);
|
1092
|
1264
|
MENU_ITEM(submenu, MSG_TEMPERATURE, lcd_control_temperature_menu);
|
1093
|
1265
|
MENU_ITEM(submenu, MSG_MOTION, lcd_control_motion_menu);
|
1094
|
1266
|
MENU_ITEM(submenu, MSG_VOLUMETRIC, lcd_control_volumetric_menu);
|
|
@@ -1191,7 +1363,7 @@ static void lcd_control_temperature_menu() {
|
1191
|
1363
|
//
|
1192
|
1364
|
// ^ Control
|
1193
|
1365
|
//
|
1194
|
|
- MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
|
1366
|
+ MENU_ITEM(back, MSG_CONTROL);
|
1195
|
1367
|
|
1196
|
1368
|
//
|
1197
|
1369
|
// Nozzle:
|
|
@@ -1323,7 +1495,7 @@ static void lcd_control_temperature_menu() {
|
1323
|
1495
|
*/
|
1324
|
1496
|
static void lcd_control_temperature_preheat_pla_settings_menu() {
|
1325
|
1497
|
START_MENU();
|
1326
|
|
- MENU_ITEM(back, MSG_TEMPERATURE, lcd_control_temperature_menu);
|
|
1498
|
+ MENU_ITEM(back, MSG_TEMPERATURE);
|
1327
|
1499
|
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &plaPreheatFanSpeed, 0, 255);
|
1328
|
1500
|
#if TEMP_SENSOR_0 != 0
|
1329
|
1501
|
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &plaPreheatHotendTemp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
|
|
@@ -1344,7 +1516,7 @@ static void lcd_control_temperature_preheat_pla_settings_menu() {
|
1344
|
1516
|
*/
|
1345
|
1517
|
static void lcd_control_temperature_preheat_abs_settings_menu() {
|
1346
|
1518
|
START_MENU();
|
1347
|
|
- MENU_ITEM(back, MSG_TEMPERATURE, lcd_control_temperature_menu);
|
|
1519
|
+ MENU_ITEM(back, MSG_TEMPERATURE);
|
1348
|
1520
|
MENU_ITEM_EDIT(int3, MSG_FAN_SPEED, &absPreheatFanSpeed, 0, 255);
|
1349
|
1521
|
#if TEMP_SENSOR_0 != 0
|
1350
|
1522
|
MENU_ITEM_EDIT(int3, MSG_NOZZLE, &absPreheatHotendTemp, HEATER_0_MINTEMP, HEATER_0_MAXTEMP - 15);
|
|
@@ -1365,7 +1537,7 @@ static void lcd_control_temperature_preheat_abs_settings_menu() {
|
1365
|
1537
|
*/
|
1366
|
1538
|
static void lcd_control_motion_menu() {
|
1367
|
1539
|
START_MENU();
|
1368
|
|
- MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
|
1540
|
+ MENU_ITEM(back, MSG_CONTROL);
|
1369
|
1541
|
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
|
1370
|
1542
|
MENU_ITEM_EDIT(float32, MSG_ZPROBE_ZOFFSET, &zprobe_zoffset, Z_PROBE_OFFSET_RANGE_MIN, Z_PROBE_OFFSET_RANGE_MAX);
|
1371
|
1543
|
#endif
|
|
@@ -1418,7 +1590,7 @@ static void lcd_control_motion_menu() {
|
1418
|
1590
|
*/
|
1419
|
1591
|
static void lcd_control_volumetric_menu() {
|
1420
|
1592
|
START_MENU();
|
1421
|
|
- MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
|
1593
|
+ MENU_ITEM(back, MSG_CONTROL);
|
1422
|
1594
|
|
1423
|
1595
|
MENU_ITEM_EDIT_CALLBACK(bool, MSG_VOLUMETRIC_ENABLED, &volumetric_enabled, calculate_volumetric_multipliers);
|
1424
|
1596
|
|
|
@@ -1479,7 +1651,7 @@ static void lcd_control_volumetric_menu() {
|
1479
|
1651
|
#if ENABLED(FWRETRACT)
|
1480
|
1652
|
static void lcd_control_retract_menu() {
|
1481
|
1653
|
START_MENU();
|
1482
|
|
- MENU_ITEM(back, MSG_CONTROL, lcd_control_menu);
|
|
1654
|
+ MENU_ITEM(back, MSG_CONTROL);
|
1483
|
1655
|
MENU_ITEM_EDIT(bool, MSG_AUTORETRACT, &autoretract_enabled);
|
1484
|
1656
|
MENU_ITEM_EDIT(float52, MSG_CONTROL_RETRACT, &retract_length, 0, 100);
|
1485
|
1657
|
#if EXTRUDERS > 1
|
|
@@ -1520,7 +1692,7 @@ static void lcd_control_volumetric_menu() {
|
1520
|
1692
|
if (lcdDrawUpdate == 0 && LCD_CLICKED == 0) return; // nothing to do (so don't thrash the SD card)
|
1521
|
1693
|
uint16_t fileCnt = card.getnrfilenames();
|
1522
|
1694
|
START_MENU();
|
1523
|
|
- MENU_ITEM(back, MSG_MAIN, lcd_main_menu);
|
|
1695
|
+ MENU_ITEM(back, MSG_MAIN);
|
1524
|
1696
|
card.getWorkDirName();
|
1525
|
1697
|
if (card.filename[0] == '/') {
|
1526
|
1698
|
#if !PIN_EXISTS(SD_DETECT)
|
|
@@ -1589,7 +1761,7 @@ static void lcd_control_volumetric_menu() {
|
1589
|
1761
|
lcd_implementation_drawedit(editLabel, _strFunc(((_type)((int32_t)encoderPosition + minEditValue)) / scale)); \
|
1590
|
1762
|
if (isClicked) { \
|
1591
|
1763
|
*((_type*)editValue) = ((_type)((int32_t)encoderPosition + minEditValue)) / scale; \
|
1592
|
|
- lcd_goto_previous_menu(); \
|
|
1764
|
+ lcd_goto_previous_menu(true); \
|
1593
|
1765
|
} \
|
1594
|
1766
|
return isClicked; \
|
1595
|
1767
|
} \
|
|
@@ -1712,7 +1884,7 @@ void lcd_quick_feedback() {
|
1712
|
1884
|
* Menu actions
|
1713
|
1885
|
*
|
1714
|
1886
|
*/
|
1715
|
|
-static void menu_action_back(menuFunc_t func) { lcd_goto_menu(func); }
|
|
1887
|
+static void menu_action_back() { lcd_goto_previous_menu(); }
|
1716
|
1888
|
static void menu_action_submenu(menuFunc_t func) { lcd_save_previous_menu(); lcd_goto_menu(func); }
|
1717
|
1889
|
static void menu_action_gcode(const char* pgcode) { enqueue_and_echo_commands_P(pgcode); }
|
1718
|
1890
|
static void menu_action_function(menuFunc_t func) { (*func)(); }
|
|
@@ -2473,138 +2645,4 @@ char* ftostr52(const float& x) {
|
2473
|
2645
|
return conv;
|
2474
|
2646
|
}
|
2475
|
2647
|
|
2476
|
|
-#if ENABLED(MANUAL_BED_LEVELING)
|
2477
|
|
-
|
2478
|
|
- static int _lcd_level_bed_position;
|
2479
|
|
-
|
2480
|
|
- /**
|
2481
|
|
- * MBL Wait for controller movement and clicks:
|
2482
|
|
- * - Movement adjusts the Z axis
|
2483
|
|
- * - Click saves the Z and goes to the next mesh point
|
2484
|
|
- */
|
2485
|
|
- static void _lcd_level_bed_procedure() {
|
2486
|
|
- static bool mbl_wait_for_move = false;
|
2487
|
|
- // Menu handlers may be called in a re-entrant fashion
|
2488
|
|
- // if they call st_synchronize or plan_buffer_line. So
|
2489
|
|
- // while waiting for a move we just ignore new input.
|
2490
|
|
- if (mbl_wait_for_move) {
|
2491
|
|
- lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
2492
|
|
- return;
|
2493
|
|
- }
|
2494
|
|
-
|
2495
|
|
- ENCODER_DIRECTION_NORMAL();
|
2496
|
|
-
|
2497
|
|
- // Encoder wheel adjusts the Z position
|
2498
|
|
- if (encoderPosition != 0 && movesplanned() <= 3) {
|
2499
|
|
- refresh_cmd_timeout();
|
2500
|
|
- current_position[Z_AXIS] += float((int)encoderPosition) * (MBL_Z_STEP);
|
2501
|
|
- if (min_software_endstops) NOLESS(current_position[Z_AXIS], Z_MIN_POS);
|
2502
|
|
- if (max_software_endstops) NOMORE(current_position[Z_AXIS], Z_MAX_POS);
|
2503
|
|
- encoderPosition = 0;
|
2504
|
|
- line_to_current(Z_AXIS);
|
2505
|
|
- lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
2506
|
|
- }
|
2507
|
|
-
|
2508
|
|
- // Update on first display, then only on updates to Z position
|
2509
|
|
- if (lcdDrawUpdate) {
|
2510
|
|
- float v = current_position[Z_AXIS] - MESH_HOME_SEARCH_Z;
|
2511
|
|
- lcd_implementation_drawedit(PSTR(MSG_MOVE_Z), ftostr43(v + (v < 0 ? -0.0001 : 0.0001), '+'));
|
2512
|
|
- }
|
2513
|
|
-
|
2514
|
|
- // We want subsequent calls, but don't force redraw
|
2515
|
|
- // Set here so it can be overridden by lcd_return_to_status below
|
2516
|
|
- lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
2517
|
|
-
|
2518
|
|
- // Click sets the current Z and moves to the next position
|
2519
|
|
- static bool debounce_click = false;
|
2520
|
|
- if (LCD_CLICKED) {
|
2521
|
|
- if (!debounce_click) {
|
2522
|
|
- debounce_click = true; // ignore multiple "clicks" in a row
|
2523
|
|
- int ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS),
|
2524
|
|
- iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
|
2525
|
|
- if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
2526
|
|
- mbl.set_z(ix, iy, current_position[Z_AXIS]);
|
2527
|
|
- _lcd_level_bed_position++;
|
2528
|
|
- if (_lcd_level_bed_position == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS)) {
|
2529
|
|
- current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
2530
|
|
- mbl_wait_for_move = true;
|
2531
|
|
- line_to_current(Z_AXIS);
|
2532
|
|
- st_synchronize();
|
2533
|
|
- mbl.active = 1;
|
2534
|
|
- enqueue_and_echo_commands_P(PSTR("G28"));
|
2535
|
|
- mbl_wait_for_move = false;
|
2536
|
|
- lcd_return_to_status();
|
2537
|
|
- #if ENABLED(NEWPANEL)
|
2538
|
|
- lcd_quick_feedback();
|
2539
|
|
- #endif
|
2540
|
|
- LCD_ALERTMESSAGEPGM(MSG_LEVEL_BED_DONE);
|
2541
|
|
- #if HAS_BUZZER
|
2542
|
|
- buzz(200, 659);
|
2543
|
|
- buzz(200, 698);
|
2544
|
|
- #endif
|
2545
|
|
- }
|
2546
|
|
- else {
|
2547
|
|
- current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
2548
|
|
- line_to_current(Z_AXIS);
|
2549
|
|
- ix = _lcd_level_bed_position % (MESH_NUM_X_POINTS);
|
2550
|
|
- iy = _lcd_level_bed_position / (MESH_NUM_X_POINTS);
|
2551
|
|
- if (iy & 1) ix = (MESH_NUM_X_POINTS - 1) - ix; // Zig zag
|
2552
|
|
- current_position[X_AXIS] = mbl.get_x(ix);
|
2553
|
|
- current_position[Y_AXIS] = mbl.get_y(iy);
|
2554
|
|
- line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
2555
|
|
- }
|
2556
|
|
- }
|
2557
|
|
- }
|
2558
|
|
- else {
|
2559
|
|
- debounce_click = false;
|
2560
|
|
- }
|
2561
|
|
- }
|
2562
|
|
-
|
2563
|
|
- static void _lcd_level_bed_homing_done() {
|
2564
|
|
- if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_WAITING), NULL);
|
2565
|
|
- lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
2566
|
|
- if (LCD_CLICKED) {
|
2567
|
|
- current_position[Z_AXIS] = MESH_HOME_SEARCH_Z;
|
2568
|
|
- plan_set_position(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], current_position[E_AXIS]);
|
2569
|
|
- current_position[X_AXIS] = MESH_MIN_X;
|
2570
|
|
- current_position[Y_AXIS] = MESH_MIN_Y;
|
2571
|
|
- line_to_current(manual_feedrate[X_AXIS] <= manual_feedrate[Y_AXIS] ? X_AXIS : Y_AXIS);
|
2572
|
|
- _lcd_level_bed_position = 0;
|
2573
|
|
- lcd_goto_menu(_lcd_level_bed_procedure, true);
|
2574
|
|
- }
|
2575
|
|
- }
|
2576
|
|
-
|
2577
|
|
- /**
|
2578
|
|
- * MBL Move to mesh starting point
|
2579
|
|
- */
|
2580
|
|
- static void _lcd_level_bed_homing() {
|
2581
|
|
- if (lcdDrawUpdate) lcd_implementation_drawedit(PSTR(MSG_LEVEL_BED_HOMING), NULL);
|
2582
|
|
- lcdDrawUpdate = LCD_DRAW_UPDATE_CALL_NO_REDRAW;
|
2583
|
|
- if (axis_known_position[X_AXIS] && axis_known_position[Y_AXIS] && axis_known_position[Z_AXIS])
|
2584
|
|
- lcd_goto_menu(_lcd_level_bed_homing_done);
|
2585
|
|
- }
|
2586
|
|
-
|
2587
|
|
- /**
|
2588
|
|
- * MBL Continue Bed Leveling...
|
2589
|
|
- */
|
2590
|
|
- static void _lcd_level_bed_continue() {
|
2591
|
|
- defer_return_to_status = true;
|
2592
|
|
- axis_known_position[X_AXIS] = axis_known_position[Y_AXIS] = axis_known_position[Z_AXIS] = false;
|
2593
|
|
- mbl.reset();
|
2594
|
|
- enqueue_and_echo_commands_P(PSTR("G28"));
|
2595
|
|
- lcd_goto_menu(_lcd_level_bed_homing, true);
|
2596
|
|
- }
|
2597
|
|
-
|
2598
|
|
- /**
|
2599
|
|
- * MBL entry-point
|
2600
|
|
- */
|
2601
|
|
- static void lcd_level_bed() {
|
2602
|
|
- START_MENU();
|
2603
|
|
- MENU_ITEM(back, "Cancel", lcd_prepare_menu);
|
2604
|
|
- MENU_ITEM(submenu, MSG_LEVEL_BED, _lcd_level_bed_continue);
|
2605
|
|
- END_MENU();
|
2606
|
|
- }
|
2607
|
|
-
|
2608
|
|
-#endif // MANUAL_BED_LEVELING
|
2609
|
|
-
|
2610
|
2648
|
#endif // ULTRA_LCD
|