Browse Source

Use st_get_position_mm where possible (PR#2411)

Scott Lahteine 10 years ago
parent
commit
87a872e103
3 changed files with 7 additions and 15 deletions
  1. 4
    4
      Marlin/Marlin_main.cpp
  2. 1
    7
      Marlin/stepper.cpp
  3. 2
    4
      Marlin/stepper.h

+ 4
- 4
Marlin/Marlin_main.cpp View File

2852
         float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
2852
         float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
2853
               y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
2853
               y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
2854
               z_tmp = current_position[Z_AXIS],
2854
               z_tmp = current_position[Z_AXIS],
2855
-              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)
2855
+              real_z = st_get_position_mm(Z_AXIS);  //get the real Z (since the auto bed leveling is already correcting the plane)
2856
 
2856
 
2857
         apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); // Apply the correction sending the probe offset
2857
         apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); // Apply the correction sending the probe offset
2858
         //line below controls z probe offset, zprobe_zoffset is the actual offset that can be modified via m851 or is read from EEPROM
2858
         //line below controls z probe offset, zprobe_zoffset is the actual offset that can be modified via m851 or is read from EEPROM
3909
   SERIAL_PROTOCOL(current_position[E_AXIS]);
3909
   SERIAL_PROTOCOL(current_position[E_AXIS]);
3910
 
3910
 
3911
   SERIAL_PROTOCOLPGM(MSG_COUNT_X);
3911
   SERIAL_PROTOCOLPGM(MSG_COUNT_X);
3912
-  SERIAL_PROTOCOL(float(st_get_position(X_AXIS))/axis_steps_per_unit[X_AXIS]);
3912
+  SERIAL_PROTOCOL(st_get_position_mm(X_AXIS));
3913
   SERIAL_PROTOCOLPGM(" Y:");
3913
   SERIAL_PROTOCOLPGM(" Y:");
3914
-  SERIAL_PROTOCOL(float(st_get_position(Y_AXIS))/axis_steps_per_unit[Y_AXIS]);
3914
+  SERIAL_PROTOCOL(st_get_position_mm(Y_AXIS));
3915
   SERIAL_PROTOCOLPGM(" Z:");
3915
   SERIAL_PROTOCOLPGM(" Z:");
3916
-  SERIAL_PROTOCOL(float(st_get_position(Z_AXIS))/axis_steps_per_unit[Z_AXIS]);
3916
+  SERIAL_PROTOCOL(st_get_position_mm(Z_AXIS));
3917
 
3917
 
3918
   SERIAL_EOL;
3918
   SERIAL_EOL;
3919
 
3919
 

+ 1
- 7
Marlin/stepper.cpp View File

1073
   return count_pos;
1073
   return count_pos;
1074
 }
1074
 }
1075
 
1075
 
1076
-#ifdef ENABLE_AUTO_BED_LEVELING
1077
-
1078
-  float st_get_position_mm(AxisEnum axis) {
1079
-    return st_get_position(axis) / axis_steps_per_unit[axis];
1080
-  }
1081
-
1082
-#endif  // ENABLE_AUTO_BED_LEVELING
1076
+float st_get_position_mm(AxisEnum axis) { return st_get_position(axis) / axis_steps_per_unit[axis]; }
1083
 
1077
 
1084
 void finishAndDisableSteppers() {
1078
 void finishAndDisableSteppers() {
1085
   st_synchronize();
1079
   st_synchronize();

+ 2
- 4
Marlin/stepper.h View File

66
 // Get current position in steps
66
 // Get current position in steps
67
 long st_get_position(uint8_t axis);
67
 long st_get_position(uint8_t axis);
68
 
68
 
69
-#ifdef ENABLE_AUTO_BED_LEVELING
70
-  // Get current position in mm
71
-  float st_get_position_mm(AxisEnum axis);
72
-#endif
69
+// Get current position in mm
70
+float st_get_position_mm(AxisEnum axis);
73
 
71
 
74
 // The stepper subsystem goes to sleep when it runs out of things to execute. Call this
72
 // The stepper subsystem goes to sleep when it runs out of things to execute. Call this
75
 // to notify the subsystem that it is time to go to work.
73
 // to notify the subsystem that it is time to go to work.

Loading…
Cancel
Save