diff --git a/Marlin/src/gcode/calibrate/G33.cpp b/Marlin/src/gcode/calibrate/G33.cpp index e83213c68c220..a897a101157c6 100644 --- a/Marlin/src/gcode/calibrate/G33.cpp +++ b/Marlin/src/gcode/calibrate/G33.cpp @@ -387,9 +387,11 @@ static float auto_tune_a() { * * E Engage the probe for each point * - * X It will not activate stallguard for the X axis. Use with SENSORLESS_PROBING, to calibrate the sensitivity individually on each axis. Fe. G33 P1 Y Z --> To calibrate only X. - * Y It will not activate stallguard for the Y axis. Use with SENSORLESS_PROBING, to calibrate the sensitivity individually on each axis. Fe. G33 P1 X Z --> To calibrate only Y. - * Z It will not activate stallguard for the Z axis. Use with SENSORLESS_PROBING, to calibrate the sensitivity individually on each axis. Fe. G33 P1 X Y --> To calibrate only Z. + * With SENSORLESS_PROBING: + * Use these flags to calibrate stall sensitivity: (e.g., `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. */ void GcodeSuite::G33() { @@ -423,10 +425,10 @@ void GcodeSuite::G33() { const bool stow_after_each = parser.seen_test('E'); - #if ENABLED(HAS_BED_PROBE) - probe.test_sensitivity_X = !parser.seen_test('X'); - probe.test_sensitivity_Y = !parser.seen_test('Y'); - probe.test_sensitivity_Z = !parser.seen_test('Z'); + #if ENABLED(SENSORLESS_PROBING) + probe.test_sensitivity.x = !parser.seen_test('X'); + TERN_(HAS_Y_AXIS, probe.test_sensitivity.y = !parser.seen_test('Y')); + TERN_(HAS_Z_AXIS, probe.test_sensitivity.z = !parser.seen_test('Z')); #endif const bool _0p_calibration = probe_points == 0, diff --git a/Marlin/src/module/probe.cpp b/Marlin/src/module/probe.cpp index 4a88d8f9ffc7b..3e9809b985afe 100644 --- a/Marlin/src/module/probe.cpp +++ b/Marlin/src/module/probe.cpp @@ -92,6 +92,10 @@ xyz_pos_t Probe::offset; // Initialized by settings.load() const xy_pos_t &Probe::offset_xy = Probe::offset; #endif +#if ENABLED(SENSORLESS_PROBING) + struct { bool x:1, y:1, z:1; } Probe::test_sensitivity; +#endif + #if ENABLED(Z_PROBE_SLED) #ifndef SLED_DOCKING_OFFSET @@ -493,10 +497,10 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { #if ENABLED(SENSORLESS_PROBING) sensorless_t stealth_states { false }; #if ENABLED(DELTA) - if (probe.test_sensitivity_X) stealth_states.x = tmc_enable_stallguard(stepperX); // Delta watches all DIAG pins for a stall - if (probe.test_sensitivity_Y) stealth_states.y = tmc_enable_stallguard(stepperY); + if (probe.test_sensitivity.x) stealth_states.x = tmc_enable_stallguard(stepperX); // Delta watches all DIAG pins for a stall + if (probe.test_sensitivity.y) stealth_states.y = tmc_enable_stallguard(stepperY); #endif - if (probe.test_sensitivity_Z) stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall + if (probe.test_sensitivity.z) stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall endstops.enable(true); set_homing_current(true); // The "homing" current also applies to probing #endif @@ -521,10 +525,10 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) { #if ENABLED(SENSORLESS_PROBING) endstops.not_homing(); #if ENABLED(DELTA) - if (probe.test_sensitivity_X) tmc_disable_stallguard(stepperX, stealth_states.x); - if (probe.test_sensitivity_Y) tmc_disable_stallguard(stepperY, stealth_states.y); + if (probe.test_sensitivity.x) tmc_disable_stallguard(stepperX, stealth_states.x); + if (probe.test_sensitivity.y) tmc_disable_stallguard(stepperY, stealth_states.y); #endif - if (probe.test_sensitivity_Z) tmc_disable_stallguard(stepperZ, stealth_states.z); + if (probe.test_sensitivity.z) tmc_disable_stallguard(stepperZ, stealth_states.z); set_homing_current(false); #endif @@ -820,6 +824,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai #if EITHER(SENSORLESS_PROBING, SENSORLESS_HOMING) sensorless_t stealth_states { false }; + /** * Disable stealthChop if used. Enable diag1 pin on driver. */ @@ -833,7 +838,8 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai endstops.enable(true); #endif } - /** + + /** * Re-enable stealthChop if used. Disable diag1 pin on driver. */ void Probe::disable_stallguard_diag1() { @@ -845,7 +851,6 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai #endif tmc_disable_stallguard(stepperZ, stealth_states.z); #endif - } /** diff --git a/Marlin/src/module/probe.h b/Marlin/src/module/probe.h index 5f0e722ffd7d1..04be34b7465a2 100644 --- a/Marlin/src/module/probe.h +++ b/Marlin/src/module/probe.h @@ -56,6 +56,10 @@ class Probe { public: + #if ENABLED(SENSORLESS_PROBING) + static struct { bool x:1, y:1, z:1; } test_sensitivity; + #endif + #if HAS_BED_PROBE static xyz_pos_t offset; @@ -263,11 +267,6 @@ class Probe { static void set_homing_current(const bool onoff); #endif -public: - bool test_sensitivity_X; - bool test_sensitivity_Y; - bool test_sensitivity_Z; - private: static bool probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s); static void do_z_raise(const float z_raise);