From 6ed5252884ed3f7ab9a27537b69371804b940088 Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Sep 2017 02:58:39 -0500 Subject: [PATCH] Move M280 to cpp --- Marlin/src/Marlin.cpp | 4 ---- Marlin/src/gcode/control/{M280.h => M280.cpp} | 11 ++++++++++- Marlin/src/gcode/gcode.cpp | 7 ++----- 3 files changed, 12 insertions(+), 10 deletions(-) rename Marlin/src/gcode/control/{M280.h => M280.cpp} (89%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 2d42dbaae0..50552c2dc6 100644 --- a/Marlin/src/Marlin.cpp +++ b/Marlin/src/Marlin.cpp @@ -352,10 +352,6 @@ bool pin_is_protected(const int8_t pin) { return false; } -#if HAS_SERVOS - #include "gcode/control/M280.h" -#endif - #if HAS_BUZZER #include "gcode/lcd/M300.h" #endif diff --git a/Marlin/src/gcode/control/M280.h b/Marlin/src/gcode/control/M280.cpp similarity index 89% rename from Marlin/src/gcode/control/M280.h rename to Marlin/src/gcode/control/M280.cpp index b61c6f59be..9d0f5c4e7f 100644 --- a/Marlin/src/gcode/control/M280.h +++ b/Marlin/src/gcode/control/M280.cpp @@ -20,10 +20,17 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if HAS_SERVOS + +#include "../gcode.h" +#include "../../Marlin.h" // for servo[] + /** * M280: Get or set servo position. P [S] */ -void gcode_M280() { +void GcodeSuite::M280() { if (!parser.seen('P')) return; const int servo_index = parser.value_int(); if (WITHIN(servo_index, 0, NUM_SERVOS - 1)) { @@ -41,3 +48,5 @@ void gcode_M280() { SERIAL_ECHOLNPGM(" out of range"); } } + +#endif // HAS_SERVOS diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 7de00309e0..1ba1f5c661 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -121,7 +121,6 @@ extern void gcode_M164(); extern void gcode_M165(); extern void gcode_M240(); extern void gcode_M250(); -extern void gcode_M280(); extern void gcode_M300(); extern void gcode_M301(); extern void gcode_M302(); @@ -564,10 +563,8 @@ void GcodeSuite::process_next_command() { case 226: M226(); break; // M226: Wait until a pin reaches a state #if HAS_SERVOS - case 280: // M280: Set servo position absolute - gcode_M280(); - break; - #endif // HAS_SERVOS + case 280: M280(); break; // M280: Set servo position absolute + #endif #if HAS_BUZZER case 300: // M300: Play beep tone