|
@@ -68,7 +68,7 @@
|
68
|
68
|
#include "servo.h"
|
69
|
69
|
#endif
|
70
|
70
|
|
71
|
|
-#if ENABLED(SENSORLESS_PROBING)
|
|
71
|
+#if EITHER(SENSORLESS_PROBING, SENSORLESS_HOMING)
|
72
|
72
|
#include "stepper.h"
|
73
|
73
|
#include "../feature/tmc_util.h"
|
74
|
74
|
#endif
|
|
@@ -92,6 +92,10 @@ xyz_pos_t Probe::offset; // Initialized by settings.load()
|
92
|
92
|
const xy_pos_t &Probe::offset_xy = Probe::offset;
|
93
|
93
|
#endif
|
94
|
94
|
|
|
95
|
+#if ENABLED(SENSORLESS_PROBING)
|
|
96
|
+ Probe::sense_bool_t Probe::test_sensitivity;
|
|
97
|
+#endif
|
|
98
|
+
|
95
|
99
|
#if ENABLED(Z_PROBE_SLED)
|
96
|
100
|
|
97
|
101
|
#ifndef SLED_DOCKING_OFFSET
|
|
@@ -493,11 +497,12 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
|
493
|
497
|
#if ENABLED(SENSORLESS_PROBING)
|
494
|
498
|
sensorless_t stealth_states { false };
|
495
|
499
|
#if ENABLED(DELTA)
|
496
|
|
- stealth_states.x = tmc_enable_stallguard(stepperX);
|
497
|
|
- stealth_states.y = tmc_enable_stallguard(stepperY);
|
|
500
|
+ if (probe.test_sensitivity.x) stealth_states.x = tmc_enable_stallguard(stepperX); // Delta watches all DIAG pins for a stall
|
|
501
|
+ if (probe.test_sensitivity.y) stealth_states.y = tmc_enable_stallguard(stepperY);
|
498
|
502
|
#endif
|
499
|
|
- stealth_states.z = tmc_enable_stallguard(stepperZ);
|
|
503
|
+ if (probe.test_sensitivity.z) stealth_states.z = tmc_enable_stallguard(stepperZ); // All machines will check Z-DIAG for stall
|
500
|
504
|
endstops.enable(true);
|
|
505
|
+ set_homing_current(true); // The "homing" current also applies to probing
|
501
|
506
|
#endif
|
502
|
507
|
|
503
|
508
|
TERN_(HAS_QUIET_PROBING, set_probing_paused(true));
|
|
@@ -520,10 +525,11 @@ bool Probe::probe_down_to_z(const_float_t z, const_feedRate_t fr_mm_s) {
|
520
|
525
|
#if ENABLED(SENSORLESS_PROBING)
|
521
|
526
|
endstops.not_homing();
|
522
|
527
|
#if ENABLED(DELTA)
|
523
|
|
- tmc_disable_stallguard(stepperX, stealth_states.x);
|
524
|
|
- tmc_disable_stallguard(stepperY, stealth_states.y);
|
|
528
|
+ if (probe.test_sensitivity.x) tmc_disable_stallguard(stepperX, stealth_states.x);
|
|
529
|
+ if (probe.test_sensitivity.y) tmc_disable_stallguard(stepperY, stealth_states.y);
|
525
|
530
|
#endif
|
526
|
|
- tmc_disable_stallguard(stepperZ, stealth_states.z);
|
|
531
|
+ if (probe.test_sensitivity.z) tmc_disable_stallguard(stepperZ, stealth_states.z);
|
|
532
|
+ set_homing_current(false);
|
527
|
533
|
#endif
|
528
|
534
|
|
529
|
535
|
if (probe_triggered && TERN0(BLTOUCH_SLOW_MODE, bltouch.stow())) // Stow in LOW SPEED MODE on every trigger
|
|
@@ -815,4 +821,93 @@ float Probe::probe_at_point(const_float_t rx, const_float_t ry, const ProbePtRai
|
815
|
821
|
|
816
|
822
|
#endif // HAS_Z_SERVO_PROBE
|
817
|
823
|
|
|
824
|
+#if EITHER(SENSORLESS_PROBING, SENSORLESS_HOMING)
|
|
825
|
+
|
|
826
|
+ sensorless_t stealth_states { false };
|
|
827
|
+
|
|
828
|
+ /**
|
|
829
|
+ * Disable stealthChop if used. Enable diag1 pin on driver.
|
|
830
|
+ */
|
|
831
|
+ void Probe::enable_stallguard_diag1() {
|
|
832
|
+ #if ENABLED(SENSORLESS_PROBING)
|
|
833
|
+ #if ENABLED(DELTA)
|
|
834
|
+ stealth_states.x = tmc_enable_stallguard(stepperX);
|
|
835
|
+ stealth_states.y = tmc_enable_stallguard(stepperY);
|
|
836
|
+ #endif
|
|
837
|
+ stealth_states.z = tmc_enable_stallguard(stepperZ);
|
|
838
|
+ endstops.enable(true);
|
|
839
|
+ #endif
|
|
840
|
+ }
|
|
841
|
+
|
|
842
|
+ /**
|
|
843
|
+ * Re-enable stealthChop if used. Disable diag1 pin on driver.
|
|
844
|
+ */
|
|
845
|
+ void Probe::disable_stallguard_diag1() {
|
|
846
|
+ #if ENABLED(SENSORLESS_PROBING)
|
|
847
|
+ endstops.not_homing();
|
|
848
|
+ #if ENABLED(DELTA)
|
|
849
|
+ tmc_disable_stallguard(stepperX, stealth_states.x);
|
|
850
|
+ tmc_disable_stallguard(stepperY, stealth_states.y);
|
|
851
|
+ #endif
|
|
852
|
+ tmc_disable_stallguard(stepperZ, stealth_states.z);
|
|
853
|
+ #endif
|
|
854
|
+ }
|
|
855
|
+
|
|
856
|
+ /**
|
|
857
|
+ * Change the current in the TMC drivers to N##_CURRENT_HOME. And we save the current configuration of each TMC driver.
|
|
858
|
+ */
|
|
859
|
+ void Probe::set_homing_current(const bool onoff) {
|
|
860
|
+ #define HAS_CURRENT_HOME(N) (defined(N##_CURRENT_HOME) && N##_CURRENT_HOME != N##_CURRENT)
|
|
861
|
+ #if HAS_CURRENT_HOME(X) || HAS_CURRENT_HOME(Y) || HAS_CURRENT_HOME(Z)
|
|
862
|
+ #if ENABLED(DELTA)
|
|
863
|
+ static int16_t saved_current_X, saved_current_Y;
|
|
864
|
+ #endif
|
|
865
|
+ #if HAS_CURRENT_HOME(Z)
|
|
866
|
+ static int16_t saved_current_Z;
|
|
867
|
+ #endif
|
|
868
|
+ auto debug_current_on = [](PGM_P const s, const int16_t a, const int16_t b) {
|
|
869
|
+ if (DEBUGGING(LEVELING)) { DEBUG_ECHOPGM_P(s); DEBUG_ECHOLNPAIR(" current: ", a, " -> ", b); }
|
|
870
|
+ };
|
|
871
|
+ if (onoff) {
|
|
872
|
+ #if ENABLED(DELTA)
|
|
873
|
+ #if HAS_CURRENT_HOME(X)
|
|
874
|
+ saved_current_X = stepperX.getMilliamps();
|
|
875
|
+ stepperX.rms_current(X_CURRENT_HOME);
|
|
876
|
+ debug_current_on(PSTR("X"), saved_current_X, X_CURRENT_HOME);
|
|
877
|
+ #endif
|
|
878
|
+ #if HAS_CURRENT_HOME(Y)
|
|
879
|
+ saved_current_Y = stepperY.getMilliamps();
|
|
880
|
+ stepperY.rms_current(Y_CURRENT_HOME);
|
|
881
|
+ debug_current_on(PSTR("Y"), saved_current_Y, Y_CURRENT_HOME);
|
|
882
|
+ #endif
|
|
883
|
+ #endif
|
|
884
|
+ #if HAS_CURRENT_HOME(Z)
|
|
885
|
+ saved_current_Z = stepperZ.getMilliamps();
|
|
886
|
+ stepperZ.rms_current(Z_CURRENT_HOME);
|
|
887
|
+ debug_current_on(PSTR("Z"), saved_current_Z, Z_CURRENT_HOME);
|
|
888
|
+ #endif
|
|
889
|
+ TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(true));
|
|
890
|
+ }
|
|
891
|
+ else {
|
|
892
|
+ #if ENABLED(DELTA)
|
|
893
|
+ #if HAS_CURRENT_HOME(X)
|
|
894
|
+ stepperX.rms_current(saved_current_X);
|
|
895
|
+ debug_current_on(PSTR("X"), X_CURRENT_HOME, saved_current_X);
|
|
896
|
+ #endif
|
|
897
|
+ #if HAS_CURRENT_HOME(Y)
|
|
898
|
+ stepperY.rms_current(saved_current_Y);
|
|
899
|
+ debug_current_on(PSTR("Y"), Y_CURRENT_HOME, saved_current_Y);
|
|
900
|
+ #endif
|
|
901
|
+ #endif
|
|
902
|
+ #if HAS_CURRENT_HOME(Z)
|
|
903
|
+ stepperZ.rms_current(saved_current_Z);
|
|
904
|
+ debug_current_on(PSTR("Z"), Z_CURRENT_HOME, saved_current_Z);
|
|
905
|
+ #endif
|
|
906
|
+ TERN_(IMPROVE_HOMING_RELIABILITY, planner.enable_stall_prevention(false));
|
|
907
|
+ }
|
|
908
|
+ #endif
|
|
909
|
+ }
|
|
910
|
+
|
|
911
|
+#endif // SENSORLESS_PROBING
|
|
912
|
+
|
818
|
913
|
#endif // HAS_BED_PROBE
|