Procházet zdrojové kódy

Backlash linker error workaround

Fix #14045
Scott Lahteine před 5 roky
rodič
revize
cfca07852a
2 změnil soubory, kde provedl 16 přidání a 9 odebrání
  1. 8
    3
      Marlin/src/feature/backlash.cpp
  2. 8
    6
      Marlin/src/feature/backlash.h

+ 8
- 3
Marlin/src/feature/backlash.cpp Zobrazit soubor

@@ -29,11 +29,16 @@
29 29
 #include "../module/motion.h"
30 30
 #include "../module/planner.h"
31 31
 
32
-#if ENABLED(BACKLASH_GCODE)
33
-  uint8_t Backlash::correction = (BACKLASH_CORRECTION) * 0xFF;
34
-  #ifdef BACKLASH_DISTANCE_MM
32
+#ifdef BACKLASH_DISTANCE_MM
33
+  #if ENABLED(BACKLASH_GCODE)
35 34
     float Backlash::distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
35
+  #else
36
+    const float Backlash::distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
36 37
   #endif
38
+#endif
39
+
40
+#if ENABLED(BACKLASH_GCODE)
41
+  uint8_t Backlash::correction = (BACKLASH_CORRECTION) * 0xFF;
37 42
   #ifdef BACKLASH_SMOOTHING_MM
38 43
     float Backlash::smoothing_mm = BACKLASH_SMOOTHING_MM;
39 44
   #endif

+ 8
- 6
Marlin/src/feature/backlash.h Zobrazit soubor

@@ -26,11 +26,16 @@
26 26
 
27 27
 class Backlash {
28 28
 public:
29
-  #if ENABLED(BACKLASH_GCODE)
30
-    static uint8_t correction;
31
-    #ifdef BACKLASH_DISTANCE_MM
29
+  #ifdef BACKLASH_DISTANCE_MM
30
+    #if ENABLED(BACKLASH_GCODE)
32 31
       static float distance_mm[XYZ];
32
+    #else
33
+      static const float distance_mm[XYZ];
34
+      //static constexpr float distance_mm[XYZ] = BACKLASH_DISTANCE_MM; // compiler barks at this
33 35
     #endif
36
+  #endif
37
+  #if ENABLED(BACKLASH_GCODE)
38
+    static uint8_t correction;
34 39
     #ifdef BACKLASH_SMOOTHING_MM
35 40
       static float smoothing_mm;
36 41
     #endif
@@ -38,9 +43,6 @@ public:
38 43
     static inline float get_correction() { return float(ui8_to_percent(correction)) / 100.0f; }
39 44
   #else
40 45
     static constexpr uint8_t correction = (BACKLASH_CORRECTION) * 0xFF;
41
-    #ifdef BACKLASH_DISTANCE_MM
42
-      static constexpr float distance_mm[XYZ] = BACKLASH_DISTANCE_MM;
43
-    #endif
44 46
     #ifdef BACKLASH_SMOOTHING_MM
45 47
       static constexpr float smoothing_mm = BACKLASH_SMOOTHING_MM;
46 48
     #endif

Loading…
Zrušit
Uložit