1
0
mirror of https://github.com/MarlinFirmware/Marlin.git synced 2024-11-30 15:26:18 +00:00

🐛 Fix Sensorless Probing compile (#24455)

This commit is contained in:
Bob Kuhn 2022-07-06 08:35:08 -05:00 committed by Scott Lahteine
parent 893707711e
commit d3aed23e18
4 changed files with 30 additions and 73 deletions

View File

@ -60,10 +60,6 @@ xy_float_t delta_tower[ABC];
abc_float_t delta_diagonal_rod_2_tower; abc_float_t delta_diagonal_rod_2_tower;
float delta_clip_start_height = Z_MAX_POS; float delta_clip_start_height = Z_MAX_POS;
abc_float_t delta_diagonal_rod_trim; abc_float_t delta_diagonal_rod_trim;
#if HAS_DELTA_SENSORLESS_PROBING
abc_float_t offset_sensorless_adj{0};
float largest_sensorless_adj = 0;
#endif
float delta_safe_distance_from_top(); float delta_safe_distance_from_top();

View File

@ -38,10 +38,6 @@ extern xy_float_t delta_tower[ABC];
extern abc_float_t delta_diagonal_rod_2_tower; extern abc_float_t delta_diagonal_rod_2_tower;
extern float delta_clip_start_height; extern float delta_clip_start_height;
extern abc_float_t delta_diagonal_rod_trim; extern abc_float_t delta_diagonal_rod_trim;
#if HAS_DELTA_SENSORLESS_PROBING
extern abc_float_t offset_sensorless_adj;
extern float largest_sensorless_adj;
#endif
/** /**
* Recalculate factors used for delta kinematics whenever * Recalculate factors used for delta kinematics whenever

View File

@ -48,6 +48,11 @@
#include "delta.h" #include "delta.h"
#endif #endif
#if ENABLED(SENSORLESS_PROBING)
abc_float_t offset_sensorless_adj{0};
float largest_sensorless_adj = 0;
#endif
#if ANY(HAS_QUIET_PROBING, USE_SENSORLESS) #if ANY(HAS_QUIET_PROBING, USE_SENSORLESS)
#include "stepper/indirection.h" #include "stepper/indirection.h"
#if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF) #if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF)
@ -867,60 +872,24 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
#endif // HAS_Z_SERVO_PROBE #endif // HAS_Z_SERVO_PROBE
#if USE_SENSORLESS
sensorless_t stealth_states { false };
/**
* Disable stealthChop if used. Enable diag1 pin on driver.
*/
void Probe::enable_stallguard_diag1() {
#if ENABLED(SENSORLESS_PROBING)
#if HAS_DELTA_SENSORLESS_PROBING #if HAS_DELTA_SENSORLESS_PROBING
stealth_states.x = tmc_enable_stallguard(stepperX);
stealth_states.y = tmc_enable_stallguard(stepperY);
#endif
stealth_states.z = tmc_enable_stallguard(stepperZ);
endstops.enable(true);
#endif
}
/**
* Re-enable stealthChop if used. Disable diag1 pin on driver.
*/
void Probe::disable_stallguard_diag1() {
#if ENABLED(SENSORLESS_PROBING)
endstops.not_homing();
#if HAS_DELTA_SENSORLESS_PROBING
tmc_disable_stallguard(stepperX, stealth_states.x);
tmc_disable_stallguard(stepperY, stealth_states.y);
#endif
tmc_disable_stallguard(stepperZ, stealth_states.z);
#endif
}
/** /**
* Set the sensorless Z offset * Set the sensorless Z offset
*/ */
void Probe::set_offset_sensorless_adj(const_float_t sz) { void Probe::set_offset_sensorless_adj(const_float_t sz) {
#if ENABLED(SENSORLESS_PROBING)
DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true); DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true);
#if HAS_DELTA_SENSORLESS_PROBING
if (test_sensitivity.x) offset_sensorless_adj.a = sz; if (test_sensitivity.x) offset_sensorless_adj.a = sz;
if (test_sensitivity.y) offset_sensorless_adj.b = sz; if (test_sensitivity.y) offset_sensorless_adj.b = sz;
#endif
if (test_sensitivity.z) offset_sensorless_adj.c = sz; if (test_sensitivity.z) offset_sensorless_adj.c = sz;
#endif
} }
/** /**
* Refresh largest_sensorless_adj based on triggered endstops * Refresh largest_sensorless_adj based on triggered endstops
*/ */
void Probe::refresh_largest_sensorless_adj() { void Probe::refresh_largest_sensorless_adj() {
#if ENABLED(SENSORLESS_PROBING)
DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true); DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true);
largest_sensorless_adj = -3; // A reference away from any real probe height largest_sensorless_adj = -3; // A reference away from any real probe height
#if HAS_DELTA_SENSORLESS_PROBING
if (TEST(endstops.state(), X_MAX)) { if (TEST(endstops.state(), X_MAX)) {
NOLESS(largest_sensorless_adj, offset_sensorless_adj.a); NOLESS(largest_sensorless_adj, offset_sensorless_adj.a);
DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX"); DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX");
@ -929,14 +898,12 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
NOLESS(largest_sensorless_adj, offset_sensorless_adj.b); NOLESS(largest_sensorless_adj, offset_sensorless_adj.b);
DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY"); DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY");
} }
#endif
if (TEST(endstops.state(), Z_MAX)) { if (TEST(endstops.state(), Z_MAX)) {
NOLESS(largest_sensorless_adj, offset_sensorless_adj.c); NOLESS(largest_sensorless_adj, offset_sensorless_adj.c);
DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ"); DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ");
} }
#endif
} }
#endif // SENSORLESS_PROBING || SENSORLESS_HOMING #endif
#endif // HAS_BED_PROBE #endif // HAS_BED_PROBE

View File

@ -62,16 +62,16 @@
#endif #endif
#endif #endif
#if ENABLED(SENSORLESS_PROBING)
extern abc_float_t offset_sensorless_adj;
#endif
class Probe { class Probe {
public: public:
#if ENABLED(SENSORLESS_PROBING) #if ENABLED(SENSORLESS_PROBING)
typedef struct { typedef struct {
#if HAS_DELTA_SENSORLESS_PROBING
bool x:1, y:1, z:1; bool x:1, y:1, z:1;
#else
bool z;
#endif
} sense_bool_t; } sense_bool_t;
static sense_bool_t test_sensitivity; static sense_bool_t test_sensitivity;
#endif #endif
@ -302,9 +302,7 @@ public:
#endif #endif
// Basic functions for Sensorless Homing and Probing // Basic functions for Sensorless Homing and Probing
#if USE_SENSORLESS #if HAS_DELTA_SENSORLESS_PROBING
static void enable_stallguard_diag1();
static void disable_stallguard_diag1();
static void set_offset_sensorless_adj(const_float_t sz); static void set_offset_sensorless_adj(const_float_t sz);
static void refresh_largest_sensorless_adj(); static void refresh_largest_sensorless_adj();
#endif #endif