Reduce setTargetedHotend by removing the switch

2.0.x
Scott Lahteine 10 years ago
parent 06f401e7e5
commit be5236e839

@ -6518,25 +6518,21 @@ void Stop() {
} }
} }
/**
* Set target_extruder from the T parameter or the active_extruder
*
* Returns TRUE if the target is invalid
*/
bool setTargetedHotend(int code) { bool setTargetedHotend(int code) {
target_extruder = active_extruder; target_extruder = active_extruder;
if (code_seen('T')) { if (code_seen('T')) {
target_extruder = code_value_short(); target_extruder = code_value_short();
if (target_extruder >= EXTRUDERS) { if (target_extruder >= EXTRUDERS) {
switch(code) { SERIAL_ECHO_START;
case 104: SERIAL_CHAR('M');
case 105: SERIAL_ECHO(code);
case 109: SERIAL_ECHOPGM(" " MSG_INVALID_EXTRUDER " ");
case 218: SERIAL_ECHOLN(target_extruder);
case 221:
case 200:
SERIAL_ECHO_START;
SERIAL_CHAR('M');
SERIAL_ECHO(code);
SERIAL_ECHOPGM(" " MSG_INVALID_EXTRUDER " ");
SERIAL_ECHOLN(target_extruder);
break;
}
return true; return true;
} }
} }

Loading…
Cancel
Save