🚸 Bed distance sensor improvements (#25847)

This commit is contained in:
Mark
2023-06-18 17:18:08 +08:00
committed by GitHub
parent dd1792bdfc
commit 441416728c
12 changed files with 271 additions and 123 deletions
+5 -7
View File
@@ -139,17 +139,15 @@ inline void servo_probe_test() {
bool deploy_state = false, stow_state;
#if ENABLED(Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN)
constexpr bool probe_hit_state = Z_MIN_ENDSTOP_HIT_STATE;
#define PROBE_TEST_PIN Z_MIN_PIN
#define _PROBE_PREF "Z_MIN"
#else
constexpr bool probe_hit_state = Z_MIN_PROBE_ENDSTOP_HIT_STATE;
#define PROBE_TEST_PIN Z_MIN_PROBE_PIN
#define _PROBE_PREF "Z_MIN_PROBE"
#endif
SERIAL_ECHOLNPGM(". Probe " _PROBE_PREF "_PIN: ", PROBE_TEST_PIN);
serial_ternary(F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), probe_hit_state, F("HIGH"), F("LOW"));
serial_ternary(F(". " _PROBE_PREF "_ENDSTOP_HIT_STATE: "), PROBE_HIT_STATE, F("HIGH"), F("LOW"));
SERIAL_EOL();
SET_INPUT_PULLUP(PROBE_TEST_PIN);
@@ -166,11 +164,11 @@ inline void servo_probe_test() {
SERIAL_ECHOLNPGM(". Check for BLTOUCH");
bltouch._reset();
bltouch._stow();
if (READ(PROBE_TEST_PIN) != probe_hit_state) {
if (!PROBE_TRIGGERED()) {
bltouch._set_SW_mode();
if (READ(PROBE_TEST_PIN) == probe_hit_state) {
if (PROBE_TRIGGERED()) {
bltouch._deploy();
if (READ(PROBE_TEST_PIN) != probe_hit_state) {
if (!PROBE_TRIGGERED()) {
bltouch._stow();
SERIAL_ECHOLNPGM("= BLTouch Classic 1.2, 1.3, Smart 1.0, 2.0, 2.2, 3.0, 3.1 detected.");
// Check for a 3.1 by letting the user trigger it, later
@@ -198,7 +196,7 @@ inline void servo_probe_test() {
stow_state = READ(PROBE_TEST_PIN);
}
if (probe_hit_state == deploy_state) SERIAL_ECHOLNPGM("WARNING: " _PROBE_PREF "_ENDSTOP_HIT_STATE is probably wrong.");
if (PROBE_HIT_STATE == deploy_state) SERIAL_ECHOLNPGM("WARNING: " _PROBE_PREF "_ENDSTOP_HIT_STATE is probably wrong.");
if (deploy_state != stow_state) {
SERIAL_ECHOLNPGM("= Mechanical Switch detected");