|
@@ -48,6 +48,11 @@
|
48
|
48
|
#include "delta.h"
|
49
|
49
|
#endif
|
50
|
50
|
|
|
51
|
+#if ENABLED(SENSORLESS_PROBING)
|
|
52
|
+ abc_float_t offset_sensorless_adj{0};
|
|
53
|
+ float largest_sensorless_adj = 0;
|
|
54
|
+#endif
|
|
55
|
+
|
51
|
56
|
#if ANY(HAS_QUIET_PROBING, USE_SENSORLESS)
|
52
|
57
|
#include "stepper/indirection.h"
|
53
|
58
|
#if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF)
|
|
@@ -867,76 +872,38 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
|
867
|
872
|
|
868
|
873
|
#endif // HAS_Z_SERVO_PROBE
|
869
|
874
|
|
870
|
|
-#if USE_SENSORLESS
|
871
|
|
-
|
872
|
|
- sensorless_t stealth_states { false };
|
873
|
|
-
|
874
|
|
- /**
|
875
|
|
- * Disable stealthChop if used. Enable diag1 pin on driver.
|
876
|
|
- */
|
877
|
|
- void Probe::enable_stallguard_diag1() {
|
878
|
|
- #if ENABLED(SENSORLESS_PROBING)
|
879
|
|
- #if HAS_DELTA_SENSORLESS_PROBING
|
880
|
|
- stealth_states.x = tmc_enable_stallguard(stepperX);
|
881
|
|
- stealth_states.y = tmc_enable_stallguard(stepperY);
|
882
|
|
- #endif
|
883
|
|
- stealth_states.z = tmc_enable_stallguard(stepperZ);
|
884
|
|
- endstops.enable(true);
|
885
|
|
- #endif
|
886
|
|
- }
|
887
|
|
-
|
888
|
|
- /**
|
889
|
|
- * Re-enable stealthChop if used. Disable diag1 pin on driver.
|
890
|
|
- */
|
891
|
|
- void Probe::disable_stallguard_diag1() {
|
892
|
|
- #if ENABLED(SENSORLESS_PROBING)
|
893
|
|
- endstops.not_homing();
|
894
|
|
- #if HAS_DELTA_SENSORLESS_PROBING
|
895
|
|
- tmc_disable_stallguard(stepperX, stealth_states.x);
|
896
|
|
- tmc_disable_stallguard(stepperY, stealth_states.y);
|
897
|
|
- #endif
|
898
|
|
- tmc_disable_stallguard(stepperZ, stealth_states.z);
|
899
|
|
- #endif
|
900
|
|
- }
|
|
875
|
+#if HAS_DELTA_SENSORLESS_PROBING
|
901
|
876
|
|
902
|
877
|
/**
|
903
|
878
|
* Set the sensorless Z offset
|
904
|
879
|
*/
|
905
|
880
|
void Probe::set_offset_sensorless_adj(const_float_t sz) {
|
906
|
|
- #if ENABLED(SENSORLESS_PROBING)
|
907
|
|
- DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true);
|
908
|
|
- #if HAS_DELTA_SENSORLESS_PROBING
|
909
|
|
- if (test_sensitivity.x) offset_sensorless_adj.a = sz;
|
910
|
|
- if (test_sensitivity.y) offset_sensorless_adj.b = sz;
|
911
|
|
- #endif
|
912
|
|
- if (test_sensitivity.z) offset_sensorless_adj.c = sz;
|
913
|
|
- #endif
|
|
881
|
+ DEBUG_SECTION(pso, "Probe::set_offset_sensorless_adj", true);
|
|
882
|
+ if (test_sensitivity.x) offset_sensorless_adj.a = sz;
|
|
883
|
+ if (test_sensitivity.y) offset_sensorless_adj.b = sz;
|
|
884
|
+ if (test_sensitivity.z) offset_sensorless_adj.c = sz;
|
914
|
885
|
}
|
915
|
886
|
|
916
|
887
|
/**
|
917
|
888
|
* Refresh largest_sensorless_adj based on triggered endstops
|
918
|
889
|
*/
|
919
|
890
|
void Probe::refresh_largest_sensorless_adj() {
|
920
|
|
- #if ENABLED(SENSORLESS_PROBING)
|
921
|
|
- DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true);
|
922
|
|
- largest_sensorless_adj = -3; // A reference away from any real probe height
|
923
|
|
- #if HAS_DELTA_SENSORLESS_PROBING
|
924
|
|
- if (TEST(endstops.state(), X_MAX)) {
|
925
|
|
- NOLESS(largest_sensorless_adj, offset_sensorless_adj.a);
|
926
|
|
- DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX");
|
927
|
|
- }
|
928
|
|
- if (TEST(endstops.state(), Y_MAX)) {
|
929
|
|
- NOLESS(largest_sensorless_adj, offset_sensorless_adj.b);
|
930
|
|
- DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY");
|
931
|
|
- }
|
932
|
|
- #endif
|
933
|
|
- if (TEST(endstops.state(), Z_MAX)) {
|
934
|
|
- NOLESS(largest_sensorless_adj, offset_sensorless_adj.c);
|
935
|
|
- DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ");
|
936
|
|
- }
|
937
|
|
- #endif
|
|
891
|
+ DEBUG_SECTION(rso, "Probe::refresh_largest_sensorless_adj", true);
|
|
892
|
+ largest_sensorless_adj = -3; // A reference away from any real probe height
|
|
893
|
+ if (TEST(endstops.state(), X_MAX)) {
|
|
894
|
+ NOLESS(largest_sensorless_adj, offset_sensorless_adj.a);
|
|
895
|
+ DEBUG_ECHOLNPGM("Endstop_X: ", largest_sensorless_adj, " TowerX");
|
|
896
|
+ }
|
|
897
|
+ if (TEST(endstops.state(), Y_MAX)) {
|
|
898
|
+ NOLESS(largest_sensorless_adj, offset_sensorless_adj.b);
|
|
899
|
+ DEBUG_ECHOLNPGM("Endstop_Y: ", largest_sensorless_adj, " TowerY");
|
|
900
|
+ }
|
|
901
|
+ if (TEST(endstops.state(), Z_MAX)) {
|
|
902
|
+ NOLESS(largest_sensorless_adj, offset_sensorless_adj.c);
|
|
903
|
+ DEBUG_ECHOLNPGM("Endstop_Z: ", largest_sensorless_adj, " TowerZ");
|
|
904
|
+ }
|
938
|
905
|
}
|
939
|
906
|
|
940
|
|
-#endif // SENSORLESS_PROBING || SENSORLESS_HOMING
|
|
907
|
+#endif
|
941
|
908
|
|
942
|
909
|
#endif // HAS_BED_PROBE
|