Browse Source

🐛 Fix Sensorless Probing compile (#24455)

Bob Kuhn 2 years 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
 abc_float_t delta_diagonal_rod_2_tower;
60
 abc_float_t delta_diagonal_rod_2_tower;
61
 float delta_clip_start_height = Z_MAX_POS;
61
 float delta_clip_start_height = Z_MAX_POS;
62
 abc_float_t delta_diagonal_rod_trim;
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
 float delta_safe_distance_from_top();
64
 float delta_safe_distance_from_top();
69
 
65
 

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

38
 extern abc_float_t delta_diagonal_rod_2_tower;
38
 extern abc_float_t delta_diagonal_rod_2_tower;
39
 extern float delta_clip_start_height;
39
 extern float delta_clip_start_height;
40
 extern abc_float_t delta_diagonal_rod_trim;
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
  * Recalculate factors used for delta kinematics whenever
43
  * Recalculate factors used for delta kinematics whenever

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

48
   #include "delta.h"
48
   #include "delta.h"
49
 #endif
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
 #if ANY(HAS_QUIET_PROBING, USE_SENSORLESS)
56
 #if ANY(HAS_QUIET_PROBING, USE_SENSORLESS)
52
   #include "stepper/indirection.h"
57
   #include "stepper/indirection.h"
53
   #if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF)
58
   #if BOTH(HAS_QUIET_PROBING, PROBING_ESTEPPERS_OFF)
867
 
872
 
868
 #endif // HAS_Z_SERVO_PROBE
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
    * Set the sensorless Z offset
878
    * Set the sensorless Z offset
904
    */
879
    */
905
   void Probe::set_offset_sensorless_adj(const_float_t sz) {
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
    * Refresh largest_sensorless_adj based on triggered endstops
888
    * Refresh largest_sensorless_adj based on triggered endstops
918
    */
889
    */
919
   void Probe::refresh_largest_sensorless_adj() {
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
 #endif // HAS_BED_PROBE
909
 #endif // HAS_BED_PROBE

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

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

Loading…
Cancel
Save