|
@@ -390,7 +390,7 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
|
390
|
390
|
bool screen_changed;
|
391
|
391
|
|
392
|
392
|
// LCD and menu clicks
|
393
|
|
- bool lcd_clicked, wait_for_unclick, defer_return_to_status;
|
|
393
|
+ bool lcd_clicked, wait_for_unclick, defer_return_to_status, no_reentrance;
|
394
|
394
|
|
395
|
395
|
// Variables used when editing values.
|
396
|
396
|
const char* editLabel;
|
|
@@ -422,6 +422,27 @@ uint8_t lcdDrawUpdate = LCDVIEW_CLEAR_CALL_REDRAW; // Set when the LCD needs to
|
422
|
422
|
}
|
423
|
423
|
}
|
424
|
424
|
|
|
425
|
+ /**
|
|
426
|
+ * Synchronize safely while holding the current screen
|
|
427
|
+ * This blocks all further screen or stripe updates once called
|
|
428
|
+ */
|
|
429
|
+ inline void lcd_synchronize() {
|
|
430
|
+ lcd_implementation_drawmenu_static(LCD_HEIGHT >= 4 ? 1 : 0, PSTR(MSG_MOVING));
|
|
431
|
+ if (no_reentrance) return;
|
|
432
|
+ no_reentrance = true;
|
|
433
|
+ screenFunc_t old_screen = currentScreen;
|
|
434
|
+ lcd_goto_screen(lcd_synchronize);
|
|
435
|
+ stepper.synchronize();
|
|
436
|
+ no_reentrance = false;
|
|
437
|
+ lcd_goto_screen(old_screen);
|
|
438
|
+ }
|
|
439
|
+
|
|
440
|
+ inline void lcd_wait_for_homing() {
|
|
441
|
+ no_reentrance = true;
|
|
442
|
+ while (!axis_homed[X_AXIS] || !axis_homed[Y_AXIS] || !axis_homed[Z_AXIS]) idle();
|
|
443
|
+ no_reentrance = true;
|
|
444
|
+ }
|
|
445
|
+
|
425
|
446
|
void lcd_return_to_status() { lcd_goto_screen(lcd_status_screen); }
|
426
|
447
|
|
427
|
448
|
void lcd_save_previous_screen() {
|
|
@@ -1063,6 +1084,7 @@ void kill_screen(const char* lcd_msg) {
|
1063
|
1084
|
// Note: During Manual Bed Leveling the homed Z position is MESH_HOME_SEARCH_Z
|
1064
|
1085
|
// Z position will be restored with the final action, a G28
|
1065
|
1086
|
inline void _mbl_goto_xy(float x, float y) {
|
|
1087
|
+ if (no_reentrance) return;
|
1066
|
1088
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT);
|
1067
|
1089
|
line_to_current(Z_AXIS);
|
1068
|
1090
|
current_position[X_AXIS] = LOGICAL_X_POSITION(x);
|
|
@@ -1072,7 +1094,7 @@ void kill_screen(const char* lcd_msg) {
|
1072
|
1094
|
current_position[Z_AXIS] = LOGICAL_Z_POSITION(MESH_HOME_SEARCH_Z);
|
1073
|
1095
|
line_to_current(Z_AXIS);
|
1074
|
1096
|
#endif
|
1075
|
|
- stepper.synchronize();
|
|
1097
|
+ lcd_synchronize();
|
1076
|
1098
|
}
|
1077
|
1099
|
|
1078
|
1100
|
void _lcd_level_goto_next_point();
|
|
@@ -1094,6 +1116,8 @@ void kill_screen(const char* lcd_msg) {
|
1094
|
1116
|
void _lcd_level_bed_get_z() {
|
1095
|
1117
|
ENCODER_DIRECTION_NORMAL();
|
1096
|
1118
|
|
|
1119
|
+ if (no_reentrance) goto KeepDrawing;
|
|
1120
|
+
|
1097
|
1121
|
// Encoder wheel adjusts the Z position
|
1098
|
1122
|
if (encoderPosition) {
|
1099
|
1123
|
refresh_cmd_timeout();
|
|
@@ -1121,7 +1145,7 @@ void kill_screen(const char* lcd_msg) {
|
1121
|
1145
|
|
1122
|
1146
|
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z + Z_HOMING_HEIGHT;
|
1123
|
1147
|
line_to_current(Z_AXIS);
|
1124
|
|
- stepper.synchronize();
|
|
1148
|
+ lcd_synchronize();
|
1125
|
1149
|
|
1126
|
1150
|
mbl.set_has_mesh(true);
|
1127
|
1151
|
enqueue_and_echo_commands_P(PSTR("G28"));
|
|
@@ -1141,6 +1165,7 @@ void kill_screen(const char* lcd_msg) {
|
1141
|
1165
|
debounce_click = false;
|
1142
|
1166
|
}
|
1143
|
1167
|
|
|
1168
|
+KeepDrawing:
|
1144
|
1169
|
// Update on first display, then only on updates to Z position
|
1145
|
1170
|
// Show message above on clicks instead
|
1146
|
1171
|
if (lcdDrawUpdate) {
|
|
@@ -1215,8 +1240,9 @@ void kill_screen(const char* lcd_msg) {
|
1215
|
1240
|
LCDVIEW_CALL_NO_REDRAW
|
1216
|
1241
|
#endif
|
1217
|
1242
|
;
|
1218
|
|
- if (axis_homed[X_AXIS] && axis_homed[Y_AXIS] && axis_homed[Z_AXIS])
|
1219
|
|
- lcd_goto_screen(_lcd_level_bed_homing_done);
|
|
1243
|
+ if (no_reentrance) return;
|
|
1244
|
+ lcd_wait_for_homing();
|
|
1245
|
+ lcd_goto_screen(_lcd_level_bed_homing_done);
|
1220
|
1246
|
}
|
1221
|
1247
|
|
1222
|
1248
|
/**
|