Parcourir la source

Update Endstops class for 1.1.x parity

Scott Lahteine il y a 7 ans
Parent
révision
f10c87b442
2 fichiers modifiés avec 17 ajouts et 23 suppressions
  1. 7
    12
      Marlin/src/module/endstops.cpp
  2. 10
    11
      Marlin/src/module/endstops.h

+ 7
- 12
Marlin/src/module/endstops.cpp Voir le fichier

@@ -42,26 +42,22 @@ Endstops endstops;
42 42
 bool Endstops::enabled, Endstops::enabled_globally; // Initialized by settings.load()
43 43
 volatile char Endstops::endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
44 44
 
45
-#if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
46
-  uint16_t
47
-#else
48
-  byte
49
-#endif
50
-    Endstops::current_endstop_bits = 0,
51
-    Endstops::old_endstop_bits = 0;
45
+Endstops::esbits_t Endstops::current_endstop_bits = 0,
46
+                   Endstops::old_endstop_bits = 0;
52 47
 
53 48
 #if HAS_BED_PROBE
54 49
   volatile bool Endstops::z_probe_enabled = false;
55 50
 #endif
56 51
 
52
+// Initialized by settings.load()
57 53
 #if ENABLED(X_DUAL_ENDSTOPS)
58
-  float Endstops::x_endstop_adj; // Initialized by settings.load()
54
+  float Endstops::x_endstop_adj;
59 55
 #endif
60 56
 #if ENABLED(Y_DUAL_ENDSTOPS)
61
-  float Endstops::y_endstop_adj; // Initialized by settings.load()
57
+  float Endstops::y_endstop_adj;
62 58
 #endif
63 59
 #if ENABLED(Z_DUAL_ENDSTOPS)
64
-  float Endstops::z_endstop_adj; // Initialized by settings.load()
60
+  float Endstops::z_endstop_adj;
65 61
 #endif
66 62
 
67 63
 /**
@@ -355,7 +351,7 @@ void Endstops::update() {
355 351
         _ENDSTOP_HIT(AXIS, MINMAX); \
356 352
         stepper.endstop_triggered(_AXIS(AXIS)); \
357 353
       } \
358
-    } while(0)
354
+    }while(0)
359 355
 
360 356
   #if ENABLED(G38_PROBE_TARGET) && PIN_EXISTS(Z_MIN_PROBE) && !(CORE_IS_XY || CORE_IS_XZ)
361 357
     // If G38 command is active check Z_MIN_PROBE for ALL movement
@@ -452,7 +448,6 @@ void Endstops::update() {
452 448
   /**
453 449
    * Check and update endstops according to conditions
454 450
    */
455
-
456 451
   if (X_MOVE_TEST) {
457 452
     if (stepper.motor_direction(X_AXIS_HEAD)) { // -direction
458 453
       #if HAS_X_MIN

+ 10
- 11
Marlin/src/module/endstops.h Voir le fichier

@@ -21,7 +21,7 @@
21 21
  */
22 22
 
23 23
 /**
24
- *  endstops.h - manages endstops
24
+ * endstops.h - manages endstops
25 25
  */
26 26
 
27 27
 #ifndef __ENDSTOPS_H__
@@ -53,17 +53,17 @@ class Endstops {
53 53
     static bool enabled, enabled_globally;
54 54
     static volatile char endstop_hit_bits; // use X_MIN, Y_MIN, Z_MIN and Z_MIN_PROBE as BIT value
55 55
 
56
-    #if ENABLED(X_DUAL_ENDSTOPS)
57
-      static float x_endstop_adj;
58
-    #endif
59
-    #if ENABLED(Y_DUAL_ENDSTOPS)
60
-      static float y_endstop_adj;
61
-    #endif
62
-    #if ENABLED(Z_DUAL_ENDSTOPS)
63
-      static float z_endstop_adj;
64
-    #endif
65 56
     #if ENABLED(X_DUAL_ENDSTOPS) || ENABLED(Y_DUAL_ENDSTOPS) || ENABLED(Z_DUAL_ENDSTOPS)
66 57
       typedef uint16_t esbits_t;
58
+      #if ENABLED(X_DUAL_ENDSTOPS)
59
+        static float x_endstop_adj;
60
+      #endif
61
+      #if ENABLED(Y_DUAL_ENDSTOPS)
62
+        static float y_endstop_adj;
63
+      #endif
64
+      #if ENABLED(Z_DUAL_ENDSTOPS)
65
+        static float z_endstop_adj;
66
+      #endif
67 67
     #else
68 68
       typedef byte esbits_t;
69 69
     #endif
@@ -152,5 +152,4 @@ extern Endstops endstops;
152 152
   #define ENDSTOPS_ENABLED  endstops.enabled
153 153
 #endif
154 154
 
155
-
156 155
 #endif // __ENDSTOPS_H__

Chargement…
Annuler
Enregistrer