Add "P" parameter to M302
This commit is contained in:
parent
a5bae3c7d5
commit
d4c68279c8
@ -5703,10 +5703,36 @@ inline void gcode_M226() {
|
|||||||
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
|
#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() {
|
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
|
#endif // PREVENT_DANGEROUS_EXTRUDE
|
||||||
|
@ -107,6 +107,7 @@ unsigned char Temperature::soft_pwm_bed;
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
|
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
|
||||||
|
bool Temperature::allow_cold_extrude = false;
|
||||||
float Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
|
float Temperature::extrude_min_temp = EXTRUDE_MINTEMP;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -121,12 +121,13 @@ class Temperature {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
|
#if ENABLED(PREVENT_DANGEROUS_EXTRUDE)
|
||||||
|
static bool allow_cold_extrude;
|
||||||
static float extrude_min_temp;
|
static float extrude_min_temp;
|
||||||
static bool tooColdToExtrude(uint8_t e) {
|
static bool tooColdToExtrude(uint8_t e) {
|
||||||
#if HOTENDS == 1
|
#if HOTENDS == 1
|
||||||
UNUSED(e);
|
UNUSED(e);
|
||||||
#endif
|
#endif
|
||||||
return degHotend(HOTEND_INDEX) < extrude_min_temp;
|
return allow_cold_extrude ? false : degHotend(HOTEND_INDEX) < extrude_min_temp;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
static bool tooColdToExtrude(uint8_t e) { UNUSED(e); return false; }
|
static bool tooColdToExtrude(uint8_t e) { UNUSED(e); return false; }
|
||||||
|
Loading…
Reference in New Issue
Block a user