mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2026-01-04 21:57:44 -07:00
🧑💻 Probe code refinements
This commit is contained in:
parent
cf9f205030
commit
6e01ba3ce8
7 changed files with 71 additions and 73 deletions
|
|
@ -1053,7 +1053,8 @@
|
|||
// Delta radius and diagonal rod adjustments
|
||||
//#define DELTA_RADIUS_TRIM_TOWER { 0.0, 0.0, 0.0 } // (mm)
|
||||
//#define DELTA_DIAGONAL_ROD_TRIM_TOWER { 0.0, 0.0, 0.0 } // (mm)
|
||||
#endif
|
||||
|
||||
#endif // DELTA
|
||||
|
||||
// @section scara
|
||||
|
||||
|
|
|
|||
|
|
@ -380,9 +380,9 @@ static float auto_tune_a(const float dcr) {
|
|||
* With HAS_DELTA_SENSORLESS_PROBING:
|
||||
* Use these flags to calibrate stall sensitivity:
|
||||
* Example: G33 P1 Y Z - to calibrate X only
|
||||
* X Don't activate stallguard on X
|
||||
* Y Don't activate stallguard on Y
|
||||
* Z Don't activate stallguard on Z
|
||||
* X Don't activate StallGuard on X
|
||||
* Y Don't activate StallGuard on Y
|
||||
* Z Don't activate StallGuard on Z
|
||||
* S Save offset_sensorless_adj
|
||||
*/
|
||||
void GcodeSuite::G33() {
|
||||
|
|
|
|||
|
|
@ -3303,6 +3303,9 @@
|
|||
#if ANY(ADVANCED_PAUSE_FEATURE, PROBING_HEATERS_OFF)
|
||||
#define HEATER_IDLE_HANDLER 1
|
||||
#endif
|
||||
#if ENABLED(DELTA)
|
||||
#undef PROBING_STEPPERS_OFF
|
||||
#endif
|
||||
#if HAS_BED_PROBE && (ANY(PROBING_HEATERS_OFF, PROBING_STEPPERS_OFF, PROBING_ESTEPPERS_OFF, PROBING_FANS_OFF) || DELAY_BEFORE_PROBING > 0)
|
||||
#define HAS_QUIET_PROBING 1
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1277,53 +1277,22 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
|||
+ (DISABLED(BLTOUCH) && HAS_Z_SERVO_PROBE) \
|
||||
+ COUNT_ENABLED(PROBE_MANUALLY, BLTOUCH, BD_SENSOR, FIX_MOUNTED_PROBE, NOZZLE_AS_PROBE, TOUCH_MI_PROBE, SOLENOID_PROBE, Z_PROBE_ALLEN_KEY, Z_PROBE_SLED, RACK_AND_PINION_PROBE, SENSORLESS_PROBING, MAGLEV4, MAG_MOUNTED_PROBE, BIQU_MICROPROBE_V1, BIQU_MICROPROBE_V2)
|
||||
#error "Please enable only one probe option. See the following errors:"
|
||||
#if ENABLED(BLTOUCH)
|
||||
#error "(BLTOUCH is enabled.)"
|
||||
#elif HAS_Z_SERVO_PROBE
|
||||
#error "(Z_SERVO_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(PROBE_MANUALLY)
|
||||
#error "(PROBE_MANUALLY is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(BD_SENSOR)
|
||||
#error "(BD_SENSOR is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(FIX_MOUNTED_PROBE)
|
||||
#error "(FIX_MOUNTED_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(NOZZLE_AS_PROBE)
|
||||
#error "(NOZZLE_AS_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(TOUCH_MI_PROBE)
|
||||
#error "(TOUCH_MI_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(SOLENOID_PROBE)
|
||||
#error "(SOLENOID_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(Z_PROBE_ALLEN_KEY)
|
||||
#error "(Z_PROBE_ALLEN_KEY is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(Z_PROBE_SLED)
|
||||
#error "(Z_PROBE_SLED is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(RACK_AND_PINION_PROBE)
|
||||
#error "(RACK_AND_PINION_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
#error "(SENSORLESS_PROBING is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(MAGLEV4)
|
||||
#error "(MAGLEV4 is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(MAG_MOUNTED_PROBE)
|
||||
#error "(MAG_MOUNTED_PROBE is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(BIQU_MICROPROBE_V1)
|
||||
#error "(BIQU_MICROPROBE_V1 is enabled.)"
|
||||
#endif
|
||||
#if ENABLED(BIQU_MICROPROBE_V2)
|
||||
#error "(BIQU_MICROPROBE_V2 is enabled.)"
|
||||
#endif
|
||||
static_assert(DISABLED(BLTOUCH), "(BLTOUCH is enabled.)");
|
||||
static_assert(ENABLED(BLTOUCH) || DISABLED(HAS_Z_SERVO_PROBE), "(Z_SERVO_PROBE is enabled.)");
|
||||
static_assert(DISABLED(PROBE_MANUALLY), "(PROBE_MANUALLY is enabled.)");
|
||||
static_assert(DISABLED(BD_SENSOR), "(BD_SENSOR is enabled.)");
|
||||
static_assert(DISABLED(FIX_MOUNTED_PROBE), "(FIX_MOUNTED_PROBE is enabled.)");
|
||||
static_assert(DISABLED(NOZZLE_AS_PROBE), "(NOZZLE_AS_PROBE is enabled.)");
|
||||
static_assert(DISABLED(TOUCH_MI_PROBE), "(TOUCH_MI_PROBE is enabled.)");
|
||||
static_assert(DISABLED(SOLENOID_PROBE), "(SOLENOID_PROBE is enabled.)");
|
||||
static_assert(DISABLED(Z_PROBE_ALLEN_KEY), "(Z_PROBE_ALLEN_KEY is enabled.)");
|
||||
static_assert(DISABLED(Z_PROBE_SLED), "(Z_PROBE_SLED is enabled.)");
|
||||
static_assert(DISABLED(RACK_AND_PINION_PROBE), "(RACK_AND_PINION_PROBE is enabled.)");
|
||||
static_assert(DISABLED(SENSORLESS_PROBING), "(SENSORLESS_PROBING is enabled.)");
|
||||
static_assert(DISABLED(MAGLEV4), "(MAGLEV4 is enabled.)");
|
||||
static_assert(DISABLED(MAG_MOUNTED_PROBE), "(MAG_MOUNTED_PROBE is enabled.)");
|
||||
static_assert(DISABLED(BIQU_MICROPROBE_V1), "(BIQU_MICROPROBE_V1 is enabled.)");
|
||||
static_assert(DISABLED(BIQU_MICROPROBE_V2), "(BIQU_MICROPROBE_V2 is enabled.)");
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
|
|
@ -1500,7 +1469,6 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
|||
#elif !PIN_EXISTS(PROBE_ENABLE)
|
||||
#error "BIQU MicroProbe requires a PROBE_ENABLE_PIN."
|
||||
#endif
|
||||
|
||||
#if ENABLED(BIQU_MICROPROBE_V1)
|
||||
#if ENABLED(INVERTED_PROBE_STATE)
|
||||
#if Z_MIN_PROBE_ENDSTOP_HIT_STATE != LOW
|
||||
|
|
@ -1518,6 +1486,13 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
|||
#error "BIQU_MICROPROBE_V1 requires Z_MIN_ENDSTOP_HIT_STATE HIGH."
|
||||
#endif
|
||||
#endif
|
||||
#if NONE(ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS, ENDSTOPPULLUP_ZMIN, ENDSTOPPULLUP_ZMIN_PROBE)
|
||||
#if USE_Z_MIN_PROBE
|
||||
#error "BIQU_MICROPROBE_V1 on Z_MIN_PROBE_PIN requires ENDSTOPPULLUP_ZMIN_PROBE, or ENDSTOPPULLUPS."
|
||||
#else
|
||||
#error "BIQU_MICROPROBE_V1 on Z_MIN_PIN requires ENDSTOPPULLUP_ZMIN, or ENDSTOPPULLUPS."
|
||||
#endif
|
||||
#endif
|
||||
#elif ENABLED(BIQU_MICROPROBE_V2)
|
||||
#if ENABLED(INVERTED_PROBE_STATE)
|
||||
#if Z_MIN_PROBE_ENDSTOP_HIT_STATE != HIGH
|
||||
|
|
@ -1536,6 +1511,13 @@ static_assert(NUM_SERVOS <= NUM_SERVO_PLUGS, "NUM_SERVOS (or some servo index) i
|
|||
#endif
|
||||
#endif
|
||||
#endif
|
||||
#if NONE(ONBOARD_ENDSTOPPULLUPS, ENDSTOPPULLUPS, ENDSTOPPULLUP_ZMIN, ENDSTOPPULLUP_ZMIN_PROBE)
|
||||
#if USE_Z_MIN_PROBE
|
||||
#error "BIQU_MICROPROBE_V2 on Z_MIN_PROBE_PIN requires ENDSTOPPULLUP_ZMIN_PROBE, or ENDSTOPPULLUPS."
|
||||
#else
|
||||
#error "BIQU_MICROPROBE_V2 on Z_MIN_PIN requires ENDSTOPPULLUP_ZMIN, or ENDSTOPPULLUPS."
|
||||
#endif
|
||||
#endif
|
||||
#endif // BIQU_MICROPROBE_V1 || BIQU_MICROPROBE_V2
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -2207,7 +2207,7 @@ void prepare_line_to_destination() {
|
|||
thermalManager.wait_for_hotend_heating(active_extruder);
|
||||
#endif
|
||||
|
||||
TERN_(HAS_QUIET_PROBING, if (final_approach) probe.set_probing_paused(true));
|
||||
TERN_(HAS_QUIET_PROBING, if (final_approach) probe.set_devices_paused_for_probing(true));
|
||||
}
|
||||
|
||||
// Disable stealthChop if used. Enable diag1 pin on driver.
|
||||
|
|
@ -2246,7 +2246,7 @@ void prepare_line_to_destination() {
|
|||
if (is_home_dir) {
|
||||
|
||||
#if HOMING_Z_WITH_PROBE && HAS_QUIET_PROBING
|
||||
if (axis == Z_AXIS && final_approach) probe.set_probing_paused(false);
|
||||
if (axis == Z_AXIS && final_approach) probe.set_devices_paused_for_probing(false);
|
||||
#endif
|
||||
|
||||
endstops.validate_homing_move();
|
||||
|
|
|
|||
|
|
@ -347,12 +347,16 @@ xyz_pos_t Probe::offset; // Initialized by settings.load
|
|||
#define DELAY_BEFORE_PROBING 25
|
||||
#endif
|
||||
|
||||
void Probe::set_probing_paused(const bool dopause) {
|
||||
/**
|
||||
* Optionally turn off noisy components so we get a cleaner probe signal.
|
||||
* Pause for at least 25ms when preparing to probe (dopause == true).
|
||||
*/
|
||||
void Probe::set_devices_paused_for_probing(const bool dopause) {
|
||||
TERN_(PROBING_HEATERS_OFF, thermalManager.pause_heaters(dopause));
|
||||
TERN_(PROBING_FANS_OFF, thermalManager.set_fans_paused(dopause));
|
||||
TERN_(PROBING_ESTEPPERS_OFF, if (dopause) stepper.disable_e_steppers());
|
||||
#if ENABLED(PROBING_STEPPERS_OFF) && DISABLED(DELTA)
|
||||
static uint8_t old_trusted;
|
||||
#if ENABLED(PROBING_STEPPERS_OFF)
|
||||
static main_axes_bits_t old_trusted;
|
||||
if (dopause) {
|
||||
old_trusted = axes_trusted;
|
||||
stepper.disable_axis(X_AXIS);
|
||||
|
|
@ -660,7 +664,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
|||
endstops.enable(true);
|
||||
#endif // SENSORLESS_PROBING
|
||||
|
||||
TERN_(HAS_QUIET_PROBING, set_probing_paused(true));
|
||||
TERN_(HAS_QUIET_PROBING, set_devices_paused_for_probing(true));
|
||||
|
||||
// Move down until the probe is triggered
|
||||
do_blocking_move_to_z(z, fr_mm_s);
|
||||
|
|
@ -668,7 +672,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
|||
// Check to see if the probe was triggered
|
||||
const bool probe_triggered = (
|
||||
#if HAS_DELTA_SENSORLESS_PROBING
|
||||
endstops.trigger_state() & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX))
|
||||
PROBE_TRIGGERED()
|
||||
#else
|
||||
TEST(endstops.trigger_state(), Z_MIN_PROBE)
|
||||
#endif
|
||||
|
|
@ -679,7 +683,7 @@ bool Probe::probe_down_to_z(const float z, const feedRate_t fr_mm_s) {
|
|||
if (probe_triggered) refresh_largest_sensorless_adj();
|
||||
#endif
|
||||
|
||||
TERN_(HAS_QUIET_PROBING, set_probing_paused(false));
|
||||
TERN_(HAS_QUIET_PROBING, set_devices_paused_for_probing(false));
|
||||
|
||||
// Re-enable stealthChop if used. Disable diag1 pin on driver.
|
||||
#if ENABLED(SENSORLESS_PROBING)
|
||||
|
|
|
|||
|
|
@ -33,6 +33,10 @@
|
|||
#include "../feature/bltouch.h"
|
||||
#endif
|
||||
|
||||
#if ANY(BD_SENSOR, HAS_DELTA_SENSORLESS_PROBING)
|
||||
#include "endstops.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../core/debug_out.h"
|
||||
|
||||
|
|
@ -45,20 +49,24 @@
|
|||
};
|
||||
#endif
|
||||
|
||||
#if ENABLED(BD_SENSOR)
|
||||
#include "endstops.h"
|
||||
#define PROBE_READ() endstops.bdp_state
|
||||
#elif USE_Z_MIN_PROBE
|
||||
#define PROBE_READ() READ(Z_MIN_PROBE_PIN)
|
||||
#if HAS_DELTA_SENSORLESS_PROBING
|
||||
#define PROBE_READ() (endstops.trigger_state() & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX)))
|
||||
#define PROBE_TRIGGERED() (PROBE_READ() != 0)
|
||||
#else
|
||||
#define PROBE_READ() READ(Z_MIN_PIN)
|
||||
#if ENABLED(BD_SENSOR)
|
||||
#define PROBE_READ() endstops.bdp_state
|
||||
#elif USE_Z_MIN_PROBE
|
||||
#define PROBE_READ() READ(Z_MIN_PROBE_PIN)
|
||||
#else
|
||||
#define PROBE_READ() READ(Z_MIN_PIN)
|
||||
#endif
|
||||
#if USE_Z_MIN_PROBE
|
||||
#define PROBE_HIT_STATE Z_MIN_PROBE_ENDSTOP_HIT_STATE
|
||||
#else
|
||||
#define PROBE_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
|
||||
#endif
|
||||
#define PROBE_TRIGGERED() (PROBE_READ() == PROBE_HIT_STATE)
|
||||
#endif
|
||||
#if USE_Z_MIN_PROBE
|
||||
#define PROBE_HIT_STATE Z_MIN_PROBE_ENDSTOP_HIT_STATE
|
||||
#else
|
||||
#define PROBE_HIT_STATE Z_MIN_ENDSTOP_HIT_STATE
|
||||
#endif
|
||||
#define PROBE_TRIGGERED() (PROBE_READ() == PROBE_HIT_STATE)
|
||||
|
||||
// In BLTOUCH HS mode, the probe travels in a deployed state.
|
||||
#define Z_TWEEN_SAFE_CLEARANCE SUM_TERN(BLTOUCH, Z_CLEARANCE_BETWEEN_PROBES, bltouch.z_extra_clearance())
|
||||
|
|
@ -347,7 +355,7 @@ public:
|
|||
#endif
|
||||
|
||||
#if HAS_QUIET_PROBING
|
||||
static void set_probing_paused(const bool p);
|
||||
static void set_devices_paused_for_probing(const bool p);
|
||||
#endif
|
||||
|
||||
#if ENABLED(PROBE_TARE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue