Browse Source

Do a hard kill for failed homing moves (#11161)

Scott Lahteine 7 years ago
parent
commit
c51e27d11d
No account linked to committer's email address

+ 3
- 1
Marlin/src/gcode/calibrate/G28.cpp View File

@@ -72,7 +72,9 @@
72 72
     #endif
73 73
 
74 74
     do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
75
-    endstops.hit_on_purpose(); // clear endstop hit flags
75
+
76
+    endstops.validate_homing_move();
77
+
76 78
     current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
77 79
 
78 80
     #if ENABLED(SENSORLESS_HOMING)

+ 4
- 7
Marlin/src/gcode/calibrate/G33.cpp View File

@@ -72,12 +72,10 @@ enum CalEnum : char {                        // the 7 main calibration points -
72 72
 
73 73
 float lcd_probe_pt(const float &rx, const float &ry);
74 74
 
75
-bool ac_home() {
75
+void ac_home() {
76 76
   endstops.enable(true);
77
-  if (!home_delta())
78
-    return false;
77
+  home_delta();
79 78
   endstops.not_homing();
80
-  return true;
81 79
 }
82 80
 
83 81
 void ac_setup(const bool reset_bed) {
@@ -530,8 +528,7 @@ void GcodeSuite::G33() {
530 528
 
531 529
   ac_setup(!_0p_calibration && !_1p_calibration);
532 530
 
533
-  if (!_0p_calibration)
534
-    if (!ac_home()) return;
531
+  if (!_0p_calibration) ac_home();
535 532
 
536 533
   do { // start iterations
537 534
 
@@ -724,7 +721,7 @@ void GcodeSuite::G33() {
724 721
         sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev));
725 722
       lcd_setstatus(mess);
726 723
     }
727
-    if (!ac_home()) return;
724
+    ac_home();
728 725
   }
729 726
   while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
730 727
 

+ 2
- 13
Marlin/src/module/delta.cpp View File

@@ -241,7 +241,7 @@ void forward_kinematics_DELTA(float z1, float z2, float z3) {
241 241
  * A delta can only safely home all axes at the same time
242 242
  * This is like quick_home_xy() but for 3 towers.
243 243
  */
244
-bool home_delta() {
244
+void home_delta() {
245 245
   #if ENABLED(DEBUG_LEVELING_FEATURE)
246 246
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
247 247
   #endif
@@ -265,16 +265,7 @@ bool home_delta() {
265 265
     delta_sensorless_homing(false);
266 266
   #endif
267 267
 
268
-  // If an endstop was not hit, then damage can occur if homing is continued.
269
-  // This can occur if the delta height not set correctly.
270
-  if (!(endstops.trigger_state() & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) {
271
-    LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED);
272
-    SERIAL_ERROR_START();
273
-    SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED);
274
-    return false;
275
-  }
276
-
277
-  endstops.hit_on_purpose(); // clear endstop hit flags
268
+  endstops.validate_homing_move();
278 269
 
279 270
   // At least one carriage has reached the top.
280 271
   // Now re-home each carriage separately.
@@ -293,8 +284,6 @@ bool home_delta() {
293 284
   #if ENABLED(DEBUG_LEVELING_FEATURE)
294 285
     if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
295 286
   #endif
296
-
297
-  return true;
298 287
 }
299 288
 
300 289
 #endif // DELTA

+ 1
- 1
Marlin/src/module/delta.h View File

@@ -128,6 +128,6 @@ FORCE_INLINE void forward_kinematics_DELTA(float point[ABC]) {
128 128
   forward_kinematics_DELTA(point[A_AXIS], point[B_AXIS], point[C_AXIS]);
129 129
 }
130 130
 
131
-bool home_delta();
131
+void home_delta();
132 132
 
133 133
 #endif // __DELTA_H__

+ 6
- 0
Marlin/src/module/endstops.cpp View File

@@ -256,6 +256,12 @@ void Endstops::not_homing() {
256 256
   #endif
257 257
 }
258 258
 
259
+// If the last move failed to trigger an endstop, call kill
260
+void Endstops::validate_homing_move() {
261
+  if (!trigger_state()) kill(PSTR(MSG_ERR_HOMING_FAILED));
262
+  hit_on_purpose();
263
+}
264
+
259 265
 // Enable / disable endstop z-probe checking
260 266
 #if HAS_BED_PROBE
261 267
   void Endstops::enable_z_probe(const bool onoff) {

+ 3
- 0
Marlin/src/module/endstops.h View File

@@ -144,6 +144,9 @@ class Endstops {
144 144
     // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
145 145
     static void not_homing();
146 146
 
147
+    // If the last move failed to trigger an endstop, call kill
148
+    static void validate_homing_move();
149
+
147 150
     // Clear endstops (i.e., they were hit intentionally) to suppress the report
148 151
     FORCE_INLINE static void hit_on_purpose() { hit_state = 0; }
149 152
 

+ 1
- 1
Marlin/src/module/motion.cpp View File

@@ -1163,7 +1163,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
1163 1163
       #endif
1164 1164
     }
1165 1165
 
1166
-    endstops.hit_on_purpose();
1166
+    endstops.validate_homing_move();
1167 1167
 
1168 1168
     // Re-enable stealthChop if used. Disable diag1 pin on driver.
1169 1169
     #if ENABLED(SENSORLESS_HOMING)

+ 0
- 1
Marlin/src/module/probe.cpp View File

@@ -532,7 +532,6 @@ static bool do_probe_move(const float z, const float fr_mm_s) {
532 532
     if (probe_triggered && set_bltouch_deployed(false)) return true;
533 533
   #endif
534 534
 
535
-  // Clear endstop flags
536 535
   endstops.hit_on_purpose();
537 536
 
538 537
   // Get Z where the steppers were interrupted

Loading…
Cancel
Save