Skip to content

Commit

Permalink
Fix DELTA_CALIBRATION_MENU recursive call (#16656)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjasonsmith authored and thinkyhead committed Jan 26, 2020
1 parent 838a420 commit 95d5a0c
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/bedlevel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void reset_bed_level() {
current_position = pos;

#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_bl_move = false;
ui.wait_for_move = false;
#endif
}

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/bedlevel/abl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ G29_TYPE GcodeSuite::G29() {
set_bed_leveling_enabled(abl_should_enable);
g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_bl_move = false;
ui.wait_for_move = false;
#endif
}

Expand Down Expand Up @@ -810,7 +810,7 @@ G29_TYPE GcodeSuite::G29() {
#if ENABLED(PROBE_MANUALLY)
g29_in_progress = false;
#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_bl_move = false;
ui.wait_for_move = false;
#endif
#endif

Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/gcode/bedlevel/mbl/G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ void GcodeSuite::G29() {
case MeshStart:
mbl.reset();
mbl_probe_index = 0;
if (!ui.wait_for_bl_move) {
if (!ui.wait_for_move) {
queue.inject_P(PSTR("G28\nG29 S2"));
return;
}
Expand Down Expand Up @@ -148,7 +148,7 @@ void GcodeSuite::G29() {
#endif

#if ENABLED(LCD_BED_LEVELING)
ui.wait_for_bl_move = false;
ui.wait_for_move = false;
#endif
}
break;
Expand Down
10 changes: 4 additions & 6 deletions Marlin/src/lcd/menu/menu_bed_leveling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,6 @@
#endif
);

bool MarlinUI::wait_for_bl_move; // = false

//
// Bed leveling is done. Wait for G29 to complete.
// A flag is used so that this can release control
Expand All @@ -70,7 +68,7 @@
// ** This blocks the command queue! **
//
void _lcd_level_bed_done() {
if (!ui.wait_for_bl_move) {
if (!ui.wait_for_move) {
#if MANUAL_PROBE_HEIGHT > 0 && DISABLED(MESH_BED_LEVELING)
// Display "Done" screen and wait for moves to complete
line_to_z(MANUAL_PROBE_HEIGHT);
Expand Down Expand Up @@ -103,7 +101,7 @@
//
// The last G29 records the point and enables bed leveling
//
ui.wait_for_bl_move = true;
ui.wait_for_move = true;
ui.goto_screen(_lcd_level_bed_done);
#if ENABLED(MESH_BED_LEVELING)
queue.inject_P(PSTR("G29 S2"));
Expand Down Expand Up @@ -146,7 +144,7 @@
MenuEditItemBase::draw_edit_screen(GET_TEXT(MSG_LEVEL_BED_NEXT_POINT), msg);
}
ui.refresh(LCDVIEW_CALL_NO_REDRAW);
if (!ui.wait_for_bl_move) ui.goto_screen(_lcd_level_bed_get_z);
if (!ui.wait_for_move) ui.goto_screen(_lcd_level_bed_get_z);
}

//
Expand All @@ -156,7 +154,7 @@
ui.goto_screen(_lcd_level_bed_moving);

// G29 Records Z, moves, and signals when it pauses
ui.wait_for_bl_move = true;
ui.wait_for_move = true;
#if ENABLED(MESH_BED_LEVELING)
queue.inject_P(manual_probe_index ? PSTR("G29 S2") : PSTR("G29 S1"));
#elif ENABLED(PROBE_MANUALLY)
Expand Down
12 changes: 8 additions & 4 deletions Marlin/src/lcd/menu/menu_delta_calibrate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,14 @@
#endif

void _man_probe_pt(const xy_pos_t &xy) {
do_blocking_move_to_xy_z(xy, Z_CLEARANCE_BETWEEN_PROBES);
ui.synchronize();
move_menu_scale = _MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT));
ui.goto_screen(lcd_move_z);
if (!ui.wait_for_move) {
ui.wait_for_move = true;
do_blocking_move_to_xy_z(xy, Z_CLEARANCE_BETWEEN_PROBES);
ui.wait_for_move = false;
ui.synchronize();
move_menu_scale = _MAX(PROBE_MANUALLY_STEP, MIN_STEPS_PER_SEGMENT / float(DEFAULT_XYZ_STEPS_PER_UNIT));
ui.goto_screen(lcd_move_z);
}
}

#if ENABLED(DELTA_AUTO_CALIBRATION)
Expand Down
4 changes: 4 additions & 0 deletions Marlin/src/lcd/ultralcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,10 @@ MarlinUI ui;
#endif
#endif

#if LCD_HAS_WAIT_FOR_MOVE
bool MarlinUI::wait_for_move; // = false
#endif

#if HAS_SPI_LCD
#if ENABLED(STATUS_MESSAGE_SCROLLING)
uint8_t MarlinUI::status_scroll_offset; // = 0
Expand Down
8 changes: 5 additions & 3 deletions Marlin/src/lcd/ultralcd.h
Original file line number Diff line number Diff line change
Expand Up @@ -532,10 +532,12 @@ class MarlinUI {

#endif

#if ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING)
static bool wait_for_bl_move;
#define LCD_HAS_WAIT_FOR_MOVE EITHER(DELTA_CALIBRATION_MENU, DELTA_AUTO_CALIBRATION) || (ENABLED(LCD_BED_LEVELING) && EITHER(PROBE_MANUALLY, MESH_BED_LEVELING))

#if LCD_HAS_WAIT_FOR_MOVE
static bool wait_for_move;
#else
static constexpr bool wait_for_bl_move = false;
static constexpr bool wait_for_move = false;
#endif

#if HAS_LCD_MENU && EITHER(AUTO_BED_LEVELING_UBL, G26_MESH_VALIDATION)
Expand Down

0 comments on commit 95d5a0c

Please sign in to comment.