diff --git a/Marlin/Marlin_main.cpp b/Marlin/Marlin_main.cpp index 0714072e9..89a5f5e50 100644 --- a/Marlin/Marlin_main.cpp +++ b/Marlin/Marlin_main.cpp @@ -5559,6 +5559,7 @@ inline void gcode_M226() { * U with a non-zero value will apply the result to current settings */ inline void gcode_M303() { +#if ENABLED(PIDTEMP) int e = code_seen('E') ? code_value_short() : 0; int c = code_seen('C') ? code_value_short() : 5; bool u = code_seen('U') && code_value_short() != 0; @@ -5573,6 +5574,10 @@ inline void gcode_M303() { PID_autotune(temp, e, c, u); KEEPALIVE_STATE(IN_HANDLER); +#else + SERIAL_ERROR_START; + SERIAL_ERRORLNPGM(MSG_ERR_M303_DISABLED); +#endif } #if ENABLED(SCARA) diff --git a/Marlin/language.h b/Marlin/language.h index 9085a6a85..0bbae448b 100644 --- a/Marlin/language.h +++ b/Marlin/language.h @@ -159,6 +159,7 @@ #define MSG_ERR_M421_REQUIRES_XYZ "M421 requires XYZ parameters" #define MSG_ERR_MESH_INDEX_OOB "Mesh XY index is out of bounds" #define MSG_ERR_M428_TOO_FAR "Too far from reference point" +#define MSG_ERR_M303_DISABLED "PIDTEMP disabled" #define MSG_M119_REPORT "Reporting endstop status" #define MSG_ENDSTOP_HIT "TRIGGERED" #define MSG_ENDSTOP_OPEN "open" diff --git a/Marlin/temperature.cpp b/Marlin/temperature.cpp index 3fad457cb..9b56752b5 100644 --- a/Marlin/temperature.cpp +++ b/Marlin/temperature.cpp @@ -221,6 +221,8 @@ static void updateTemperaturesFromRawValues(); //================================ Functions ================================ //=========================================================================== +#if ENABLED(PIDTEMP) + void PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false*/) { float input = 0.0; int cycles = 0; @@ -392,6 +394,8 @@ void PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false } } +#endif // PIDTEMP + void updatePID() { #if ENABLED(PIDTEMP) for (int e = 0; e < EXTRUDERS; e++) { diff --git a/Marlin/temperature.h b/Marlin/temperature.h index 9747d07ac..c49f2c46a 100644 --- a/Marlin/temperature.h +++ b/Marlin/temperature.h @@ -169,7 +169,9 @@ int getHeaterPower(int heater); void disable_all_heaters(); void updatePID(); -void PID_autotune(float temp, int extruder, int ncycles, bool set_result=false); +#if ENABLED(PIDTEMP) + void PID_autotune(float temp, int extruder, int ncycles, bool set_result=false); +#endif void setExtruderAutoFanState(int pin, bool state); void checkExtruderAutoFans();