diff --git a/motion_control.c b/motion_control.c index b74bb7c..66cb9ac 100644 --- a/motion_control.c +++ b/motion_control.c @@ -289,7 +289,7 @@ void mc_homing_cycle() uint8_t auto_start_state = sys.auto_start; // Store run state // After syncing, check if probe is already triggered. If so, halt and issue alarm. - if (probe_get_state(mode)) { + if (probe_get_state(mode) && probe_errors_enabled(mode)) { bit_true_atomic(sys.execute, EXEC_CRIT_EVENT); protocol_execute_runtime(); } @@ -313,7 +313,9 @@ void mc_homing_cycle() } while ((sys.state != STATE_IDLE) && (sys.state != STATE_QUEUED)); // Probing motion complete. If the probe has not been triggered, error out. - if (sys.probe_state & PROBE_ACTIVE) { bit_true_atomic(sys.execute, EXEC_CRIT_EVENT); } + if (sys.probe_state & PROBE_ACTIVE && probe_errors_enabled(mode)) { + bit_true_atomic(sys.execute, EXEC_CRIT_EVENT); + } protocol_execute_runtime(); // Check and execute run-time commands if (sys.abort) { return; } // Check for system abort diff --git a/probe.c b/probe.c index 5a65939..7d45fe6 100644 --- a/probe.c +++ b/probe.c @@ -46,6 +46,10 @@ uint8_t probe_get_state(uint8_t mode) { return mode ^ ((PROBE_PIN & PROBE_MASK) ^ probe_invert_mask); } +uint8_t probe_errors_enabled(uint8_t mode) { + return !(mode & PROBE_NO_ERROR); +} + // Monitors probe pin state and records the system position when detected. Called by the // stepper ISR per ISR tick. // NOTE: This function must be extremely efficient as to not bog down the stepper ISR. diff --git a/probe.h b/probe.h index 5986d86..5a2006d 100644 --- a/probe.h +++ b/probe.h @@ -38,6 +38,8 @@ void probe_init(); // Returns probe pin state. uint8_t probe_get_state(uint8_t mode); +uint8_t probe_errors_enabled(uint8_t mode); + // Monitors probe pin state and records the system position when detected. Called by the // stepper ISR per ISR tick. void probe_state_monitor();