Pārlūkot izejas kodu

🐛 Fix BACKLASH_COMPENSATION compile (#24072)

Followup to #23826
ellensp 2 gadus atpakaļ
vecāks
revīzija
6a05702c20
Revīzijas autora e-pasta adrese nav piesaistīta nevienam kontam
1 mainītis faili ar 25 papildinājumiem un 20 dzēšanām
  1. 25
    20
      Marlin/src/feature/backlash.cpp

+ 25
- 20
Marlin/src/feature/backlash.cpp Parādīt failu

@@ -162,32 +162,37 @@ int32_t Backlash::get_applied_steps(const AxisEnum axis) {
162 162
 }
163 163
 
164 164
 class Backlash::StepAdjuster {
165
-  xyz_long_t applied_steps;
166
-public:
167
-  StepAdjuster() {
168
-    LOOP_NUM_AXES(axis) applied_steps[axis] = backlash.get_applied_steps((AxisEnum)axis);
169
-  }
170
-  ~StepAdjuster() {
171
-    // after backlash compensation parameter changes, ensure applied step count does not change
172
-    LOOP_NUM_AXES(axis) residual_error[axis] += backlash.get_applied_steps((AxisEnum)axis) - applied_steps[axis];
173
-  }
165
+  private:
166
+    xyz_long_t applied_steps;
167
+  public:
168
+    StepAdjuster() {
169
+      LOOP_NUM_AXES(axis) applied_steps[axis] = backlash.get_applied_steps((AxisEnum)axis);
170
+    }
171
+    ~StepAdjuster() {
172
+      // after backlash compensation parameter changes, ensure applied step count does not change
173
+      LOOP_NUM_AXES(axis) residual_error[axis] += backlash.get_applied_steps((AxisEnum)axis) - applied_steps[axis];
174
+    }
174 175
 };
175 176
 
176
-void Backlash::set_correction_uint8(const uint8_t v) {
177
-  StepAdjuster adjuster;
178
-  correction = v;
179
-}
177
+#if ENABLED(BACKLASH_GCODE)
180 178
 
181
-void Backlash::set_distance_mm(const AxisEnum axis, const float v) {
182
-  StepAdjuster adjuster;
183
-  distance_mm[axis] = v;
184
-}
179
+  void Backlash::set_correction_uint8(const uint8_t v) {
180
+    StepAdjuster adjuster;
181
+    correction = v;
182
+  }
185 183
 
186
-#ifdef BACKLASH_SMOOTHING_MM
187
-  void Backlash::set_smoothing_mm(const float v) {
184
+  void Backlash::set_distance_mm(const AxisEnum axis, const float v) {
188 185
     StepAdjuster adjuster;
189
-    smoothing_mm = v;
186
+    distance_mm[axis] = v;
190 187
   }
188
+
189
+  #ifdef BACKLASH_SMOOTHING_MM
190
+    void Backlash::set_smoothing_mm(const float v) {
191
+      StepAdjuster adjuster;
192
+      smoothing_mm = v;
193
+    }
194
+  #endif
195
+
191 196
 #endif
192 197
 
193 198
 #if ENABLED(MEASURE_BACKLASH_WHEN_PROBING)

Notiek ielāde…
Atcelt
Saglabāt