소스 검색

Move M280 to cpp

Scott Lahteine 8 년 전
부모
커밋
6ed5252884
3개의 변경된 파일12개의 추가작업 그리고 10개의 파일을 삭제
  1. 0
    4
      Marlin/src/Marlin.cpp
  2. 10
    1
      Marlin/src/gcode/control/M280.cpp
  3. 2
    5
      Marlin/src/gcode/gcode.cpp

+ 0
- 4
Marlin/src/Marlin.cpp 파일 보기

@@ -352,10 +352,6 @@ bool pin_is_protected(const int8_t pin) {
352 352
   return false;
353 353
 }
354 354
 
355
-#if HAS_SERVOS
356
-  #include "gcode/control/M280.h"
357
-#endif
358
-
359 355
 #if HAS_BUZZER
360 356
   #include "gcode/lcd/M300.h"
361 357
 #endif

Marlin/src/gcode/control/M280.h → Marlin/src/gcode/control/M280.cpp 파일 보기

@@ -20,10 +20,17 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../../inc/MarlinConfig.h"
24
+
25
+#if HAS_SERVOS
26
+
27
+#include "../gcode.h"
28
+#include "../../Marlin.h" // for servo[]
29
+
23 30
 /**
24 31
  * M280: Get or set servo position. P<index> [S<angle>]
25 32
  */
26
-void gcode_M280() {
33
+void GcodeSuite::M280() {
27 34
   if (!parser.seen('P')) return;
28 35
   const int servo_index = parser.value_int();
29 36
   if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) {
@@ -41,3 +48,5 @@ void gcode_M280() {
41 48
     SERIAL_ECHOLNPGM(" out of range");
42 49
   }
43 50
 }
51
+
52
+#endif // HAS_SERVOS

+ 2
- 5
Marlin/src/gcode/gcode.cpp 파일 보기

@@ -121,7 +121,6 @@ extern void gcode_M164();
121 121
 extern void gcode_M165();
122 122
 extern void gcode_M240();
123 123
 extern void gcode_M250();
124
-extern void gcode_M280();
125 124
 extern void gcode_M300();
126 125
 extern void gcode_M301();
127 126
 extern void gcode_M302();
@@ -564,10 +563,8 @@ void GcodeSuite::process_next_command() {
564 563
       case 226: M226(); break;    // M226: Wait until a pin reaches a state
565 564
 
566 565
       #if HAS_SERVOS
567
-        case 280: // M280: Set servo position absolute
568
-          gcode_M280();
569
-          break;
570
-      #endif // HAS_SERVOS
566
+        case 280: M280(); break;  // M280: Set servo position absolute
567
+      #endif
571 568
 
572 569
       #if HAS_BUZZER
573 570
         case 300: // M300: Play beep tone

Loading…
취소
저장