Browse Source

🐛 Fix Sensorless Probing compile (#24455)

Bob Kuhn 1 year ago
parent
commit
a88e847295
4 changed files with 30 additions and 73 deletions
  1. 0
    4
      Marlin/src/module/delta.cpp
  2. 0
    4
      Marlin/src/module/delta.h
  3. 25
    58
      Marlin/src/module/probe.cpp
  4. 5
    7
      Marlin/src/module/probe.h

+ 0
- 4
Marlin/src/module/delta.cpp View File

@@ -60,10 +60,6 @@ xy_float_t delta_tower[ABC];
60 60
 abc_float_t delta_diagonal_rod_2_tower;
61 61
 float delta_clip_start_height = Z_MAX_POS;
62 62
 abc_float_t delta_diagonal_rod_trim;
63
-#if HAS_DELTA_SENSORLESS_PROBING
64
-  abc_float_t offset_sensorless_adj{0};
65
-  float largest_sensorless_adj = 0;
66
-#endif
67 63
 
68 64
 float delta_safe_distance_from_top();
69 65
 

+ 0
- 4
Marlin/src/module/delta.h View File

@@ -38,10 +38,6 @@ extern xy_float_t delta_tower[ABC];
38 38
 extern abc_float_t delta_diagonal_rod_2_tower;
39 39
 extern float delta_clip_start_height;
40 40
 extern abc_float_t delta_diagonal_rod_trim;
41
-#if HAS_DELTA_SENSORLESS_PROBING
42
-  extern abc_float_t offset_sensorless_adj;
43
-  extern float largest_sensorless_adj;
44
-#endif
45 41
 
46 42
 /**
47 43
  * Recalculate factors used for delta kinematics whenever

+ 25
- 58
Marlin/src/module/probe.cpp View File

@@ -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

+ 5
- 7
Marlin/src/module/probe.h View File

@@ -62,16 +62,16 @@
62 62
   #endif
63 63
 #endif
64 64
 
65
+#if ENABLED(SENSORLESS_PROBING)
66
+  extern abc_float_t offset_sensorless_adj;
67
+#endif
68
+
65 69
 class Probe {
66 70
 public:
67 71
 
68 72
   #if ENABLED(SENSORLESS_PROBING)
69 73
     typedef struct {
70
-      #if HAS_DELTA_SENSORLESS_PROBING
71 74
         bool x:1, y:1, z:1;
72
-      #else
73
-        bool z;
74
-      #endif
75 75
     } sense_bool_t;
76 76
     static sense_bool_t test_sensitivity;
77 77
   #endif
@@ -302,9 +302,7 @@ public:
302 302
   #endif
303 303
 
304 304
   // Basic functions for Sensorless Homing and Probing
305
-  #if USE_SENSORLESS
306
-    static void enable_stallguard_diag1();
307
-    static void disable_stallguard_diag1();
305
+  #if HAS_DELTA_SENSORLESS_PROBING
308 306
     static void set_offset_sensorless_adj(const_float_t sz);
309 307
     static void refresh_largest_sensorless_adj();
310 308
   #endif

Loading…
Cancel
Save