Skip to content

Commit

Permalink
🎨 Apply more HAS_DELTA_SENSORLESS_PROBING
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Oct 3, 2021
1 parent d6a87aa commit 17c9450
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Marlin/src/gcode/calibrate/G33.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ void GcodeSuite::G33() {

const bool stow_after_each = parser.seen_test('E');

#if ENABLED(SENSORLESS_PROBING)
#if HAS_DELTA_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'));
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/delta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void home_delta() {
current_position.z = DIFF_TERN(HAS_BED_PROBE, delta_height + 10, probe.offset.z);
line_to_current_position(homing_feedrate(Z_AXIS));
planner.synchronize();
TERN_(SENSORLESS_PROBING,endstops.report_states());
TERN_(HAS_DELTA_SENSORLESS_PROBING, endstops.report_states());

// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_HOMING) && DISABLED(ENDSTOPS_ALWAYS_ON_DEFAULT)
Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/module/endstops.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,7 +595,7 @@ void _O2 Endstops::report_states() {
// The following routines are called from an ISR context. It could be the temperature ISR, the
// endstop ISR or the Stepper ISR.

#if BOTH(DELTA, SENSORLESS_PROBING)
#if HAS_DELTA_SENSORLESS_PROBING
#define __ENDSTOP(AXIS, ...) AXIS ##_MAX
#define _ENDSTOP_PIN(AXIS, ...) AXIS ##_MAX_PIN
#define _ENDSTOP_INVERTING(AXIS, ...) AXIS ##_MAX_ENDSTOP_INVERTING
Expand Down
14 changes: 7 additions & 7 deletions Marlin/src/module/probe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
// Disable stealthChop if used. Enable diag1 pin on driver.
#if ENABLED(SENSORLESS_PROBING)
sensorless_t stealth_states { false };
#if ENABLED(DELTA)
#if HAS_DELTA_SENSORLESS_PROBING
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
Expand All @@ -509,7 +509,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {

// Check to see if the probe was triggered
const bool probe_triggered =
#if BOTH(DELTA, SENSORLESS_PROBING)
#if HAS_DELTA_SENSORLESS_PROBING
endstops.trigger_state() & (_BV(X_MAX) | _BV(Y_MAX) | _BV(Z_MAX))
#else
TEST(endstops.trigger_state(), Z_MIN_PROBE)
Expand All @@ -521,7 +521,7 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
// Re-enable stealthChop if used. Disable diag1 pin on driver.
#if ENABLED(SENSORLESS_PROBING)
endstops.not_homing();
#if ENABLED(DELTA)
#if HAS_DELTA_SENSORLESS_PROBING
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
Expand Down Expand Up @@ -765,7 +765,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
#endif

// On delta keep Z below clip height or do_blocking_move_to will abort
xyz_pos_t npos = { rx, ry, _MIN(TERN(DELTA, delta_clip_start_height, current_position.z), current_position.z) };
xyz_pos_t npos = { rx, ry, TERN(DELTA, _MIN(delta_clip_start_height, current_position.z), current_position.z) };
if (probe_relative) { // The given position is in terms of the probe
if (!can_reach(npos)) {
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("Position Not Reachable");
Expand Down Expand Up @@ -827,7 +827,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
*/
void Probe::enable_stallguard_diag1() {
#if ENABLED(SENSORLESS_PROBING)
#if ENABLED(DELTA)
#if HAS_DELTA_SENSORLESS_PROBING
stealth_states.x = tmc_enable_stallguard(stepperX);
stealth_states.y = tmc_enable_stallguard(stepperY);
#endif
Expand All @@ -842,7 +842,7 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
void Probe::disable_stallguard_diag1() {
#if ENABLED(SENSORLESS_PROBING)
endstops.not_homing();
#if ENABLED(DELTA)
#if HAS_DELTA_SENSORLESS_PROBING
tmc_disable_stallguard(stepperX, stealth_states.x);
tmc_disable_stallguard(stepperY, stealth_states.y);
#endif
Expand Down Expand Up @@ -907,6 +907,6 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
#endif
}

#endif // SENSORLESS_PROBING
#endif // SENSORLESS_PROBING || SENSORLESS_HOMING

#endif // HAS_BED_PROBE

0 comments on commit 17c9450

Please sign in to comment.