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

Method get_target_extruder_from_command

Marlin/src/gcode/gcode.cpp:124–136  ·  view source on GitHub ↗

* Get the target extruder from the T parameter or the active_extruder * Return -1 if the T parameter is out of range */

Source from the content-addressed store, hash-verified

122 * Return -1 if the T parameter is out of range
123 */
124int8_t GcodeSuite::get_target_extruder_from_command() {
125 #if HAS_TOOLCHANGE
126 if (parser.seenval('T')) {
127 const int8_t e = parser.value_byte();
128 if (e < EXTRUDERS) return e;
129 SERIAL_ECHO_START();
130 SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
131 SERIAL_ECHOLNPGM(" " STR_INVALID_EXTRUDER " ", e);
132 return -1;
133 }
134 #endif
135 return active_extruder;
136}
137
138/**
139 * Get the target E stepper from the 'T' parameter.

Callers

nothing calls this directly

Calls 5

SERIAL_ECHO_STARTFunction · 0.85
seenvalMethod · 0.80
value_byteMethod · 0.80
SERIAL_CHARFunction · 0.50
SERIAL_ECHOFunction · 0.50

Tested by

no test coverage detected