浏览代码

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
     current_position[axis] = base_home_pos(axis) + home_offset[axis];
1030
     current_position[axis] = base_home_pos(axis) + home_offset[axis];
1031
     min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1031
     min_pos[axis] = base_min_pos(axis) + home_offset[axis];
1032
     max_pos[axis] = base_max_pos(axis) + home_offset[axis];
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
       st_synchronize();
1189
       st_synchronize();
1186
       endstops_hit_on_purpose(); // clear endstop hit flags
1190
       endstops_hit_on_purpose(); // clear endstop hit flags
1187
 
1191
 
1192
+      // Get the current stepper position after bumping an endstop
1188
       current_position[Z_AXIS] = st_get_position_mm(Z_AXIS);
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
       sync_plan_position();
1194
       sync_plan_position();
1191
       
1195
       
1192
     #endif // !DELTA
1196
     #endif // !DELTA
2019
 
2023
 
2020
     #endif // Z_HOME_DIR < 0
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
     sync_plan_position();
2026
     sync_plan_position();
2027
 
2027
 
2028
   #endif // else DELTA
2028
   #endif // else DELTA
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
            Z_current = st_get_position_mm(Z_AXIS),
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
     bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2918
     bool deploy_probe_for_each_reading = code_seen('E') || code_seen('e');
2919
 
2919
 
2948
 
2948
 
2949
     st_synchronize();
2949
     st_synchronize();
2950
     plan_bed_level_matrix.set_to_identity();
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
     st_synchronize();
2952
     st_synchronize();
2956
 
2953
 
2957
     //
2954
     //
2963
       SERIAL_PROTOCOLPGM("Positioning the probe...\n");
2960
       SERIAL_PROTOCOLPGM("Positioning the probe...\n");
2964
 
2961
 
2965
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2962
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2966
-        ext_position,
2963
+        E_current,
2967
         homing_feedrate[X_AXIS]/60,
2964
         homing_feedrate[X_AXIS]/60,
2968
         active_extruder);
2965
         active_extruder);
2969
     st_synchronize();
2966
     st_synchronize();
2971
     current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
2968
     current_position[X_AXIS] = X_current = st_get_position_mm(X_AXIS);
2972
     current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
2969
     current_position[Y_AXIS] = Y_current = st_get_position_mm(Y_AXIS);
2973
     current_position[Z_AXIS] = Z_current = st_get_position_mm(Z_AXIS);
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
     // OK, do the inital probe to get us close to the bed.
2974
     // OK, do the inital probe to get us close to the bed.
2987
     Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
2984
     Z_start_location = st_get_position_mm(Z_AXIS) + Z_RAISE_BEFORE_PROBING;
2988
 
2985
 
2989
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2986
     plan_buffer_line( X_probe_location, Y_probe_location, Z_start_location,
2990
-        ext_position,
2987
+        E_current,
2991
         homing_feedrate[X_AXIS]/60,
2988
         homing_feedrate[X_AXIS]/60,
2992
         active_extruder);
2989
         active_extruder);
2993
     st_synchronize();
2990
     st_synchronize();
3017
           if (radius < 0.0) radius = -radius;
3014
           if (radius < 0.0) radius = -radius;
3018
 
3015
 
3019
           X_current = X_probe_location + cos(theta) * radius;
3016
           X_current = X_probe_location + cos(theta) * radius;
3020
-          Y_current = Y_probe_location + sin(theta) * radius;
3021
           X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
3017
           X_current = constrain(X_current, X_MIN_POS, X_MAX_POS);
3018
+          Y_current = Y_probe_location + sin(theta) * radius;
3022
           Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
3019
           Y_current = constrain(Y_current, Y_MIN_POS, Y_MAX_POS);
3023
 
3020
 
3024
           if (verbose_level > 3) {
3021
           if (verbose_level > 3) {

正在加载...
取消
保存