Optimize target_extruder, ignore T with mixing (#12432)

* Optimize target_extruder, ignore T with mixing
* Give G-code Tn parity with tool_change
This commit is contained in:
Scott Lahteine
2018-11-14 17:33:04 -06:00
committed by GitHub
parent 5e586a6b39
commit d2bb53702a
18 changed files with 150 additions and 138 deletions

View File

@ -38,7 +38,6 @@ GcodeSuite gcode;
#include "../Marlin.h" // for idle() and suspend_auto_report
uint8_t GcodeSuite::target_extruder;
millis_t GcodeSuite::previous_move_ms;
bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
@ -58,11 +57,10 @@ bool GcodeSuite::axis_relative_modes[] = AXIS_RELATIVE_MODES;
#endif
/**
* Set target_extruder from the T parameter or the active_extruder
*
* Returns TRUE if the target is invalid
* Get the target extruder from the T parameter or the active_extruder
* Return -1 if the T parameter is out of range
*/
bool GcodeSuite::get_target_extruder_from_command() {
int8_t GcodeSuite::get_target_extruder_from_command() {
if (parser.seenval('T')) {
const int8_t e = parser.value_byte();
if (e >= EXTRUDERS) {
@ -70,14 +68,11 @@ bool GcodeSuite::get_target_extruder_from_command() {
SERIAL_CHAR('M');
SERIAL_ECHO(parser.codenum);
SERIAL_ECHOLNPAIR(" " MSG_INVALID_EXTRUDER " ", e);
return true;
return -1;
}
target_extruder = e;
return e;
}
else
target_extruder = active_extruder;
return false;
return active_extruder;
}
/**
@ -539,7 +534,9 @@ void GcodeSuite::process_parsed_command(
case 302: M302(); break; // M302: Allow cold extrudes (set the minimum extrude temperature)
#endif
case 303: M303(); break; // M303: PID autotune
#if HAS_PID_HEATING
case 303: M303(); break; // M303: PID autotune
#endif
#if ENABLED(MORGAN_SCARA)
case 360: if (M360()) return; break; // M360: SCARA Theta pos1