소스 검색

Do moves towards endstops differently in do_homing_move

Scott Lahteine 7 년 전
부모
커밋
dbe2b6f7b0
1개의 변경된 파일34개의 추가작업 그리고 22개의 파일을 삭제
  1. 34
    22
      Marlin/src/module/motion.cpp

+ 34
- 22
Marlin/src/module/motion.cpp 파일 보기

998
     }
998
     }
999
   #endif
999
   #endif
1000
 
1000
 
1001
-  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1002
-    const bool deploy_bltouch = (axis == Z_AXIS && distance < 0);
1003
-    if (deploy_bltouch) set_bltouch_deployed(true);
1004
-  #endif
1001
+  // Only do some things when moving towards an endstop
1002
+  const int8_t axis_home_dir =
1003
+    #if ENABLED(DUAL_X_CARRIAGE)
1004
+      (axis == X_AXIS) ? x_home_dir(active_extruder) :
1005
+    #endif
1006
+    home_dir(axis);
1007
+  const bool is_home_dir = (axis_home_dir > 0) == (distance > 0);
1005
 
1008
 
1006
-  #if QUIET_PROBING
1007
-    if (axis == Z_AXIS) probing_pause(true);
1008
-  #endif
1009
+  if (is_home_dir) {
1010
+    #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1011
+      const bool deploy_bltouch = (axis == Z_AXIS && is_home_dir);
1012
+      if (deploy_bltouch) set_bltouch_deployed(true);
1013
+    #endif
1009
 
1014
 
1010
-  // Disable stealthChop if used. Enable diag1 pin on driver.
1011
-  #if ENABLED(SENSORLESS_HOMING)
1012
-    sensorless_homing_per_axis(axis);
1013
-  #endif
1015
+    #if QUIET_PROBING
1016
+      if (axis == Z_AXIS) probing_pause(true);
1017
+    #endif
1018
+
1019
+    // Disable stealthChop if used. Enable diag1 pin on driver.
1020
+    #if ENABLED(SENSORLESS_HOMING)
1021
+      sensorless_homing_per_axis(axis);
1022
+    #endif
1023
+  }
1014
 
1024
 
1015
   // Tell the planner the axis is at 0
1025
   // Tell the planner the axis is at 0
1016
   current_position[axis] = 0;
1026
   current_position[axis] = 0;
1028
 
1038
 
1029
   stepper.synchronize();
1039
   stepper.synchronize();
1030
 
1040
 
1031
-  #if QUIET_PROBING
1032
-    if (axis == Z_AXIS) probing_pause(false);
1033
-  #endif
1041
+  if (is_home_dir) {
1042
+    #if QUIET_PROBING
1043
+      if (axis == Z_AXIS) probing_pause(false);
1044
+    #endif
1034
 
1045
 
1035
-  #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1036
-    if (deploy_bltouch) set_bltouch_deployed(false);
1037
-  #endif
1046
+    #if HOMING_Z_WITH_PROBE && ENABLED(BLTOUCH)
1047
+      if (deploy_bltouch) set_bltouch_deployed(false);
1048
+    #endif
1038
 
1049
 
1039
-  endstops.hit_on_purpose();
1050
+    endstops.hit_on_purpose();
1040
 
1051
 
1041
-  // Re-enable stealthChop if used. Disable diag1 pin on driver.
1042
-  #if ENABLED(SENSORLESS_HOMING)
1043
-    sensorless_homing_per_axis(axis, false);
1044
-  #endif
1052
+    // Re-enable stealthChop if used. Disable diag1 pin on driver.
1053
+    #if ENABLED(SENSORLESS_HOMING)
1054
+      sensorless_homing_per_axis(axis, false);
1055
+    #endif
1056
+  }
1045
 
1057
 
1046
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1058
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1047
     if (DEBUGGING(LEVELING)) {
1059
     if (DEBUGGING(LEVELING)) {

Loading…
취소
저장