ソースを参照

Move M42 to cpp

Scott Lahteine 7年前
コミット
10fab24e50
4個のファイルの変更9行の追加7行の削除
  1. 1
    3
      Marlin/src/Marlin.cpp
  2. 2
    0
      Marlin/src/Marlin.h
  3. 5
    1
      Marlin/src/gcode/control/M42.cpp
  4. 1
    3
      Marlin/src/gcode/gcode.cpp

+ 1
- 3
Marlin/src/Marlin.cpp ファイルの表示

@@ -363,15 +363,13 @@ void suicide() {
363 363
 /**
364 364
  * Sensitive pin test for M42, M226
365 365
  */
366
-static bool pin_is_protected(const int8_t pin) {
366
+bool pin_is_protected(const int8_t pin) {
367 367
   static const int8_t sensitive_pins[] PROGMEM = SENSITIVE_PINS;
368 368
   for (uint8_t i = 0; i < COUNT(sensitive_pins); i++)
369 369
     if (pin == (int8_t)pgm_read_byte(&sensitive_pins[i])) return true;
370 370
   return false;
371 371
 }
372 372
 
373
-#include "gcode/control/M42.h"
374
-
375 373
 #if ENABLED(PINS_DEBUGGING)
376 374
   #include "gcode/config/M43.h"
377 375
 #endif

+ 2
- 0
Marlin/src/Marlin.h ファイルの表示

@@ -228,4 +228,6 @@ extern volatile bool wait_for_heatup;
228 228
 
229 229
 void calculate_volumetric_multipliers();
230 230
 
231
+bool pin_is_protected(const int8_t pin);
232
+
231 233
 #endif // __MARLIN_H__

Marlin/src/gcode/control/M42.h → Marlin/src/gcode/control/M42.cpp ファイルの表示

@@ -20,13 +20,17 @@
20 20
  *
21 21
  */
22 22
 
23
+#include "../gcode.h"
24
+#include "../../Marlin.h" // for pin_is_protected
25
+#include "../../inc/MarlinConfig.h"
26
+
23 27
 /**
24 28
  * M42: Change pin status via GCode
25 29
  *
26 30
  *  P<pin>  Pin number (LED if omitted)
27 31
  *  S<byte> Pin status from 0 - 255
28 32
  */
29
-void gcode_M42() {
33
+void GcodeSuite::M42() {
30 34
   if (!parser.seenval('S')) return;
31 35
   const byte pin_status = parser.value_byte();
32 36
 

+ 1
- 3
Marlin/src/gcode/gcode.cpp ファイルの表示

@@ -117,7 +117,6 @@ void GcodeSuite::dwell(millis_t time) {
117 117
 // Placeholders for non-migrated codes
118 118
 //
119 119
 extern void gcode_M18_M84();
120
-extern void gcode_M42();
121 120
 extern void gcode_M43();
122 121
 extern void gcode_M48();
123 122
 extern void gcode_M75();
@@ -433,8 +432,7 @@ void GcodeSuite::process_next_command() {
433 432
 
434 433
       case 31: M31(); break;      // M31: Report time since the start of SD print or last M109
435 434
 
436
-      case 42: // M42: Change pin state
437
-        gcode_M42(); break;
435
+      case 42: M42(); break;      // M42: Change pin state
438 436
 
439 437
       #if ENABLED(PINS_DEBUGGING)
440 438
         case 43: // M43: Read pin state

読み込み中…
キャンセル
保存