From 12840afb569ca90670e48b50632799ec562e2847 Mon Sep 17 00:00:00 2001 From: "github@matthewlloyd.net" Date: Sun, 4 Jul 2021 16:59:05 -0400 Subject: [PATCH] Work around M303 E-2 issue by rewriting E-1 to E-2 automatically --- lib/Marlin/Marlin/src/gcode/temperature/M303.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Marlin/Marlin/src/gcode/temperature/M303.cpp b/lib/Marlin/Marlin/src/gcode/temperature/M303.cpp index 2765dc64b..e3ca10153 100644 --- a/lib/Marlin/Marlin/src/gcode/temperature/M303.cpp +++ b/lib/Marlin/Marlin/src/gcode/temperature/M303.cpp @@ -46,7 +46,7 @@ void GcodeSuite::M303() { #else #define EI H_BED #endif - const heater_ind_t e = (heater_ind_t)parser.intval('E'); + heater_ind_t e = (heater_ind_t)parser.intval('E'); if (!WITHIN(e, SI, EI)) { SERIAL_ECHOLNPGM(MSG_PID_BAD_EXTRUDER_NUM); return; @@ -60,6 +60,10 @@ void GcodeSuite::M303() { KEEPALIVE_STATE(NOT_BUSY); #endif + // Llama: work around https://github.com/prusa3d/Prusa-Firmware-Buddy/issues/798 + if (e == -1) + e = (heater_ind_t) -2; + thermalManager.PID_autotune(temp, e, c, u); }