Level Corners with Probe option (#20241)

This commit is contained in:
wmariz
2020-11-26 10:58:19 -03:00
committed by Scott Lahteine
parent 7c9c897dac
commit 747bde7e64
11 changed files with 211 additions and 69 deletions

View File

@ -48,6 +48,10 @@
#include "../feature/joystick.h"
#endif
#if HAS_BED_PROBE
#include "probe.h"
#endif
Endstops endstops;
// private:
@ -455,7 +459,7 @@ void _O2 Endstops::report_states() {
ES_REPORT(Z4_MAX);
#endif
#if HAS_CUSTOM_PROBE_PIN
print_es_state(READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING, PSTR(STR_Z_PROBE));
print_es_state(PROBE_TRIGGERED(), PSTR(STR_Z_PROBE));
#endif
#if HAS_FILAMENT_SENSOR
#if NUM_RUNOUT_SENSORS == 1

View File

@ -270,13 +270,7 @@ FORCE_INLINE void probe_specific_action(const bool deploy) {
#if ENABLED(PAUSE_BEFORE_DEPLOY_STOW)
do {
#if ENABLED(PAUSE_PROBE_DEPLOY_WHEN_TRIGGERED)
if (deploy == (
#if HAS_CUSTOM_PROBE_PIN
READ(Z_MIN_PROBE_PIN) == Z_MIN_PROBE_ENDSTOP_INVERTING
#else
READ(Z_MIN_PIN) == Z_MIN_ENDSTOP_INVERTING
#endif
)) break;
if (deploy == PROBE_TRIGGERED()) break;
#endif
BUZZ(100, 659);
@ -375,23 +369,15 @@ bool Probe::set_deployed(const bool deploy) {
const xy_pos_t old_xy = current_position;
#if ENABLED(PROBE_TRIGGERED_WHEN_STOWED_TEST)
#if HAS_CUSTOM_PROBE_PIN
#define PROBE_STOWED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
#else
#define PROBE_STOWED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
#endif
#endif
#ifdef PROBE_STOWED
// Only deploy/stow if needed
if (PROBE_STOWED() == deploy) {
if (PROBE_TRIGGERED() == deploy) {
if (!deploy) endstops.enable_z_probe(false); // Switch off triggered when stowed probes early
// otherwise an Allen-Key probe can't be stowed.
probe_specific_action(deploy);
}
if (PROBE_STOWED() == deploy) { // Unchanged after deploy/stow action?
if (PROBE_TRIGGERED() == deploy) { // Unchanged after deploy/stow action?
if (IsRunning()) {
SERIAL_ERROR_MSG("Z-Probe failed");
LCD_ALERTMESSAGEPGM_P(PSTR("Err: ZPROBE"));

View File

@ -38,6 +38,12 @@
};
#endif
#if HAS_CUSTOM_PROBE_PIN
#define PROBE_TRIGGERED() (READ(Z_MIN_PROBE_PIN) != Z_MIN_PROBE_ENDSTOP_INVERTING)
#else
#define PROBE_TRIGGERED() (READ(Z_MIN_PIN) != Z_MIN_ENDSTOP_INVERTING)
#endif
class Probe {
public: