Unify reset_bed_level for linear/non-linear

2.0.x
Scott Lahteine 8 years ago
parent 41d8149bce
commit 4f75ce6957

@ -220,7 +220,6 @@ void disable_all_steppers();
void FlushSerialRequestResend(); void FlushSerialRequestResend();
void ok_to_send(); void ok_to_send();
void reset_bed_level();
void kill(const char*); void kill(const char*);
void quickstop_stepper(); void quickstop_stepper();

@ -1955,10 +1955,6 @@ static void clean_up_after_endstop_or_probe_move() {
// Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding // Prevent stepper_inactive_time from running out and EXTRUDER_RUNOUT_PREVENT from extruding
refresh_cmd_timeout(); refresh_cmd_timeout();
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
planner.bed_level_matrix.set_to_identity();
#endif
#if ENABLED(PROBE_DOUBLE_TOUCH) #if ENABLED(PROBE_DOUBLE_TOUCH)
// Do a first probe at the fast speed // Do a first probe at the fast speed
@ -2152,6 +2148,8 @@ static void clean_up_after_endstop_or_probe_move() {
} }
} }
#endif // DELTA
/** /**
* Reset calibration results to zero. * Reset calibration results to zero.
*/ */
@ -2159,15 +2157,14 @@ static void clean_up_after_endstop_or_probe_move() {
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("reset_bed_level"); if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("reset_bed_level");
#endif #endif
for (int y = 0; y < AUTO_BED_LEVELING_GRID_POINTS; y++) { #if ENABLED(AUTO_BED_LEVELING_LINEAR)
for (int x = 0; x < AUTO_BED_LEVELING_GRID_POINTS; x++) { planner.bed_level_matrix.set_to_identity();
bed_level_grid[x][y] = 0.0; #elif ENABLED(AUTO_BED_LEVELING_NONLINEAR)
} memset(bed_level_grid, 0, sizeof(bed_level_grid));
} nonlinear_grid_spacing[X_AXIS] = nonlinear_grid_spacing[Y_AXIS] = 0;
#endif
} }
#endif // DELTA
#endif // AUTO_BED_LEVELING_FEATURE #endif // AUTO_BED_LEVELING_FEATURE
/** /**
@ -2848,11 +2845,7 @@ inline void gcode_G28() {
stepper.synchronize(); stepper.synchronize();
// For auto bed leveling, clear the level matrix // For auto bed leveling, clear the level matrix
#if ENABLED(AUTO_BED_LEVELING_LINEAR) #if ENABLED(AUTO_BED_LEVELING_FEATURE)
planner.bed_level_matrix.set_to_identity();
#endif
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
reset_bed_level(); reset_bed_level();
#endif #endif
@ -3396,11 +3389,9 @@ inline void gcode_G28() {
if (!dryrun) { if (!dryrun) {
#if ENABLED(AUTO_BED_LEVELING_LINEAR)
// Reset the bed_level_matrix because leveling // Reset the bed_level_matrix because leveling
// needs to be done without leveling enabled. // needs to be done without leveling enabled.
planner.bed_level_matrix.set_to_identity(); reset_bed_level();
#endif
// //
// Re-orient the current position without leveling // Re-orient the current position without leveling
@ -3408,10 +3399,6 @@ inline void gcode_G28() {
// //
#if IS_KINEMATIC #if IS_KINEMATIC
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
reset_bed_level();
#endif
// For DELTA/SCARA we need to apply forward kinematics. // For DELTA/SCARA we need to apply forward kinematics.
// This returns raw positions and we remap to the space. // This returns raw positions and we remap to the space.
get_cartesian_from_steppers(); get_cartesian_from_steppers();
@ -3757,6 +3744,10 @@ inline void gcode_G28() {
*/ */
inline void gcode_G30() { inline void gcode_G30() {
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
reset_bed_level();
#endif
setup_for_endstop_or_probe_move(); setup_for_endstop_or_probe_move();
// TODO: clear the leveling matrix or the planner will be set incorrectly // TODO: clear the leveling matrix or the planner will be set incorrectly
@ -4199,12 +4190,9 @@ inline void gcode_M42() {
if (verbose_level > 2) if (verbose_level > 2)
SERIAL_PROTOCOLLNPGM("Positioning the probe..."); SERIAL_PROTOCOLLNPGM("Positioning the probe...");
#if ENABLED(AUTO_BED_LEVELING_NONLINEAR)
// we don't do bed level correction in M48 because we want the raw data when we probe // we don't do bed level correction in M48 because we want the raw data when we probe
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
reset_bed_level(); reset_bed_level();
#elif ENABLED(AUTO_BED_LEVELING_LINEAR)
// we don't do bed level correction in M48 because we want the raw data when we probe
planner.bed_level_matrix.set_to_identity();
#endif #endif
setup_for_endstop_or_probe_move(); setup_for_endstop_or_probe_move();

Loading…
Cancel
Save