소스 검색

Merge pull request #1925 from thinkyhead/move_zoffset

Apply zprobe_zoffset in axis_is_at_home
Scott Lahteine 10 년 전
부모
커밋
777ca11760
1개의 변경된 파일15개의 추가작업 그리고 18개의 파일을 삭제
  1. 15
    18
      Marlin/Marlin_main.cpp

+ 15
- 18
Marlin/Marlin_main.cpp 파일 보기

@@ -1030,6 +1030,10 @@ static void axis_is_at_home(int axis) {
1030 1030
     current_position[axis] = base_home_pos(axis) + home_offset[axis];
1031 1031
     min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1032 1032
     max_pos[axis] = base_max_pos(axis) + home_offset[axis];
1033
+
1034
+    #if defined(ENABLE_AUTO_BED_LEVELING) && Z_HOME_DIR < 0
1035
+      if (axis == Z_AXIS) current_position[Z_AXIS] += zprobe_zoffset;
1036
+    #endif
1033 1037
   }
1034 1038
 }
1035 1039
 
@@ -1185,8 +1189,8 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
1185 1189
       st_synchronize();
1186 1190
       endstops_hit_on_purpose(); // clear endstop hit flags
1187 1191
 
1192
+      // Get the current stepper position after bumping an endstop
1188 1193
       current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
1189
-      // make sure the planner knows where we are as it may be a bit different than we last said to move to
1190 1194
       sync_plan_position();
1191 1195
       
1192 1196
     #endif // !DELTA
@@ -2019,10 +2023,6 @@ inline void gcode_G28() {
2019 2023
 
2020 2024
     #endif // Z_HOME_DIR < 0
2021 2025
 
2022
-    #if defined(ENABLE_AUTO_BED_LEVELING) && (Z_HOME_DIR < 0)
2023
-      if (home_all_axis || homeZ) current_position[Z_AXIS] += zprobe_zoffset;  // Add Z_Probe offset (the distance is negative)
2024
-    #endif
2025
-
2026 2026
     sync_plan_position();
2027 2027
 
2028 2028
   #endif // else DELTA
@@ -2908,12 +2908,12 @@ inline void gcode_M42() {
2908 2908
       }
2909 2909
     }
2910 2910
 
2911
-    double X_probe_location, Y_probe_location,
2912
-           X_current = X_probe_location = st_get_position_mm(X_AXIS),
2913
-           Y_current = Y_probe_location = st_get_position_mm(Y_AXIS),
2911
+    double X_current = st_get_position_mm(X_AXIS),
2912
+           Y_current = st_get_position_mm(Y_AXIS),
2914 2913
            Z_current = st_get_position_mm(Z_AXIS),
2915
-           Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING,
2916
-           ext_position = st_get_position_mm(E_AXIS);
2914
+           E_current = st_get_position_mm(E_AXIS),
2915
+           X_probe_location = X_current, Y_probe_location = Y_current,
2916
+           Z_start_location = Z_current + Z_RAISE_BEFORE_PROBING;
2917 2917
 
2918 2918
     bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2919 2919
 
@@ -2948,10 +2948,7 @@ inline void gcode_M42() {
2948 2948
 
2949 2949
     st_synchronize();
2950 2950
     plan_bed_level_matrix.set_to_identity();
2951
-    plan_buffer_line(X_current, Y_current, Z_start_location,
2952
-        ext_position,
2953
-        homing_feedrate[Z_AXIS] / 60,
2954
-        active_extruder);
2951
+    plan_buffer_line(X_current, Y_current, Z_start_location, E_current, homing_feedrate[Z_AXIS] / 60, active_extruder);
2955 2952
     st_synchronize();
2956 2953
 
2957 2954
     //
@@ -2963,7 +2960,7 @@ inline void gcode_M42() {
2963 2960
       SERIAL_PROTOCOLPGM("Positioning the probe...\n");
2964 2961
 
2965 2962
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2966
-        ext_position,
2963
+        E_current,
2967 2964
         homing_feedrate[X_AXIS]/60,
2968 2965
         active_extruder);
2969 2966
     st_synchronize();
@@ -2971,7 +2968,7 @@ inline void gcode_M42() {
2971 2968
     current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
2972 2969
     current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
2973 2970
     current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
2974
-    current_position[E_AXIS] = ext_position = st_get_position_mm(E_AXIS);
2971
+    current_position[E_AXIS] = E_current = st_get_position_mm(E_AXIS);
2975 2972
 
2976 2973
     // 
2977 2974
     // OK, do the inital probe to get us close to the bed.
@@ -2987,7 +2984,7 @@ inline void gcode_M42() {
2987 2984
     Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
2988 2985
 
2989 2986
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2990
-        ext_position,
2987
+        E_current,
2991 2988
         homing_feedrate[X_AXIS]/60,
2992 2989
         active_extruder);
2993 2990
     st_synchronize();
@@ -3017,8 +3014,8 @@ inline void gcode_M42() {
3017 3014
           if (radius < 0.0) radius = -radius;
3018 3015
 
3019 3016
           X_current = X_probe_location + cos(theta) * radius;
3020
-          Y_current = Y_probe_location + sin(theta) * radius;
3021 3017
           X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
3018
+          Y_current = Y_probe_location + sin(theta) * radius;
3022 3019
           Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
3023 3020
 
3024 3021
           if (verbose_level > 3) {

Loading…
취소
저장