Check probes only when deployed
Aim: Test probes in update_endstops only when activated Changes: Configurations Add define for FIX_MOUNTED_PROBE to handle the situation where formerly ENDSTOPS_ONLY_FOR_HOMING had to be set, or lowering the nozzle below Z_PROBE_OFFSET_FROM_EXTRUDER could give an "endstop hit" message. Add define for Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN to indicate a common situation, that we have a probe but it is connected to an endstop pin Add some comments Shift some entries to have related things together. Conditionals.h We have a probe (HAS_Z_MIN_PROBE) if one of the pins is defined AND one of the probes is defined. SanityCheck.h Add some tests if the probe is connected and if we have defined a probe. stepper.cpp Changes to test the probe only when it is deployed (z_probe_is_active). Test update_endstops() when the probe is deployed. MarlinMain.cpp a. set and reset z_probe_is_active in deploy_z_probe(), stow_z_probe() and dock_sled() b. set and reset z_probe_is_active in the case a z-servo is moved to a defined position. The only remaining unhandled servo move is in M280 where we do not end in a defined position. If you want to handle a probe use M401/402 c. skip deploying/stowing when already deployed/stowed in the dedicated deploy/stow functions. d. Handle the new FIX_MOUNTED_PROBE in parallel to a servo driven probe/endstop. To do: In another PR. handle all probes in deploy/stow_z_probe. Sort out SERVO_LEVELING vs. HAS_SERVO_ENDSTOPS.
This commit is contained in:
@ -39,6 +39,9 @@
|
||||
//===========================================================================
|
||||
block_t* current_block; // A pointer to the block currently being traced
|
||||
|
||||
#if ENABLED(HAS_Z_MIN_PROBE)
|
||||
volatile bool z_probe_is_active = false;
|
||||
#endif
|
||||
|
||||
//===========================================================================
|
||||
//============================= private variables ===========================
|
||||
@ -425,17 +428,18 @@ inline void update_endstops() {
|
||||
}
|
||||
#else // !Z_DUAL_ENDSTOPS
|
||||
|
||||
UPDATE_ENDSTOP(Z, MIN);
|
||||
|
||||
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && ENABLED(HAS_Z_MIN_PROBE)
|
||||
if (z_probe_is_active) UPDATE_ENDSTOP(Z, MIN);
|
||||
#else
|
||||
UPDATE_ENDSTOP(Z, MIN);
|
||||
#endif
|
||||
#endif // !Z_DUAL_ENDSTOPS
|
||||
#endif // Z_MIN_PIN
|
||||
#endif
|
||||
|
||||
#if ENABLED(Z_MIN_PROBE_ENDSTOP)
|
||||
UPDATE_ENDSTOP(Z, MIN_PROBE);
|
||||
|
||||
if (TEST_ENDSTOP(Z_MIN_PROBE)) {
|
||||
endstops_trigsteps[Z_AXIS] = count_position[Z_AXIS];
|
||||
SBI(endstop_hit_bits, Z_MIN_PROBE);
|
||||
#if ENABLED(Z_MIN_PROBE_ENDSTOP) && DISABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN) && ENABLED(HAS_Z_MIN_PROBE)
|
||||
if (z_probe_is_active) {
|
||||
UPDATE_ENDSTOP(Z, MIN_PROBE);
|
||||
if (TEST_ENDSTOP(Z_MIN_PROBE)) endstop_hit_bits |= _BV(Z_MIN_PROBE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@ -649,7 +653,11 @@ ISR(TIMER1_COMPA_vect) {
|
||||
if (current_block != NULL) {
|
||||
|
||||
// Update endstops state, if enabled
|
||||
if (check_endstops) update_endstops();
|
||||
#if ENABLED(HAS_Z_MIN_PROBE)
|
||||
if (check_endstops || z_probe_is_active) update_endstops();
|
||||
#else
|
||||
if (check_endstops) update_endstops();
|
||||
#endif
|
||||
|
||||
// Take multiple steps per interrupt (For high speed moves)
|
||||
for (int8_t i = 0; i < step_loops; i++) {
|
||||
|
Reference in New Issue
Block a user