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
     #endif
72
     #endif
73
 
73
 
74
     do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
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
     current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
78
     current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
77
 
79
 
78
     #if ENABLED(SENSORLESS_HOMING)
80
     #if ENABLED(SENSORLESS_HOMING)

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

72
 
72
 
73
 float lcd_probe_pt(const float &rx, const float &ry);
73
 float lcd_probe_pt(const float &rx, const float &ry);
74
 
74
 
75
-bool ac_home() {
75
+void ac_home() {
76
   endstops.enable(true);
76
   endstops.enable(true);
77
-  if (!home_delta())
78
-    return false;
77
+  home_delta();
79
   endstops.not_homing();
78
   endstops.not_homing();
80
-  return true;
81
 }
79
 }
82
 
80
 
83
 void ac_setup(const bool reset_bed) {
81
 void ac_setup(const bool reset_bed) {
530
 
528
 
531
   ac_setup(!_0p_calibration && !_1p_calibration);
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
   do { // start iterations
533
   do { // start iterations
537
 
534
 
724
         sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev));
721
         sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev));
725
       lcd_setstatus(mess);
722
       lcd_setstatus(mess);
726
     }
723
     }
727
-    if (!ac_home()) return;
724
+    ac_home();
728
   }
725
   }
729
   while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);
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
  * A delta can only safely home all axes at the same time
241
  * A delta can only safely home all axes at the same time
242
  * This is like quick_home_xy() but for 3 towers.
242
  * This is like quick_home_xy() but for 3 towers.
243
  */
243
  */
244
-bool home_delta() {
244
+void home_delta() {
245
   #if ENABLED(DEBUG_LEVELING_FEATURE)
245
   #if ENABLED(DEBUG_LEVELING_FEATURE)
246
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
246
     if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
247
   #endif
247
   #endif
265
     delta_sensorless_homing(false);
265
     delta_sensorless_homing(false);
266
   #endif
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
   // At least one carriage has reached the top.
270
   // At least one carriage has reached the top.
280
   // Now re-home each carriage separately.
271
   // Now re-home each carriage separately.
293
   #if ENABLED(DEBUG_LEVELING_FEATURE)
284
   #if ENABLED(DEBUG_LEVELING_FEATURE)
294
     if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
285
     if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
295
   #endif
286
   #endif
296
-
297
-  return true;
298
 }
287
 }
299
 
288
 
300
 #endif // DELTA
289
 #endif // DELTA

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

128
   forward_kinematics_DELTA(point[A_AXIS], point[B_AXIS], point[C_AXIS]);
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
 #endif // __DELTA_H__
133
 #endif // __DELTA_H__

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

256
   #endif
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
 // Enable / disable endstop z-probe checking
265
 // Enable / disable endstop z-probe checking
260
 #if HAS_BED_PROBE
266
 #if HAS_BED_PROBE
261
   void Endstops::enable_z_probe(const bool onoff) {
267
   void Endstops::enable_z_probe(const bool onoff) {

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

144
     // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
144
     // Disable / Enable endstops based on ENSTOPS_ONLY_FOR_HOMING and global enable
145
     static void not_homing();
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
     // Clear endstops (i.e., they were hit intentionally) to suppress the report
150
     // Clear endstops (i.e., they were hit intentionally) to suppress the report
148
     FORCE_INLINE static void hit_on_purpose() { hit_state = 0; }
151
     FORCE_INLINE static void hit_on_purpose() { hit_state = 0; }
149
 
152
 

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

1163
       #endif
1163
       #endif
1164
     }
1164
     }
1165
 
1165
 
1166
-    endstops.hit_on_purpose();
1166
+    endstops.validate_homing_move();
1167
 
1167
 
1168
     // Re-enable stealthChop if used. Disable diag1 pin on driver.
1168
     // Re-enable stealthChop if used. Disable diag1 pin on driver.
1169
     #if ENABLED(SENSORLESS_HOMING)
1169
     #if ENABLED(SENSORLESS_HOMING)

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

532
     if (probe_triggered && set_bltouch_deployed(false)) return true;
532
     if (probe_triggered && set_bltouch_deployed(false)) return true;
533
   #endif
533
   #endif
534
 
534
 
535
-  // Clear endstop flags
536
   endstops.hit_on_purpose();
535
   endstops.hit_on_purpose();
537
 
536
 
538
   // Get Z where the steppers were interrupted
537
   // Get Z where the steppers were interrupted

Loading…
Cancel
Save