Multi extruder support for M600 and LCD

This commit is contained in:
Scott Lahteine
2017-12-26 22:16:13 -06:00
parent a1ce6e8ff4
commit 9ecdd1f4c7
2 changed files with 113 additions and 21 deletions

View File

@ -24,14 +24,15 @@
#if ENABLED(ADVANCED_PAUSE_FEATURE)
#include "../../../feature/pause.h"
#include "../../gcode.h"
#include "../../../feature/pause.h"
#include "../../../module/motion.h"
#include "../../parser.h"
#include "../../../module/printcounter.h"
#if EXTRUDERS > 1
#include "../../../module/tool_change.h"
#endif
/**
* M600: Pause for filament change
*
@ -42,6 +43,7 @@
* U[distance] - Retract distance for removal (negative value) (manual reload)
* L[distance] - Extrude distance for insertion (positive value) (manual reload)
* B[count] - Number of times to beep, -1 for indefinite (if equipped with a buzzer)
* T[toolhead] - Select extruder for filament change
*
* Default values are used for omitted arguments.
*
@ -54,6 +56,18 @@ void GcodeSuite::M600() {
if (axis_unhomed_error()) home_all_axes();
#endif
#if EXTRUDERS > 1
// Change toolhead if specified
uint8_t active_extruder_before_filament_change = -1;
if (parser.seen('T')) {
const uint8_t extruder = parser.value_byte();
if (active_extruder != extruder) {
active_extruder_before_filament_change = active_extruder;
tool_change(extruder, 0, true);
}
}
#endif
// Initial retract before move to filament change position
const float retract = parser.seen('E') ? parser.value_axis_units(E_AXIS) : 0
#ifdef PAUSE_PARK_RETRACT_LENGTH
@ -61,16 +75,12 @@ void GcodeSuite::M600() {
#endif
;
// Lift Z axis
if (parser.seenval('Z'))
park_point.z = parser.linearval('Z');
// Move XY axes to filament change position or given position
if (parser.seenval('X'))
park_point.x = parser.linearval('X');
if (parser.seenval('X')) park_point.x = parser.linearval('X');
if (parser.seenval('Y')) park_point.y = parser.linearval('Y');
if (parser.seenval('Y'))
park_point.y = parser.linearval('Y');
// Lift Z axis
if (parser.seenval('Z')) park_point.z = parser.linearval('Z');
#if HOTENDS > 1 && DISABLED(DUAL_X_CARRIAGE)
park_point.x += (active_extruder ? hotend_offset[X_AXIS][active_extruder] : 0);
@ -106,6 +116,12 @@ void GcodeSuite::M600() {
resume_print(load_length, ADVANCED_PAUSE_EXTRUDE_LENGTH, beep_count);
}
#if EXTRUDERS > 1
// Restore toolhead if it was changed
if (active_extruder_before_filament_change >= 0)
tool_change(active_extruder_before_filament_change, 0, true);
#endif
// Resume the print job timer if it was running
if (job_running) print_job_timer.start();
}