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

This commit is contained in:
Scott Lahteine 2018-06-30 21:53:58 -05:00 committed by GitHub
parent c4fbbcaf46
commit defaa93121
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 23 deletions

View File

@ -2242,7 +2242,6 @@ void clean_up_after_endstop_or_probe_move() {
if (probe_triggered && set_bltouch_deployed(false)) return true;
#endif
// Clear endstop flags
endstops.hit_on_purpose();
// Get Z where the steppers were interrupted
@ -2989,6 +2988,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
// Tell the planner the axis is at 0
current_position[axis] = 0;
// Do the move, which is required to hit an endstop
#if IS_SCARA
SYNC_PLAN_POSITION_KINEMATIC();
current_position[axis] = distance;
@ -3015,7 +3015,7 @@ static void do_homing_move(const AxisEnum axis, const float distance, const floa
#endif
}
endstops.hit_on_purpose();
endstops.validate_homing_move();
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING)
@ -3725,7 +3725,9 @@ inline void gcode_G4() {
#endif
do_blocking_move_to_xy(1.5 * mlx * x_axis_home_dir, 1.5 * mly * home_dir(Y_AXIS), fr_mm_s);
endstops.hit_on_purpose(); // clear endstop hit flags
endstops.validate_homing_move();
current_position[X_AXIS] = current_position[Y_AXIS] = 0.0;
#if ENABLED(SENSORLESS_HOMING)
@ -3905,7 +3907,7 @@ inline void gcode_G4() {
* A delta can only safely home all axes at the same time
* This is like quick_home_xy() but for 3 towers.
*/
inline bool home_delta() {
inline void home_delta() {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS(">>> home_delta", current_position);
#endif
@ -3929,16 +3931,7 @@ inline void gcode_G4() {
delta_sensorless_homing(false);
#endif
// If an endstop was not hit, then damage can occur if homing is continued.
// This can occur if the delta height not set correctly.
if (!(endstops.trigger_state() & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))) {
LCD_MESSAGEPGM(MSG_ERR_HOMING_FAILED);
SERIAL_ERROR_START();
SERIAL_ERRORLNPGM(MSG_ERR_HOMING_FAILED);
return false;
}
endstops.hit_on_purpose(); // clear endstop hit flags
endstops.validate_homing_move();
// At least one carriage has reached the top.
// Now re-home each carriage separately.
@ -3957,8 +3950,6 @@ inline void gcode_G4() {
#if ENABLED(DEBUG_LEVELING_FEATURE)
if (DEBUGGING(LEVELING)) DEBUG_POS("<<< home_delta", current_position);
#endif
return true;
}
#endif // DELTA
@ -5514,12 +5505,10 @@ void home_all_axes() { gcode_G28(true); }
float lcd_probe_pt(const float &rx, const float &ry);
bool ac_home() {
void ac_home() {
endstops.enable(true);
if (!home_delta())
return false;
home_delta();
endstops.not_homing();
return true;
}
void ac_setup(const bool reset_bed) {
@ -5972,8 +5961,7 @@ void home_all_axes() { gcode_G28(true); }
ac_setup(!_0p_calibration && !_1p_calibration);
if (!_0p_calibration)
if (!ac_home()) return;
if (!_0p_calibration) ac_home();
do { // start iterations
@ -6166,7 +6154,7 @@ void home_all_axes() { gcode_G28(true); }
sprintf_P(&mess[15], PSTR("%03i.x"), (int)round(zero_std_dev));
lcd_setstatus(mess);
}
if (!ac_home()) return;
ac_home();
}
while (((zero_std_dev < test_precision && iterations < 31) || iterations <= force_iterations) && zero_std_dev > calibration_precision);

View File

@ -229,6 +229,12 @@ void Endstops::not_homing() {
#endif
}
// If the last move failed to trigger an endstop, call kill
void Endstops::validate_homing_move() {
if (!trigger_state()) kill(PSTR(MSG_ERR_HOMING_FAILED));
hit_on_purpose();
}
// Enable / disable endstop z-probe checking
#if HAS_BED_PROBE
void Endstops::enable_z_probe(const bool onoff) {

View File

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