@@ -309,7 +309,7 @@ void unified_bed_leveling::G29() {
309
309
#if ALL(DWIN_LCD_PROUI, ZHOME_BEFORE_LEVELING)
310
310
save_ubl_active_state_and_disable ();
311
311
gcode.process_subcommands_now (F (" G28Z" ));
312
- restore_ubl_active_state_and_leave ();
312
+ restore_ubl_active_state ( false ); // ...without telling ExtUI "done"
313
313
#else
314
314
// Send 'N' to force homing before G29 (internal only)
315
315
if (axes_should_home () || parser.seen_test (' N' )) gcode.home_all_axes ();
@@ -425,7 +425,7 @@ void unified_bed_leveling::G29() {
425
425
if (parser.seen_test (' J' )) {
426
426
save_ubl_active_state_and_disable ();
427
427
tilt_mesh_based_on_probed_grid (param.J_grid_size == 0 ); // Zero size does 3-Point
428
- restore_ubl_active_state_and_leave ();
428
+ restore_ubl_active_state ();
429
429
#if ENABLED(UBL_G29_J_RECENTER)
430
430
do_blocking_move_to_xy (0 .5f * ((MESH_MIN_X) + (MESH_MAX_X)), 0 .5f * ((MESH_MIN_Y) + (MESH_MAX_Y)));
431
431
#endif
@@ -754,7 +754,6 @@ void unified_bed_leveling::shift_mesh_height() {
754
754
755
755
TERN_ (HAS_MARLINUI_MENU, ui.capture ());
756
756
TERN_ (EXTENSIBLE_UI, ExtUI::onLevelingStart ());
757
- TERN_ (DWIN_LCD_PROUI, dwinLevelingStart ());
758
757
759
758
save_ubl_active_state_and_disable (); // No bed level correction so only raw data is obtained
760
759
grid_count_t count = GRID_MAX_POINTS;
@@ -768,7 +767,6 @@ void unified_bed_leveling::shift_mesh_height() {
768
767
SERIAL_ECHOLNPGM (" Probing mesh point " , point_num, " /" , GRID_MAX_POINTS, " ." );
769
768
TERN_ (HAS_STATUS_MESSAGE, ui.status_printf (0 , F (S_FMT " %i/%i" ), GET_TEXT (MSG_PROBING_POINT), point_num, int (GRID_MAX_POINTS)));
770
769
TERN_ (HAS_BACKLIGHT_TIMEOUT, ui.refresh_backlight_timeout ());
771
- TERN_ (DWIN_LCD_PROUI, dwinRedrawScreen ());
772
770
773
771
#if HAS_MARLINUI_MENU
774
772
if (ui.button_pressed ()) {
@@ -778,8 +776,7 @@ void unified_bed_leveling::shift_mesh_height() {
778
776
ui.quick_feedback ();
779
777
ui.release ();
780
778
probe.stow (); // Release UI before stow to allow for PAUSE_BEFORE_DEPLOY_STOW
781
- TERN_ (EXTENSIBLE_UI, ExtUI::onLevelingDone ());
782
- return restore_ubl_active_state_and_leave ();
779
+ return restore_ubl_active_state ();
783
780
}
784
781
#endif
785
782
@@ -815,15 +812,12 @@ void unified_bed_leveling::shift_mesh_height() {
815
812
816
813
probe.move_z_after_probing ();
817
814
818
- restore_ubl_active_state_and_leave ();
819
-
820
815
do_blocking_move_to_xy (
821
816
constrain (nearby.x - probe.offset_xy .x , MESH_MIN_X, MESH_MAX_X),
822
817
constrain (nearby.y - probe.offset_xy .y , MESH_MIN_Y, MESH_MAX_Y)
823
818
);
824
819
825
- TERN_ (EXTENSIBLE_UI, ExtUI::onLevelingDone ());
826
- TERN_ (DWIN_LCD_PROUI, dwinLevelingDone ());
820
+ restore_ubl_active_state ();
827
821
}
828
822
829
823
#endif // HAS_BED_PROBE
@@ -932,7 +926,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
932
926
if (param.V_verbosity > 1 )
933
927
SERIAL_ECHOLNPGM (" Business Card is " , p_float_t (thickness, 4 ), " mm thick." );
934
928
935
- restore_ubl_active_state_and_leave ();
929
+ restore_ubl_active_state ();
936
930
937
931
return thickness;
938
932
}
@@ -987,7 +981,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
987
981
if (_click_and_hold ([]{
988
982
SERIAL_ECHOLNPGM (" \n Mesh only partially populated." );
989
983
do_z_clearance (Z_CLEARANCE_DEPLOY_PROBE);
990
- })) return restore_ubl_active_state_and_leave ();
984
+ })) return restore_ubl_active_state ();
991
985
992
986
// Store the Z position minus the shim height
993
987
z_values[lpos.x ][lpos.y ] = current_position.z - thick;
@@ -1002,10 +996,8 @@ void set_message_with_feedback(FSTR_P const fstr) {
1002
996
1003
997
if (do_ubl_mesh_map) display_map (param.T_map_type ); // show user where we're probing
1004
998
1005
- restore_ubl_active_state_and_leave ();
999
+ restore_ubl_active_state ();
1006
1000
do_blocking_move_to_xy_z (pos, Z_CLEARANCE_DEPLOY_PROBE);
1007
-
1008
- TERN_ (EXTENSIBLE_UI, ExtUI::onLevelingDone ());
1009
1001
}
1010
1002
1011
1003
/* *
@@ -1111,7 +1103,7 @@ void set_message_with_feedback(FSTR_P const fstr) {
1111
1103
} while (lpos.x >= 0 && --param.R_repetition > 0 );
1112
1104
1113
1105
if (do_ubl_mesh_map) display_map (param.T_map_type );
1114
- restore_ubl_active_state_and_leave ();
1106
+ restore_ubl_active_state ();
1115
1107
1116
1108
do_blocking_move_to_xy_z (pos, Z_TWEEN_SAFE_CLEARANCE);
1117
1109
@@ -1263,17 +1255,20 @@ void unified_bed_leveling::save_ubl_active_state_and_disable() {
1263
1255
set_bed_leveling_enabled (false );
1264
1256
}
1265
1257
1266
- void unified_bed_leveling::restore_ubl_active_state_and_leave ( ) {
1258
+ void unified_bed_leveling::restore_ubl_active_state ( const bool is_done /* =true */ ) {
1267
1259
TERN_ (HAS_MARLINUI_MENU, ui.release ());
1268
1260
#if ENABLED(UBL_DEVEL_DEBUGGING)
1269
1261
if (--ubl_state_recursion_chk) {
1270
- SERIAL_ECHOLNPGM (" restore_ubl_active_state_and_leave () called too many times." );
1262
+ SERIAL_ECHOLNPGM (" restore_ubl_active_state () called too many times." );
1271
1263
set_message_with_feedback (GET_TEXT_F (MSG_UBL_RESTORE_ERROR));
1272
1264
return ;
1273
1265
}
1274
1266
#endif
1275
1267
set_bed_leveling_enabled (ubl_state_at_invocation);
1276
- TERN_ (EXTENSIBLE_UI, ExtUI::onLevelingDone ());
1268
+
1269
+ if (is_done) {
1270
+ TERN_ (EXTENSIBLE_UI, ExtUI::onLevelingDone ());
1271
+ }
1277
1272
}
1278
1273
1279
1274
mesh_index_pair unified_bed_leveling::find_furthest_invalid_mesh_point () {
0 commit comments