From d4aaa0f1c8ac3cb29c5763972d029f60c5e91dba Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Sun, 17 Sep 2017 03:09:48 -0500 Subject: [PATCH] Move M304 to cpp --- Marlin/src/Marlin.cpp | 4 ---- Marlin/src/gcode/config/{M304.h => M304.cpp} | 11 ++++++++++- Marlin/src/gcode/gcode.cpp | 7 ++----- 3 files changed, 12 insertions(+), 10 deletions(-) rename Marlin/src/gcode/config/{M304.h => M304.cpp} (88%) diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 8798e824b0..464b552dc5 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 ENABLED(PIDTEMPBED) - #include "gcode/config/M304.h" -#endif - #if defined(CHDK) || HAS_PHOTOGRAPH #include "gcode/feature/camera/M240.h" #endif diff --git a/Marlin/src/gcode/config/M304.h b/Marlin/src/gcode/config/M304.cpp similarity index 88% rename from Marlin/src/gcode/config/M304.h rename to Marlin/src/gcode/config/M304.cpp index c460f1648d..a27adfc64a 100644 --- a/Marlin/src/gcode/config/M304.h +++ b/Marlin/src/gcode/config/M304.cpp @@ -20,7 +20,14 @@ * */ -void gcode_M304() { +#include "../../inc/MarlinConfig.h" + +#if ENABLED(PIDTEMPBED) + +#include "../gcode.h" +#include "../../module/temperature.h" + +void GcodeSuite::M304() { if (parser.seen('P')) thermalManager.bedKp = parser.value_float(); if (parser.seen('I')) thermalManager.bedKi = scalePID_i(parser.value_float()); if (parser.seen('D')) thermalManager.bedKd = scalePID_d(parser.value_float()); @@ -32,3 +39,5 @@ void gcode_M304() { SERIAL_ECHOPAIR(" i:", unscalePID_i(thermalManager.bedKi)); SERIAL_ECHOLNPAIR(" d:", unscalePID_d(thermalManager.bedKd)); } + +#endif // PIDTEMPBED diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 9a24eb877d..5f965ddb50 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -122,7 +122,6 @@ extern void gcode_M165(); extern void gcode_M240(); extern void gcode_M250(); extern void gcode_M302(); -extern void gcode_M304(); extern void gcode_M350(); extern void gcode_M351(); extern void gcode_M355(); @@ -573,10 +572,8 @@ void GcodeSuite::process_next_command() { #endif #if ENABLED(PIDTEMPBED) - case 304: // M304: Set bed PID parameters - gcode_M304(); - break; - #endif // PIDTEMPBED + case 304: M304(); break; // M304: Set bed PID parameters + #endif #if defined(CHDK) || HAS_PHOTOGRAPH case 240: // M240: Trigger a camera by emulating a Canon RC-1 : http://www.doc-diy.net/photo/rc-1_hacked/