Merge pull request #4222 from thinkyhead/rc_allow_cold_extrude

M302: Add "P" parameter, status output
This commit is contained in:
Scott Lahteine
2016-07-12 20:40:14 -07:00
committed by GitHub
3 changed files with 85 additions and 59 deletions

View File

@ -5697,10 +5697,36 @@ inline void gcode_M226() {
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
/**
* M302: Allow cold extrudes, or set the minimum extrude S<temperature>.
* M302: Allow cold extrudes, or set the minimum extrude temperature
*
* S<temperature> sets the minimum extrude temperature
* P<bool> enables (1) or disables (0) cold extrusion
*
* Examples:
*
* M302 ; report current cold extrusion state
* M302 P0 ; enable cold extrusion checking
* M302 P1 ; disables cold extrusion checking
* M302 S0 ; always allow extrusion (disables checking)
* M302 S170 ; only allow extrusion above 170
* M302 S170 P1 ; set min extrude temp to 170 but leave disabled
*/
inline void gcode_M302() {
thermalManager.extrude_min_temp = code_seen('S') ? code_value_temp_abs() : 0;
bool seen_S = code_seen('S');
if (seen_S) {
thermalManager.extrude_min_temp = code_value_temp_abs();
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0);
}
if (code_seen('P'))
thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0) || code_value_bool();
else if (!seen_S) {
// Report current state
SERIAL_ECHO_START;
SERIAL_ECHOPAIR("Cold extrudes are ", (thermalManager.allow_cold_extrude ? "en" : "dis"));
SERIAL_ECHOPAIR("abled (min temp ", int(thermalManager.extrude_min_temp + 0.5));
SERIAL_ECHOLNPGM("C)");
}
}
#endif // PREVENT_DANGEROUS_EXTRUDE