|
|
@ -26,6 +26,14 @@
|
|
|
|
#include "Marlin.h"
|
|
|
|
#include "Marlin.h"
|
|
|
|
#include "point_t.h"
|
|
|
|
#include "point_t.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#if ENABLED(NOZZLE_CLEAN_FEATURE)
|
|
|
|
|
|
|
|
constexpr float nozzle_clean_start_point[4] = NOZZLE_CLEAN_START_POINT,
|
|
|
|
|
|
|
|
nozzle_clean_end_point[4] = NOZZLE_CLEAN_END_POINT,
|
|
|
|
|
|
|
|
nozzle_clean_length = fabs(nozzle_clean_start_point[X_AXIS] - nozzle_clean_end_point[X_AXIS]), //abs x size of wipe pad
|
|
|
|
|
|
|
|
nozzle_clean_height = fabs(nozzle_clean_start_point[Y_AXIS] - nozzle_clean_end_point[Y_AXIS]); //abs y size of wipe pad
|
|
|
|
|
|
|
|
constexpr bool nozzle_clean_horizontal = nozzle_clean_length >= nozzle_clean_height; //whether to zig-zag horizontally or vertically
|
|
|
|
|
|
|
|
#endif //NOZZLE_CLEAN_FEATURE
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* @brief Nozzle class
|
|
|
|
* @brief Nozzle class
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -92,8 +100,8 @@ class Nozzle {
|
|
|
|
__attribute__((unused)) uint8_t const &objects
|
|
|
|
__attribute__((unused)) uint8_t const &objects
|
|
|
|
) __attribute__((optimize ("Os"))) {
|
|
|
|
) __attribute__((optimize ("Os"))) {
|
|
|
|
#if ENABLED(NOZZLE_CLEAN_FEATURE)
|
|
|
|
#if ENABLED(NOZZLE_CLEAN_FEATURE)
|
|
|
|
float A = fabs(end.y - start.y); // [twice the] Amplitude
|
|
|
|
float A = nozzle_clean_horizontal ? nozzle_clean_height : nozzle_clean_length; // [twice the] Amplitude
|
|
|
|
float P = fabs(end.x - start.x) / (objects << 1); // Period
|
|
|
|
float P = ( nozzle_clean_horizontal ? nozzle_clean_length : nozzle_clean_height ) / (objects << 1); // Period
|
|
|
|
|
|
|
|
|
|
|
|
// 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;
|
|
|
@ -110,16 +118,16 @@ class Nozzle {
|
|
|
|
|
|
|
|
|
|
|
|
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++) {
|
|
|
|
float const x = start.x + i * P;
|
|
|
|
float const x = start.x + ( nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
|
|
|
float const y = start.y + (A/P) * (P - fabs(fmod((i*P), (2*P)) - P));
|
|
|
|
float const y = start.y + (!nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_xy(x, y);
|
|
|
|
do_blocking_move_to_xy(x, y);
|
|
|
|
if (i == 0) do_blocking_move_to_z(start.z);
|
|
|
|
if (i == 0) do_blocking_move_to_z(start.z);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = (objects << 1); i > -1; i--) {
|
|
|
|
for (int i = (objects << 1); i > -1; i--) {
|
|
|
|
float const x = start.x + i * P;
|
|
|
|
float const x = start.x + ( nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
|
|
|
float const y = start.y + (A/P) * (P - fabs(fmod((i*P), (2*P)) - P));
|
|
|
|
float const y = start.y + (!nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
|
|
|
|
|
|
|
|
|
|
|
do_blocking_move_to_xy(x, y);
|
|
|
|
do_blocking_move_to_xy(x, y);
|
|
|
|
}
|
|
|
|
}
|
|
|
|