Browse Source

Use st_get_position_mm where possible (PR#2411)

pull/1/head
Scott Lahteine 9 years ago
committed by Richard Wackerbarth
parent
commit
87a872e103
  1. 8
      Marlin/Marlin_main.cpp
  2. 8
      Marlin/stepper.cpp
  3. 6
      Marlin/stepper.h

8
Marlin/Marlin_main.cpp

@ -2852,7 +2852,7 @@ inline void gcode_G28() {
float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER, float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER, y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
z_tmp = current_position[Z_AXIS], 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 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 //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_PROTOCOL(current_position[E_AXIS]);
SERIAL_PROTOCOLPGM(MSG_COUNT_X); 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_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_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; SERIAL_EOL;

8
Marlin/stepper.cpp

@ -1073,13 +1073,7 @@ long st_get_position(uint8_t axis) {
return count_pos; 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]; }
float st_get_position_mm(AxisEnum axis) {
return st_get_position(axis) / axis_steps_per_unit[axis];
}
#endif // ENABLE_AUTO_BED_LEVELING
void finishAndDisableSteppers() { void finishAndDisableSteppers() {
st_synchronize(); st_synchronize();

6
Marlin/stepper.h

@ -66,10 +66,8 @@ void st_set_e_position(const long &e);
// Get current position in steps // Get current position in steps
long st_get_position(uint8_t axis); long st_get_position(uint8_t axis);
#ifdef ENABLE_AUTO_BED_LEVELING // Get current position in mm
// Get current position in mm float st_get_position_mm(AxisEnum axis);
float st_get_position_mm(AxisEnum axis);
#endif
// The stepper subsystem goes to sleep when it runs out of things to execute. Call this // 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. // to notify the subsystem that it is time to go to work.

Loading…
Cancel
Save