From 87a872e1032f3531dac9c1c7b51d7b2d62869474 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Thu, 9 Jul 2015 20:43:09 -0700 Subject: [PATCH] Use st_get_position_mm where possible (PR#2411) --- Marlin/Marlin_main.cpp | 8 ++++---- Marlin/stepper.cpp | 8 +------- Marlin/stepper.h | 6 ++---- 3 files changed, 7 insertions(+), 15 deletions(-) diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 3afaf1b2ec..8fdefc4a35 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -2852,7 +2852,7 @@ inline void gcode_G28() { float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER, y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER, z_tmp = current_position[Z_AXIS], - real_z = (float)st_get_position(Z_AXIS) / axis_steps_per_unit[Z_AXIS]; //get the real Z (since the auto bed leveling is already correcting the plane) + real_z = st_get_position_mm(Z_AXIS); //get the real Z (since the auto bed leveling is already correcting the plane) apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); // Apply the correction sending the probe offset //line below controls z probe offset, zprobe_zoffset is the actual offset that can be modified via m851 or is read from EEPROM @@ -3909,11 +3909,11 @@ inline void gcode_M114() { SERIAL_PROTOCOL(current_position[E_AXIS]); SERIAL_PROTOCOLPGM(MSG_COUNT_X); - SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]); + SERIAL_PROTOCOL(st_get_position_mm(X_AXIS)); SERIAL_PROTOCOLPGM(" Y:"); - SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]); + SERIAL_PROTOCOL(st_get_position_mm(Y_AXIS)); SERIAL_PROTOCOLPGM(" Z:"); - SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]); + SERIAL_PROTOCOL(st_get_position_mm(Z_AXIS)); SERIAL_EOL; diff --git a/Marlin/stepper.cpp b/Marlin/stepper.cpp index 96c8afec2e..c9a0ed3cd1 100644 --- a/Marlin/stepper.cpp +++ b/Marlin/stepper.cpp @@ -1073,13 +1073,7 @@ long st_get_position(uint8_t axis) { return count_pos; } -#ifdef ENABLE_AUTO_BED_LEVELING - - float st_get_position_mm(AxisEnum axis) { - return st_get_position(axis) / axis_steps_per_unit[axis]; - } - -#endif // ENABLE_AUTO_BED_LEVELING +float st_get_position_mm(AxisEnum axis) { return st_get_position(axis) / axis_steps_per_unit[axis]; } void finishAndDisableSteppers() { st_synchronize(); diff --git a/Marlin/stepper.h b/Marlin/stepper.h index 15d814332f..3fd2e4c25e 100644 --- a/Marlin/stepper.h +++ b/Marlin/stepper.h @@ -66,10 +66,8 @@ void st_set_e_position(const long &e); // Get current position in steps long st_get_position(uint8_t axis); -#ifdef ENABLE_AUTO_BED_LEVELING - // Get current position in mm - float st_get_position_mm(AxisEnum axis); -#endif +// Get current position in mm +float st_get_position_mm(AxisEnum axis); // The stepper subsystem goes to sleep when it runs out of things to execute. Call this // to notify the subsystem that it is time to go to work.