소스 검색

Localize babystepping in the Temperature class

So that `ultralcd.cpp` doesn’t need to worry about the details.
Scott Lahteine 8 년 전
부모
커밋
b65ea98d6b
2개의 변경된 파일32개의 추가작업 그리고 25개의 파일을 삭제
  1. 31
    0
      Marlin/temperature.h
  2. 1
    25
      Marlin/ultralcd.cpp

+ 31
- 0
Marlin/temperature.h 파일 보기

@@ -303,6 +303,37 @@ class Temperature {
303 303
       #endif
304 304
     }
305 305
 
306
+    #if ENABLED(BABYSTEPPING)
307
+
308
+      FORCE_INLINE void babystep_axis(AxisEnum axis, int distance) {
309
+        #if ENABLED(COREXY) || ENABLED(COREXZ)
310
+          #if ENABLED(BABYSTEP_XY)
311
+            switch (axis) {
312
+              case X_AXIS: // X on CoreXY and CoreXZ
313
+                babystepsTodo[A_AXIS] += distance * 2;
314
+                babystepsTodo[CORE_AXIS_2] += distance * 2;
315
+                break;
316
+              case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ
317
+                babystepsTodo[A_AXIS] += distance * 2;
318
+                babystepsTodo[CORE_AXIS_2] -= distance * 2;
319
+                break;
320
+              case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ
321
+                babystepsTodo[CORE_AXIS_3] += distance;
322
+                break;
323
+            }
324
+          #elif ENABLED(COREXZ)
325
+            babystepsTodo[A_AXIS] += distance * 2;
326
+            babystepsTodo[C_AXIS] -= distance * 2;
327
+          #else
328
+            babystepsTodo[Z_AXIS] += distance;
329
+          #endif
330
+        #else
331
+          babystepsTodo[axis] += distance;
332
+        #endif
333
+      }
334
+
335
+    #endif // BABYSTEPPING
336
+
306 337
   private:
307 338
 
308 339
     void set_current_temp_raw();

+ 1
- 25
Marlin/ultralcd.cpp 파일 보기

@@ -558,31 +558,7 @@ void lcd_set_home_offsets() {
558 558
       int distance = (int32_t)encoderPosition * BABYSTEP_MULTIPLICATOR;
559 559
       encoderPosition = 0;
560 560
       lcdDrawUpdate = LCDVIEW_REDRAW_NOW;
561
-      #if ENABLED(COREXY) || ENABLED(COREXZ)
562
-        #if ENABLED(BABYSTEP_XY)
563
-          switch(axis) {
564
-            case X_AXIS: // X on CoreXY and CoreXZ
565
-              thermalManager.babystepsTodo[A_AXIS] += distance * 2;
566
-              thermalManager.babystepsTodo[CORE_AXIS_2] += distance * 2;
567
-              break;
568
-            case CORE_AXIS_2: // Y on CoreXY, Z on CoreXZ
569
-              thermalManager.babystepsTodo[A_AXIS] += distance * 2;
570
-              thermalManager.babystepsTodo[CORE_AXIS_2] -= distance * 2;
571
-              break;
572
-            case CORE_AXIS_3: // Z on CoreXY, Y on CoreXZ
573
-              thermalManager.babystepsTodo[CORE_AXIS_3] += distance;
574
-              break;
575
-          }
576
-        #elif ENABLED(COREXZ)
577
-          thermalManager.babystepsTodo[A_AXIS] += distance * 2;
578
-          thermalManager.babystepsTodo[C_AXIS] -= distance * 2;
579
-        #else
580
-          thermalManager.babystepsTodo[Z_AXIS] += distance;
581
-        #endif
582
-      #else
583
-        thermalManager.babystepsTodo[axis] += distance;
584
-      #endif
585
-
561
+      thermalManager.babystep_axis(axis, distance);
586 562
       babysteps_done += distance;
587 563
     }
588 564
     if (lcdDrawUpdate) lcd_implementation_drawedit(msg, itostr3sign(babysteps_done));

Loading…
취소
저장