Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implements clean nozzle feature (Lulzbot's REWIPE) #4054

Merged
merged 4 commits into from
Jul 14, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,12 @@ script:
- opt_enable PRINTCOUNTER
- build_marlin
#
# Test CLEAN_NOZZLE_FEATURE
#
- restore_configs
- opt_enable AUTO_BED_LEVELING_FEATURE CLEAN_NOZZLE_FEATURE FIX_MOUNTED_PROBE
- build_marlin
#
#
######## STANDARD LCD/PANELS ##############
#
Expand Down
48 changes: 48 additions & 0 deletions Marlin/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -787,6 +787,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define PREHEAT_2_TEMP_BED 110
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255

//
// Clean Nozzle Feature -- EXPERIMENTAL
//
// When enabled allows the user to send G12 to start the nozzle cleaning
// process, the G-Code accepts two parameters:
// "P" for pattern selection
// "S" for defining the number of strokes/repetitions
//
// Available list of patterns:
// P0: This is the default pattern, this process requires a sponge type
// material at a fixed bed location, the cleaning process is based on
// "strokes" i.e. back-and-forth movements between the starting and end
// points.
//
// P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
// defines the number of zig-zag triangles to be done. "S" defines the
// number of strokes aka one back-and-forth movement. As an example
// sending "G12 P1 S1 T3" will execute:
//
// --
// | (X0, Y1) | /\ /\ /\ | (X1, Y1)
// | | / \ / \ / \ |
// A | | / \ / \ / \ |
// | | / \ / \ / \ |
// | (X0, Y0) | / \/ \/ \ | (X1, Y0)
// -- +--------------------------------+
// |________|_________|_________|
// T1 T2 T3
//
// Caveats: End point Z should use the same value as Start point Z.
//
// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
// may change to add new functionality like different wipe patterns.
//
//#define NOZZLE_CLEAN_FEATURE

#if ENABLED(NOZZLE_CLEAN_FEATURE)
// Number of pattern repetitions
#define NOZZLE_CLEAN_STROKES 12

// { X, Y, Z}
#define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
#define NOZZLE_CLEAN_END_PT {100, 60, (Z_MIN_POS + 5)}

// Moves the nozzle to the parked position
#define NOZZLE_CLEAN_PARK
#endif

//
// Print job timer
//
Expand Down
45 changes: 30 additions & 15 deletions Marlin/Marlin_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@
* G3 - CCW ARC
* G4 - Dwell S<seconds> or P<milliseconds>
* G5 - Cubic B-spline with XYZE destination and IJPQ offsets
* G10 - retract filament according to settings of M207
* G11 - retract recover filament according to settings of M208
* G10 - Retract filament according to settings of M207
* G11 - Retract recover filament according to settings of M208
* G12 - Clean tool
* G20 - Set input units to inches
* G21 - Set input units to millimeters
* G28 - Home one or more axes
Expand Down Expand Up @@ -1703,6 +1704,10 @@ static void clean_up_after_endstop_or_probe_move() {
do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], feed_rate);
}

inline void do_blocking_move_to_y(float y) {
do_blocking_move_to(current_position[X_AXIS], y, current_position[Z_AXIS]);
}

inline void do_blocking_move_to_z(float z, float feed_rate = 0.0) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, feed_rate);
}
Expand Down Expand Up @@ -2712,6 +2717,21 @@ inline void gcode_G4() {

#endif //FWRETRACT

#if ENABLED(NOZZLE_CLEAN_FEATURE) && ENABLED(AUTO_BED_LEVELING_FEATURE)
#include "nozzle.h"

inline void gcode_G12() {
// Don't allow nozzle cleaning without homing first
if (axis_unhomed_error(true, true, true)) { return; }

uint8_t const pattern = code_seen('P') ? code_value_ushort() : 0;
uint8_t const strokes = code_seen('S') ? code_value_ushort() : NOZZLE_CLEAN_STROKES;
uint8_t const objects = code_seen('T') ? code_value_ushort() : 3;

Nozzle::clean(pattern, strokes, objects);
}
#endif

#if ENABLED(INCH_MODE_SUPPORT)
/**
* G20: Set input mode to inches
Expand Down Expand Up @@ -6748,12 +6768,10 @@ void process_next_command() {

// G2, G3
#if ENABLED(ARC_SUPPORT) && DISABLED(SCARA)

case 2: // G2 - CW ARC
case 3: // G3 - CCW ARC
gcode_G2_G3(codenum == 2);
break;

#endif

// G4 Dwell
Expand All @@ -6762,23 +6780,25 @@ void process_next_command() {
break;

#if ENABLED(BEZIER_CURVE_SUPPORT)

// G5
case 5: // G5 - Cubic B_spline
gcode_G5();
break;

#endif // BEZIER_CURVE_SUPPORT

#if ENABLED(FWRETRACT)

case 10: // G10: retract
case 11: // G11: retract_recover
gcode_G10_G11(codenum == 10);
break;

#endif // FWRETRACT

#if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE
case 12:
gcode_G12(); // G12: Clean Nozzle
break;
#endif // NOZZLE_CLEAN_FEATURE

#if ENABLED(INCH_MODE_SUPPORT)
case 20: //G20: Inch Mode
gcode_G20();
Expand All @@ -6787,7 +6807,7 @@ void process_next_command() {
case 21: //G21: MM Mode
gcode_G21();
break;
#endif
#endif // INCH_MODE_SUPPORT

case 28: // G28: Home all axes, one at a time
gcode_G28();
Expand All @@ -6797,7 +6817,7 @@ void process_next_command() {
case 29: // G29 Detailed Z probe, probes the bed at 3 or more points.
gcode_G29();
break;
#endif
#endif // AUTO_BED_LEVELING_FEATURE

#if HAS_BED_PROBE

Expand All @@ -6816,7 +6836,6 @@ void process_next_command() {
break;

#endif // Z_PROBE_SLED

#endif // HAS_BED_PROBE

case 90: // G90
Expand Down Expand Up @@ -6845,7 +6864,6 @@ void process_next_command() {
break;

#if ENABLED(SDSUPPORT)

case 20: // M20 - list SD card
gcode_M20(); break;
case 21: // M21 - init SD card
Expand Down Expand Up @@ -6878,7 +6896,6 @@ void process_next_command() {

case 928: //M928 - Start SD write
gcode_M928(); break;

#endif //SDSUPPORT

case 31: //M31 take time since the start of the SD print or an M109 command
Expand Down Expand Up @@ -6948,11 +6965,9 @@ void process_next_command() {
#endif

#if ENABLED(HOST_KEEPALIVE_FEATURE)

case 113: // M113: Set Host Keepalive interval
gcode_M113();
break;

#endif

case 140: // M140: Set bed temp
Expand Down
7 changes: 7 additions & 0 deletions Marlin/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -646,4 +646,11 @@
#error "ABS_PREHEAT_FAN_SPEED is now PREHEAT_2_FAN_SPEED. Please update your configuration."
#endif

/**
* Nozzle cleaning
*/
#if ENABLED(NOZZLE_CLEAN_FEATURE) && !HAS_BED_PROBE
#error Due to internal dependencies you must have a bed probe for NOZZLE_CLEAN_FEATURE to work
#endif

#endif //SANITYCHECK_H
54 changes: 51 additions & 3 deletions Marlin/example_configurations/Cartesio/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@
#define DEFAULT_Kp 18
#define DEFAULT_Ki 1
#define DEFAULT_Kd 100

// Cartesio extruderV6 40W Volcano
//#define DEFAULT_Kp 50
//#define DEFAULT_Ki 9
//#define DEFAULT_Kd 70

// Cartesio extruderV6 40W Cyclops
//#define DEFAULT_Kp 18
//#define DEFAULT_Ki 1
Expand Down Expand Up @@ -313,7 +313,7 @@
#define DEFAULT_bedKp 390
#define DEFAULT_bedKi 70
#define DEFAULT_bedKd 546

//24V 250W silicone heater on to 4mm glass CartesioM
//#define DEFAULT_bedKp 303
//#define DEFAULT_bedKi 42
Expand Down Expand Up @@ -786,6 +786,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define PREHEAT_2_TEMP_BED 110
#define PREHEAT_2_FAN_SPEED 0 // Value from 0 to 255

//
// Clean Nozzle Feature -- EXPERIMENTAL
//
// When enabled allows the user to send G12 to start the nozzle cleaning
// process, the G-Code accepts two parameters:
// "P" for pattern selection
// "S" for defining the number of strokes/repetitions
//
// Available list of patterns:
// P0: This is the default pattern, this process requires a sponge type
// material at a fixed bed location, the cleaning process is based on
// "strokes" i.e. back-and-forth movements between the starting and end
// points.
//
// P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
// defines the number of zig-zag triangles to be done. "S" defines the
// number of strokes aka one back-and-forth movement. As an example
// sending "G12 P1 S1 T3" will execute:
//
// --
// | (X0, Y1) | /\ /\ /\ | (X1, Y1)
// | | / \ / \ / \ |
// A | | / \ / \ / \ |
// | | / \ / \ / \ |
// | (X0, Y0) | / \/ \/ \ | (X1, Y0)
// -- +--------------------------------+
// |________|_________|_________|
// T1 T2 T3
//
// Caveats: End point Z should use the same value as Start point Z.
//
// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
// may change to add new functionality like different wipe patterns.
//
//#define NOZZLE_CLEAN_FEATURE

#if ENABLED(NOZZLE_CLEAN_FEATURE)
// Number of pattern repetitions
#define NOZZLE_CLEAN_STROKES 12

// { X, Y, Z}
#define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
#define NOZZLE_CLEAN_END_PT {100, 60, (Z_MIN_POS + 5)}

// Moves the nozzle to the parked position
#define NOZZLE_CLEAN_PARK
#endif

//
// Print job timer
//
Expand Down
48 changes: 48 additions & 0 deletions Marlin/example_configurations/Felix/Configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,54 @@ const bool Z_MIN_PROBE_ENDSTOP_INVERTING = false; // set to true to invert the l
#define PREHEAT_2_TEMP_BED 100
#define PREHEAT_2_FAN_SPEED 255 // Value from 0 to 255

//
// Clean Nozzle Feature -- EXPERIMENTAL
//
// When enabled allows the user to send G12 to start the nozzle cleaning
// process, the G-Code accepts two parameters:
// "P" for pattern selection
// "S" for defining the number of strokes/repetitions
//
// Available list of patterns:
// P0: This is the default pattern, this process requires a sponge type
// material at a fixed bed location, the cleaning process is based on
// "strokes" i.e. back-and-forth movements between the starting and end
// points.
//
// P1: This starts a zig-zag pattern between (X0, Y0) and (X1, Y1), "T"
// defines the number of zig-zag triangles to be done. "S" defines the
// number of strokes aka one back-and-forth movement. As an example
// sending "G12 P1 S1 T3" will execute:
//
// --
// | (X0, Y1) | /\ /\ /\ | (X1, Y1)
// | | / \ / \ / \ |
// A | | / \ / \ / \ |
// | | / \ / \ / \ |
// | (X0, Y0) | / \/ \/ \ | (X1, Y0)
// -- +--------------------------------+
// |________|_________|_________|
// T1 T2 T3
//
// Caveats: End point Z should use the same value as Start point Z.
//
// Attention: This is an EXPERIMENTAL feature, in the future the G-code arguments
// may change to add new functionality like different wipe patterns.
//
//#define NOZZLE_CLEAN_FEATURE

#if ENABLED(NOZZLE_CLEAN_FEATURE)
// Number of pattern repetitions
#define NOZZLE_CLEAN_STROKES 12

// { X, Y, Z}
#define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)}
#define NOZZLE_CLEAN_END_PT {100, 60, (Z_MIN_POS + 5)}

// Moves the nozzle to the parked position
#define NOZZLE_CLEAN_PARK
#endif

//
// Print job timer
//
Expand Down
Loading