From c241adec5f732a6592f3899dbd8fc5c871dec426 Mon Sep 17 00:00:00 2001 From: Yuri D'Elia Date: Tue, 16 Jul 2019 16:17:52 +0200 Subject: [PATCH] Ensure babystep_apply|undo always uses the planner The code around these calls _requires_ that the steps are immediately processed and/or added to the subsequent planner moves. The only part that doesn't care about immediate insertion is the direct user-insertion though the lcd encoder. --- Firmware/Marlin_main.cpp | 6 ++---- Firmware/mesh_bed_calibration.cpp | 10 ---------- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Firmware/Marlin_main.cpp b/Firmware/Marlin_main.cpp index d5b4ff106..fc470f604 100755 --- a/Firmware/Marlin_main.cpp +++ b/Firmware/Marlin_main.cpp @@ -2722,8 +2722,7 @@ static void gcode_G28(bool home_x_axis, long home_x_value, bool home_y_axis, lon current_position[Z_AXIS] = st_get_position_mm(Z_AXIS); #endif - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. + // Reset baby stepping to zero, if the babystepping has already been loaded before. if (home_z) babystep_undo(); @@ -5161,8 +5160,7 @@ if(eSoundMode!=e_SOUND_MODE_SILENT) mbl.reset(); //reset mesh bed leveling - // Reset baby stepping to zero, if the babystepping has already been loaded before. The babystepsTodo value will be - // consumed during the first movements following this statement. + // Reset baby stepping to zero, if the babystepping has already been loaded before. babystep_undo(); // Cycle through all points and probe them diff --git a/Firmware/mesh_bed_calibration.cpp b/Firmware/mesh_bed_calibration.cpp index fb79022ff..b4490e93f 100644 --- a/Firmware/mesh_bed_calibration.cpp +++ b/Firmware/mesh_bed_calibration.cpp @@ -3030,8 +3030,6 @@ static void shift_z(float delta) plan_set_z_position(current_position[Z_AXIS]); } -#define BABYSTEP_LOADZ_BY_PLANNER - // Number of baby steps applied static int babystepLoadZ = 0; @@ -3062,20 +3060,12 @@ void babystep_load() void babystep_apply() { babystep_load(); -#ifdef BABYSTEP_LOADZ_BY_PLANNER shift_z(- float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS])); -#else - babystepsTodoZadd(babystepLoadZ); -#endif /* BABYSTEP_LOADZ_BY_PLANNER */ } void babystep_undo() { -#ifdef BABYSTEP_LOADZ_BY_PLANNER shift_z(float(babystepLoadZ) / float(cs.axis_steps_per_unit[Z_AXIS])); -#else - babystepsTodoZsubtract(babystepLoadZ); -#endif /* BABYSTEP_LOADZ_BY_PLANNER */ babystepLoadZ = 0; }