Nozzle::clean() no longer requires HAS_BED_PROBE

This commit is contained in:
João Brázio 2016-07-19 01:56:14 +01:00 committed by Scott Lahteine
parent 5cdd6f02ec
commit 47fef80848
5 changed files with 39 additions and 46 deletions

View file

@ -894,12 +894,12 @@
// Number of pattern repetitions // Number of pattern repetitions
#define NOZZLE_CLEAN_STROKES 12 #define NOZZLE_CLEAN_STROKES 12
// { X, Y, Z} // Specify positions as { X, Y, Z }
#define NOZZLE_CLEAN_START_PT { 30, 30, (Z_MIN_POS + 5)} #define NOZZLE_CLEAN_START_POINT { 30, 30, (Z_MIN_POS + 1)}
#define NOZZLE_CLEAN_END_PT {100, 60, (Z_MIN_POS + 5)} #define NOZZLE_CLEAN_END_POINT {100, 60, (Z_MIN_POS + 1)}
// Moves the nozzle to the parked position // Moves the nozzle to the initial position
#define NOZZLE_CLEAN_PARK #define NOZZLE_CLEAN_GOBACK
#endif #endif
// //

View file

@ -404,4 +404,14 @@ void calculate_volumetric_multipliers();
#endif #endif
#endif #endif
/**
* Blocking movement and shorthand functions
*/
static void do_blocking_move_to(float x, float y, float z, float fr_mm_m=0.0);
static void do_blocking_move_to_axis_pos(AxisEnum axis, float where, float fr_mm_m=0.0);
static void do_blocking_move_to_x(float x, float fr_mm_m=0.0);
static void do_blocking_move_to_y(float y);
static void do_blocking_move_to_z(float z, float fr_mm_m=0.0);
static void do_blocking_move_to_xy(float x, float y, float fr_mm_m=0.0);
#endif //MARLIN_H #endif //MARLIN_H

View file

@ -59,6 +59,7 @@
#include "language.h" #include "language.h"
#include "pins_arduino.h" #include "pins_arduino.h"
#include "math.h" #include "math.h"
#include "nozzle.h"
#if ENABLED(USE_WATCHDOG) #if ENABLED(USE_WATCHDOG)
#include "watchdog.h" #include "watchdog.h"
@ -1660,7 +1661,7 @@ inline void set_destination_to_current() { memcpy(destination, current_position,
* Plan a move to (X, Y, Z) and set the current_position * Plan a move to (X, Y, Z) and set the current_position
* The final current_position may not be the one that was requested * The final current_position may not be the one that was requested
*/ */
static void do_blocking_move_to(float x, float y, float z, float fr_mm_m = 0.0) { void do_blocking_move_to(float x, float y, float z, float fr_mm_m /*=0.0*/) {
float old_feedrate_mm_m = feedrate_mm_m; float old_feedrate_mm_m = feedrate_mm_m;
#if ENABLED(DEBUG_LEVELING_FEATURE) #if ENABLED(DEBUG_LEVELING_FEATURE)
@ -1708,21 +1709,14 @@ static void do_blocking_move_to(float x, float y, float z, float fr_mm_m = 0.0)
feedrate_mm_m = old_feedrate_mm_m; feedrate_mm_m = old_feedrate_mm_m;
} }
inline void do_blocking_move_to_x(float x, float fr_mm_m = 0.0) { void do_blocking_move_to_axis_pos(AxisEnum axis, float where, float fr_mm_m/*=0.0*/) {
do_blocking_move_to(x, current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m); current_position[axis] = where;
} do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], current_position[Z_AXIS], fr_mm_m);
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_xy(float x, float y, float fr_mm_m = 0.0) {
do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_m);
}
inline void do_blocking_move_to_z(float z, float fr_mm_m = 0.0) {
do_blocking_move_to(current_position[X_AXIS], current_position[Y_AXIS], z, fr_mm_m);
} }
void do_blocking_move_to_x(float x, float fr_mm_m/*=0.0*/) { do_blocking_move_to_axis_pos(X_AXIS, x, fr_mm_m); }
void do_blocking_move_to_y(float y) { do_blocking_move_to_axis_pos(Y_AXIS, y); }
void do_blocking_move_to_z(float z, float fr_mm_m/*=0.0*/) { do_blocking_move_to_axis_pos(Z_AXIS, z, fr_mm_m); }
void do_blocking_move_to_xy(float x, float y, float fr_mm_m/*=0.0*/) { do_blocking_move_to(x, y, current_position[Z_AXIS], fr_mm_m); }
// //
// Prepare to do endstop or probe moves // Prepare to do endstop or probe moves
@ -2784,9 +2778,7 @@ inline void gcode_G4() {
#endif //FWRETRACT #endif //FWRETRACT
#if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE #if ENABLED(NOZZLE_CLEAN_FEATURE)
#include "nozzle.h"
/** /**
* G12: Clean the nozzle * G12: Clean the nozzle
*/ */
@ -2819,8 +2811,6 @@ inline void gcode_G4() {
#endif #endif
#if ENABLED(NOZZLE_PARK_FEATURE) #if ENABLED(NOZZLE_PARK_FEATURE)
#include "nozzle.h"
/** /**
* G27: Park the nozzle * G27: Park the nozzle
*/ */
@ -3301,7 +3291,7 @@ inline void gcode_G28() {
} }
// For each G29 S2... // For each G29 S2...
if (probe_point == 0) { if (probe_point == 0) {
// For the intial G29 S2 make Z a positive value (e.g., 4.0) // For the initial G29 S2 make Z a positive value (e.g., 4.0)
current_position[Z_AXIS] = MESH_HOME_SEARCH_Z current_position[Z_AXIS] = MESH_HOME_SEARCH_Z
#if Z_HOME_DIR > 0 #if Z_HOME_DIR > 0
+ Z_MAX_POS + Z_MAX_POS
@ -7084,7 +7074,7 @@ void process_next_command() {
break; break;
#endif // FWRETRACT #endif // FWRETRACT
#if ENABLED(NOZZLE_CLEAN_FEATURE) && HAS_BED_PROBE #if ENABLED(NOZZLE_CLEAN_FEATURE)
case 12: case 12:
gcode_G12(); // G12: Nozzle Clean gcode_G12(); // G12: Nozzle Clean
break; break;

View file

@ -684,11 +684,4 @@
#error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead." #error "ENDSTOPS_ONLY_FOR_HOMING is deprecated. Use (disable) ENDSTOPS_ALWAYS_ON_DEFAULT instead."
#endif #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 #endif //SANITYCHECK_H

View file

@ -48,7 +48,7 @@ class Nozzle {
) __attribute__((optimize ("Os"))) { ) __attribute__((optimize ("Os"))) {
#if ENABLED(NOZZLE_CLEAN_FEATURE) #if ENABLED(NOZZLE_CLEAN_FEATURE)
#if ENABLED(NOZZLE_CLEAN_PARK) #if ENABLED(NOZZLE_CLEAN_GOBACK)
// Store the current coords // Store the current coords
point_t const initial = { point_t const initial = {
current_position[X_AXIS], current_position[X_AXIS],
@ -56,7 +56,7 @@ class Nozzle {
current_position[Z_AXIS], current_position[Z_AXIS],
current_position[E_AXIS] current_position[E_AXIS]
}; };
#endif // NOZZLE_CLEAN_PARK #endif // NOZZLE_CLEAN_GOBACK
// Move to the starting point // Move to the starting point
do_blocking_move_to_xy(start.x, start.y); do_blocking_move_to_xy(start.x, start.y);
@ -68,11 +68,11 @@ class Nozzle {
do_blocking_move_to_xy(start.x, start.y); do_blocking_move_to_xy(start.x, start.y);
} }
#if ENABLED(NOZZLE_CLEAN_PARK) #if ENABLED(NOZZLE_CLEAN_GOBACK)
// Move the nozzle to the initial point // Move the nozzle to the initial point
do_blocking_move_to_z(initial.z); do_blocking_move_to_z(initial.z);
do_blocking_move_to_xy(initial.x, initial.y); do_blocking_move_to_xy(initial.x, initial.y);
#endif // NOZZLE_CLEAN_PARK #endif // NOZZLE_CLEAN_GOBACK
#endif // NOZZLE_CLEAN_FEATURE #endif // NOZZLE_CLEAN_FEATURE
} }
@ -99,7 +99,7 @@ class Nozzle {
// Don't allow impossible triangles // Don't allow impossible triangles
if (A <= 0.0f || P <= 0.0f ) return; if (A <= 0.0f || P <= 0.0f ) return;
#if ENABLED(NOZZLE_CLEAN_PARK) #if ENABLED(NOZZLE_CLEAN_GOBACK)
// Store the current coords // Store the current coords
point_t const initial = { point_t const initial = {
current_position[X_AXIS], current_position[X_AXIS],
@ -107,7 +107,7 @@ class Nozzle {
current_position[Z_AXIS], current_position[Z_AXIS],
current_position[E_AXIS] current_position[E_AXIS]
}; };
#endif // NOZZLE_CLEAN_PARK #endif // NOZZLE_CLEAN_GOBACK
for (uint8_t j = 0; j < strokes; j++) { for (uint8_t j = 0; j < strokes; j++) {
for (uint8_t i = 0; i < (objects << 1); i++) { for (uint8_t i = 0; i < (objects << 1); i++) {
@ -126,11 +126,11 @@ class Nozzle {
} }
} }
#if ENABLED(NOZZLE_CLEAN_PARK) #if ENABLED(NOZZLE_CLEAN_GOBACK)
// Move the nozzle to the initial point // Move the nozzle to the initial point
do_blocking_move_to_z(initial.z); do_blocking_move_to_z(initial.z);
do_blocking_move_to_xy(initial.x, initial.y); do_blocking_move_to_xy(initial.x, initial.y);
#endif // NOZZLE_CLEAN_PARK #endif // NOZZLE_CLEAN_GOBACK
#endif // NOZZLE_CLEAN_FEATURE #endif // NOZZLE_CLEAN_FEATURE
} }
@ -152,14 +152,14 @@ class Nozzle {
switch (pattern) { switch (pattern) {
case 1: case 1:
Nozzle::zigzag( Nozzle::zigzag(
NOZZLE_CLEAN_START_PT, NOZZLE_CLEAN_START_POINT,
NOZZLE_CLEAN_END_PT, strokes, objects); NOZZLE_CLEAN_END_POINT, strokes, objects);
break; break;
default: default:
Nozzle::stroke( Nozzle::stroke(
NOZZLE_CLEAN_START_PT, NOZZLE_CLEAN_START_POINT,
NOZZLE_CLEAN_END_PT, strokes); NOZZLE_CLEAN_END_POINT, strokes);
} }
#endif // NOZZLE_CLEAN_FEATURE #endif // NOZZLE_CLEAN_FEATURE
} }