diff --git a/Marlin/src/Marlin.cpp b/Marlin/src/Marlin.cpp index 4f2941790..8798e824b 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(PIDTEMP) - #include "gcode/config/M301.h" -#endif - #if ENABLED(PIDTEMPBED) #include "gcode/config/M304.h" #endif diff --git a/Marlin/src/gcode/config/M301.h b/Marlin/src/gcode/config/M301.cpp similarity index 93% rename from Marlin/src/gcode/config/M301.h rename to Marlin/src/gcode/config/M301.cpp index e775bbe1c..4df4a2c0e 100644 --- a/Marlin/src/gcode/config/M301.h +++ b/Marlin/src/gcode/config/M301.cpp @@ -20,6 +20,13 @@ * */ +#include "../../inc/MarlinConfig.h" + +#if ENABLED(PIDTEMP) + +#include "../gcode.h" +#include "../../module/temperature.h" + /** * M301: Set PID parameters P I D (and optionally C, L) * @@ -32,7 +39,7 @@ * C[float] Kc term * L[float] LPQ length */ -void gcode_M301() { +void GcodeSuite::M301() { // multi-extruder PID patch: M301 updates or prints a single extruder's PID values // default behaviour (omitting E parameter) is to update for extruder 0 only @@ -67,3 +74,5 @@ void gcode_M301() { SERIAL_ERRORLN(MSG_INVALID_EXTRUDER); } } + +#endif // PIDTEMP diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 5e089afb2..9a24eb877 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_M301(); extern void gcode_M302(); extern void gcode_M304(); extern void gcode_M350(); @@ -570,10 +569,8 @@ void GcodeSuite::process_next_command() { #endif #if ENABLED(PIDTEMP) - case 301: // M301: Set hotend PID parameters - gcode_M301(); - break; - #endif // PIDTEMP + case 301: M301(); break; // M301: Set hotend PID parameters + #endif #if ENABLED(PIDTEMPBED) case 304: // M304: Set bed PID parameters