Fix mixing extruder filament change (#13803)

This commit is contained in:
Thomas Moore
2019-05-01 22:55:58 -04:00
committed by Scott Lahteine
parent bf54251a10
commit ee243e4edf
15 changed files with 182 additions and 52 deletions

View File

@ -72,17 +72,32 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
int8_t GcodeSuite::get_target_extruder_from_command() {
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e >= EXTRUDERS) {
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", int(e));
return -1;
}
return e;
if (e < EXTRUDERS) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", int(e));
return -1;
}
return active_extruder;
}
/**
* Get the target e stepper from the T parameter
* Return -1 if the T parameter is out of range or unspecified
*/
int8_t GcodeSuite::get_target_e_stepper_from_command() {
const int8_t e = parser.intval('T', -1);
if (WITHIN(e, 0, E_STEPPERS - 1)) return e;
SERIAL_ECHO_START();
SERIAL_CHAR('M'); SERIAL_ECHO(parser.codenum);
if (e == -1)
SERIAL_ECHOLNPGM(" " MSG_E_STEPPER_NOT_SPECIFIED);
else
SERIAL_ECHOLNPAIR(" " MSG_INVALID_E_STEPPER " ", int(e));
return -1;
}
/**
* Set XYZE destination and feedrate from the current GCode command
*