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

Method M306

Marlin/src/gcode/temp/M306.cpp:51–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49 */
50
51void GcodeSuite::M306() {
52 const uint8_t e = TERN0(HAS_MULTI_EXTRUDER, parser.intval('E', active_extruder));
53 if (e >= (EXTRUDERS)) {
54 SERIAL_ECHOLNPGM("?(E)xtruder index out of range (0-", (EXTRUDERS) - 1, ").");
55 return;
56 }
57
58 #if ENABLED(MPC_AUTOTUNE)
59 if (parser.seen_test('T')) {
60 Temperature::MPCTuningType tuning_type;
61 const uint8_t type = parser.byteval('S', 0);
62 switch (type) {
63 case 1: tuning_type = Temperature::MPCTuningType::FORCE_DIFFERENTIAL; break;
64 case 2: tuning_type = Temperature::MPCTuningType::FORCE_ASYMPTOTIC; break;
65 default: tuning_type = Temperature::MPCTuningType::AUTO; break;
66 }
67 if (TERN0(MPC_PTC, tuning_type == Temperature::MPCTuningType::FORCE_ASYMPTOTIC))
68 SERIAL_ECHOLNPGM("Aymptotic tuning not avaiable for PTC hotends");
69 else {
70 LCD_MESSAGE(MSG_MPC_AUTOTUNE);
71 thermalManager.MPC_autotune(e, tuning_type);
72 ui.reset_status();
73 }
74 return;
75 }
76 #endif
77
78 if (parser.seen("ACFPRH")) {
79 MPC_t &mpc = thermalManager.temp_hotend[e].mpc;
80 if (parser.seenval('P')) mpc.heater_power = parser.value_float();
81 #if ENABLED(MPC_PTC)
82 if (parser.seenval('L')) mpc.heater_alpha = parser.value_float();
83 if (parser.seenval('Q')) mpc.heater_reftemp = parser.value_float();
84 #endif
85 if (parser.seenval('C')) mpc.block_heat_capacity = parser.value_float();
86 if (parser.seenval('R')) mpc.sensor_responsiveness = parser.value_float();
87 if (parser.seenval('A')) mpc.ambient_xfer_coeff_fan0 = parser.value_float();
88 #if ENABLED(MPC_INCLUDE_FAN)
89 if (parser.seenval('F')) mpc.applyFanAdjustment(parser.value_float());
90 #endif
91 if (parser.seenval('H')) mpc.filament_heat_capacity_permm = parser.value_float();
92 return;
93 }
94
95 M306_report(true);
96}
97
98void GcodeSuite::M306_report(const bool forReplay/*=true*/) {
99 TERN_(MARLIN_SMALL_BUILD, return);

Callers

nothing calls this directly

Calls 9

intvalMethod · 0.80
seen_testMethod · 0.80
bytevalMethod · 0.80
MPC_autotuneMethod · 0.80
seenMethod · 0.80
seenvalMethod · 0.80
value_floatMethod · 0.80
reset_statusMethod · 0.45
applyFanAdjustmentMethod · 0.45

Tested by

no test coverage detected