Browse Source

Merge pull request #10250 from thinkyhead/bf2_homing_move_adjustments

[2.0.x] Improvements to general and delta homing
Scott Lahteine 7 years ago
parent
commit
568ae094f4
No account linked to committer's email address
2 changed files with 39 additions and 30 deletions
  1. 5
    8
      Marlin/src/module/delta.cpp
  2. 34
    22
      Marlin/src/module/motion.cpp

+ 5
- 8
Marlin/src/module/delta.cpp View File

260
   line_to_current_position();
260
   line_to_current_position();
261
   stepper.synchronize();
261
   stepper.synchronize();
262
 
262
 
263
+  // Re-enable stealthChop if used. Disable diag1 pin on driver.
264
+  #if ENABLED(SENSORLESS_HOMING)
265
+    delta_sensorless_homing(false);
266
+  #endif
267
+
263
   // If an endstop was not hit, then damage can occur if homing is continued.
268
   // If an endstop was not hit, then damage can occur if homing is continued.
264
   // This can occur if the delta height not set correctly.
269
   // This can occur if the delta height not set correctly.
265
   if (!(Endstops::endstop_hit_bits & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) {
270
   if (!(Endstops::endstop_hit_bits & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) {
266
     LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED);
271
     LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED);
267
     SERIAL_ERROR_START();
272
     SERIAL_ERROR_START();
268
     SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED);
273
     SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED);
269
-    #if ENABLED(SENSORLESS_HOMING)
270
-      delta_sensorless_homing(false);
271
-    #endif
272
     return false;
274
     return false;
273
   }
275
   }
274
 
276
 
280
   HOMEAXIS(B);
282
   HOMEAXIS(B);
281
   HOMEAXIS(C);
283
   HOMEAXIS(C);
282
 
284
 
283
-  // Re-enable stealthChop if used. Disable diag1 pin on driver.
284
-  #if ENABLED(SENSORLESS_HOMING)
285
-    delta_sensorless_homing(false);
286
-  #endif
287
-
288
   // Set all carriages to their home positions
285
   // Set all carriages to their home positions
289
   // Do this here all at once for Delta, because
286
   // Do this here all at once for Delta, because
290
   // XYZ isn't ABC. Applying this per-tower would
287
   // XYZ isn't ABC. Applying this per-tower would

+ 34
- 22
Marlin/src/module/motion.cpp View File

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…
Cancel
Save