Explorar el Código

Do moves towards endstops differently in do_homing_move

Scott Lahteine hace 7 años
padre
commit
dbe2b6f7b0
Se han modificado 1 ficheros con 34 adiciones y 22 borrados
  1. 34
    22
      Marlin/src/module/motion.cpp

+ 34
- 22
Marlin/src/module/motion.cpp Ver fichero

@@ -998,19 +998,29 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
998 998
     }
999 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 1025
   // Tell the planner the axis is at 0
1016 1026
   current_position[axis] = 0;
@@ -1028,20 +1038,22 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
1028 1038
 
1029 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 1058
   #if ENABLED(DEBUG_LEVELING_FEATURE)
1047 1059
     if (DEBUGGING(LEVELING)) {

Loading…
Cancelar
Guardar