G12 defaults per tool. Event G-code for post-toolchange (#16554)
This commit is contained in:
parent
84c874c53b
commit
79810b7fcb
4 changed files with 18 additions and 12 deletions
|
@ -1524,9 +1524,10 @@
|
||||||
// Default number of triangles
|
// Default number of triangles
|
||||||
#define NOZZLE_CLEAN_TRIANGLES 3
|
#define NOZZLE_CLEAN_TRIANGLES 3
|
||||||
|
|
||||||
// Specify positions as { X, Y, Z }
|
// Specify positions for each tool as { { X, Y, Z }, { X, Y, Z } }
|
||||||
#define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1) }
|
// Dual hotend system may use { { -20, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }, { 420, (Y_BED_SIZE / 2), (Z_MIN_POS + 1) }}
|
||||||
#define NOZZLE_CLEAN_END_POINT { 100, 60, (Z_MIN_POS + 1) }
|
#define NOZZLE_CLEAN_START_POINT { { 30, 30, (Z_MIN_POS + 1) } }
|
||||||
|
#define NOZZLE_CLEAN_END_POINT { { 100, 60, (Z_MIN_POS + 1) } }
|
||||||
|
|
||||||
// Circular pattern radius
|
// Circular pattern radius
|
||||||
#define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5
|
#define NOZZLE_CLEAN_CIRCLE_RADIUS 6.5
|
||||||
|
|
|
@ -1771,6 +1771,9 @@
|
||||||
// Z raise distance for tool-change, as needed for some extruders
|
// Z raise distance for tool-change, as needed for some extruders
|
||||||
#define TOOLCHANGE_ZRAISE 2 // (mm)
|
#define TOOLCHANGE_ZRAISE 2 // (mm)
|
||||||
//#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change
|
//#define TOOLCHANGE_NO_RETURN // Never return to the previous position on tool-change
|
||||||
|
#if ENABLED(TOOLCHANGE_NO_RETURN)
|
||||||
|
//#define EVENT_GCODE_AFTER_TOOLCHANGE "G12X" // G-code to run after tool-change is complete
|
||||||
|
#endif
|
||||||
|
|
||||||
// Retract and prime filament on tool-change
|
// Retract and prime filament on tool-change
|
||||||
//#define TOOLCHANGE_FILAMENT_SWAP
|
//#define TOOLCHANGE_FILAMENT_SWAP
|
||||||
|
|
|
@ -157,26 +157,24 @@ Nozzle nozzle;
|
||||||
* @param argument depends on the cleaning pattern
|
* @param argument depends on the cleaning pattern
|
||||||
*/
|
*/
|
||||||
void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
|
void Nozzle::clean(const uint8_t &pattern, const uint8_t &strokes, const float &radius, const uint8_t &objects, const uint8_t cleans) {
|
||||||
xyz_pos_t start = NOZZLE_CLEAN_START_POINT, end = NOZZLE_CLEAN_END_POINT;
|
xyz_pos_t start[HOTENDS] = NOZZLE_CLEAN_START_POINT, end[HOTENDS] = NOZZLE_CLEAN_END_POINT, middle[HOTENDS] = NOZZLE_CLEAN_CIRCLE_MIDDLE;
|
||||||
|
|
||||||
if (pattern == 2) {
|
if (pattern == 2) {
|
||||||
if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
|
if (!(cleans & (_BV(X_AXIS) | _BV(Y_AXIS)))) {
|
||||||
SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
|
SERIAL_ECHOLNPGM("Warning : Clean Circle requires XY");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
constexpr xyz_pos_t middle NOZZLE_CLEAN_CIRCLE_MIDDLE;
|
|
||||||
end = middle;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!TEST(cleans, X_AXIS)) start.x = end.x = current_position.x;
|
if (!TEST(cleans, X_AXIS)) start[active_extruder].x = end[active_extruder].x = current_position.x;
|
||||||
if (!TEST(cleans, Y_AXIS)) start.y = end.y = current_position.y;
|
if (!TEST(cleans, Y_AXIS)) start[active_extruder].y = end[active_extruder].y = current_position.y;
|
||||||
}
|
}
|
||||||
if (!TEST(cleans, Z_AXIS)) start.z = end.z = current_position.z;
|
if (!TEST(cleans, Z_AXIS)) start[active_extruder].z = end[active_extruder].z = current_position.z;
|
||||||
|
|
||||||
switch (pattern) {
|
switch (pattern) {
|
||||||
case 1: zigzag(start, end, strokes, objects); break;
|
case 1: zigzag(start[active_extruder], end[active_extruder], strokes, objects); break;
|
||||||
case 2: circle(start, end, strokes, radius); break;
|
case 2: circle(start[active_extruder], middle[active_extruder], strokes, radius); break;
|
||||||
default: stroke(start, end, strokes);
|
default: stroke(start[active_extruder], end[active_extruder], strokes);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1067,6 +1067,10 @@ void tool_change(const uint8_t new_tool, bool no_move/*=false*/) {
|
||||||
fanmux_switch(active_extruder);
|
fanmux_switch(active_extruder);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef EVENT_GCODE_AFTER_TOOLCHANGE
|
||||||
|
gcode.process_subcommands_now_P(EVENT_GCODE_AFTER_TOOLCHANGE);
|
||||||
|
#endif
|
||||||
|
|
||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(active_extruder));
|
SERIAL_ECHOLNPAIR(MSG_ACTIVE_EXTRUDER, int(active_extruder));
|
||||||
|
|
||||||
|
|
Reference in a new issue