Merge pull request #3565 from thinkyhead/rc_look_at_3563

Output error message for M303 if PIDTEMP is disabled
This commit is contained in:
Scott Lahteine 2016-04-18 21:22:50 -07:00
commit dd94ce5bd5
4 changed files with 172 additions and 160 deletions

View file

@ -5559,6 +5559,7 @@ inline void gcode_M226() {
* U<bool> with a non-zero value will apply the result to current settings * U<bool> with a non-zero value will apply the result to current settings
*/ */
inline void gcode_M303() { inline void gcode_M303() {
#if ENABLED(PIDTEMP)
int e = code_seen('E') ? code_value_short() : 0; int e = code_seen('E') ? code_value_short() : 0;
int c = code_seen('C') ? code_value_short() : 5; int c = code_seen('C') ? code_value_short() : 5;
bool u = code_seen('U') && code_value_short() != 0; bool u = code_seen('U') && code_value_short() != 0;
@ -5573,6 +5574,10 @@ inline void gcode_M303() {
PID_autotune(temp, e, c, u); PID_autotune(temp, e, c, u);
KEEPALIVE_STATE(IN_HANDLER); KEEPALIVE_STATE(IN_HANDLER);
#else
SERIAL_ERROR_START;
SERIAL_ERRORLNPGM(MSG_ERR_M303_DISABLED);
#endif
} }
#if ENABLED(SCARA) #if ENABLED(SCARA)

View file

@ -159,6 +159,7 @@
#define MSG_ERR_M421_REQUIRES_XYZ "M421 requires XYZ parameters" #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_MESH_INDEX_OOB "Mesh XY index is out of bounds"
#define MSG_ERR_M428_TOO_FAR "Too far from reference point" #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_M119_REPORT "Reporting endstop status"
#define MSG_ENDSTOP_HIT "TRIGGERED" #define MSG_ENDSTOP_HIT "TRIGGERED"
#define MSG_ENDSTOP_OPEN "open" #define MSG_ENDSTOP_OPEN "open"

View file

@ -221,6 +221,8 @@ static void updateTemperaturesFromRawValues();
//================================ Functions ================================ //================================ Functions ================================
//=========================================================================== //===========================================================================
#if ENABLED(PIDTEMP)
void PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false*/) { void PID_autotune(float temp, int extruder, int ncycles, bool set_result/*=false*/) {
float input = 0.0; float input = 0.0;
int cycles = 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() { void updatePID() {
#if ENABLED(PIDTEMP) #if ENABLED(PIDTEMP)
for (int e = 0; e < EXTRUDERS; e++) { for (int e = 0; e < EXTRUDERS; e++) {

View file

@ -169,7 +169,9 @@ int getHeaterPower(int heater);
void disable_all_heaters(); void disable_all_heaters();
void updatePID(); void updatePID();
#if ENABLED(PIDTEMP)
void PID_autotune(float temp, int extruder, int ncycles, bool set_result=false); void PID_autotune(float temp, int extruder, int ncycles, bool set_result=false);
#endif
void setExtruderAutoFanState(int pin, bool state); void setExtruderAutoFanState(int pin, bool state);
void checkExtruderAutoFans(); void checkExtruderAutoFans();