From 98d79fb8bb8deccebfed3d44d56dbdc7abb8460f Mon Sep 17 00:00:00 2001 From: ellensp <530024+ellensp@users.noreply.github.com> Date: Thu, 2 Oct 2025 12:21:14 +1300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20'T'=20tool=20index=20handl?= =?UTF-8?q?ing=20(#28086)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/gcode/gcode.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/Marlin/src/gcode/gcode.cpp b/Marlin/src/gcode/gcode.cpp index 5ee1ba6b4f..9088407f81 100644 --- a/Marlin/src/gcode/gcode.cpp +++ b/Marlin/src/gcode/gcode.cpp @@ -126,16 +126,13 @@ void GcodeSuite::say_units() { * Return -1 if the T parameter is out of range */ int8_t GcodeSuite::get_target_extruder_from_command() { - #if HAS_TOOLCHANGE - if (parser.seenval('T')) { - const int8_t e = parser.value_byte(); - if (e < EXTRUDERS) return e; - SERIAL_ECHO_START(); - SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum); - SERIAL_ECHOLNPGM(" " STR_INVALID_EXTRUDER " ", e); - return -1; - } - #endif + if (parser.seenval('T')) { + const int8_t e = parser.value_byte(); + if (e < EXTRUDERS) return e; + SERIAL_ECHO_START(); + SERIAL_ECHOLN(C('M'), parser.codenum, F(" " STR_INVALID_EXTRUDER " "), e); + return -1; + } return active_extruder; } @@ -151,7 +148,7 @@ int8_t GcodeSuite::get_target_e_stepper_from_command(const int8_t dval/*=-1*/) { if (dval == -2) return dval; SERIAL_ECHO_START(); - SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum); + SERIAL_ECHO(C('M'), parser.codenum); if (e == -1) SERIAL_ECHOLNPGM(" " STR_E_STEPPER_NOT_SPECIFIED); else