️ Slimmer null T command (#26615)

Co-authored-by: Scott Lahteine <thinkyhead@users.noreply.github.com>
This commit is contained in:
plampix 2024-01-05 00:09:53 +01:00 committed by GitHub
parent 6e67ad51b7
commit 994aa9f692
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 38 additions and 15 deletions

View file

@ -122,14 +122,16 @@ void GcodeSuite::say_units() {
* Return -1 if the T parameter is out of range
*/
int8_t GcodeSuite::get_target_extruder_from_command() {
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;
}
#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
return active_extruder;
}