MCPcopy Create free account
hub / github.com/MarlinFirmware/Marlin / M302

Method M302

Marlin/src/gcode/config/M302.cpp:50–66  ·  view source on GitHub ↗

* M302: Allow cold extrudes, or set the minimum extrude temperature * * S sets the minimum extrude temperature * P enables (1) or disables (0) cold extrusion * * Examples: * * M302 ; report current cold extrusion state * M302 P0 ; enable cold extrusion checking * M302 P1 ; disable cold extrusion checking * M302 S0

Source from the content-addressed store, hash-verified

48 * M302 S170 P1 ; set min extrude temp to 170 but leave disabled
49 */
50void GcodeSuite::M302() {
51 const bool seen_S = parser.seen('S');
52 if (seen_S) {
53 thermalManager.extrude_min_temp = parser.value_celsius();
54 TERN_(EXTENSIBLE_UI, ExtUI::onSetMinExtrusionTemp(thermalManager.extrude_min_temp));
55 }
56
57 const bool seen_P = parser.seen('P');
58 if (seen_P || seen_S) {
59 thermalManager.allow_cold_extrude = (thermalManager.extrude_min_temp == 0) || (seen_P && parser.value_bool());
60 }
61 else {
62 // Report current state
63 SERIAL_ECHO_START();
64 SERIAL_ECHOLN(F("Cold extrudes are "), thermalManager.allow_cold_extrude ? F("en") : F("dis"), F("abled (min temp "), thermalManager.extrude_min_temp, F("C)"));
65 }
66}
67
68#endif // PREVENT_COLD_EXTRUSION

Callers

nothing calls this directly

Calls 7

SERIAL_ECHO_STARTFunction · 0.85
seenMethod · 0.80
value_celsiusMethod · 0.80
value_boolMethod · 0.80
onSetMinExtrusionTempFunction · 0.50
SERIAL_ECHOLNFunction · 0.50
FFunction · 0.50

Tested by

no test coverage detected