소스 검색

Use st_get_position_mm where possible (PR#2411)

Scott Lahteine 10 년 전
부모
커밋
87a872e103
3개의 변경된 파일7개의 추가작업 그리고 15개의 파일을 삭제
  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 파일 보기

@@ -2852,7 +2852,7 @@ inline void gcode_G28() {
2852 2852
         float x_tmp = current_position[X_AXIS] + X_PROBE_OFFSET_FROM_EXTRUDER,
2853 2853
               y_tmp = current_position[Y_AXIS] + Y_PROBE_OFFSET_FROM_EXTRUDER,
2854 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 2857
         apply_rotation_xyz(plan_bed_level_matrix, x_tmp, y_tmp, z_tmp); // Apply the correction sending the probe offset
2858 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,11 +3909,11 @@ inline void gcode_M114() {
3909 3909
   SERIAL_PROTOCOL(current_position[E_AXIS]);
3910 3910
 
3911 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 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 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 3918
   SERIAL_EOL;
3919 3919
 

+ 1
- 7
Marlin/stepper.cpp 파일 보기

@@ -1073,13 +1073,7 @@ long st_get_position(uint8_t axis) {
1073 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 1078
 void finishAndDisableSteppers() {
1085 1079
   st_synchronize();

+ 2
- 4
Marlin/stepper.h 파일 보기

@@ -66,10 +66,8 @@ void st_set_e_position(const long &e);
66 66
 // Get current position in steps
67 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 72
 // The stepper subsystem goes to sleep when it runs out of things to execute. Call this
75 73
 // to notify the subsystem that it is time to go to work.

Loading…
취소
저장