|
@@ -62,8 +62,8 @@ void Nozzle::zigzag(
|
62
|
62
|
__attribute__((unused)) uint8_t const &objects
|
63
|
63
|
) {
|
64
|
64
|
#if ENABLED(NOZZLE_CLEAN_FEATURE)
|
65
|
|
- float A = fabs(end.y - start.y); // [twice the] Amplitude
|
66
|
|
- float P = fabs(end.x - start.x) / (objects << 1); // Period
|
|
65
|
+ const float A = nozzle_clean_horizontal ? nozzle_clean_height : nozzle_clean_length, // [twice the] Amplitude
|
|
66
|
+ P = (nozzle_clean_horizontal ? nozzle_clean_length : nozzle_clean_height) / (objects << 1); // Period
|
67
|
67
|
|
68
|
68
|
// Don't allow impossible triangles
|
69
|
69
|
if (A <= 0.0f || P <= 0.0f ) return;
|
|
@@ -80,16 +80,16 @@ void Nozzle::zigzag(
|
80
|
80
|
|
81
|
81
|
for (uint8_t j = 0; j < strokes; j++) {
|
82
|
82
|
for (uint8_t i = 0; i < (objects << 1); i++) {
|
83
|
|
- float const x = start.x + i * P;
|
84
|
|
- float const y = start.y + (A/P) * (P - fabs(fmod((i*P), (2*P)) - P));
|
|
83
|
+ float const x = start.x + ( nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
|
84
|
+ float const y = start.y + (!nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
85
|
85
|
|
86
|
86
|
do_blocking_move_to_xy(x, y);
|
87
|
87
|
if (i == 0) do_blocking_move_to_z(start.z);
|
88
|
88
|
}
|
89
|
89
|
|
90
|
90
|
for (int i = (objects << 1); i > -1; i--) {
|
91
|
|
- float const x = start.x + i * P;
|
92
|
|
- float const y = start.y + (A/P) * (P - fabs(fmod((i*P), (2*P)) - P));
|
|
91
|
+ float const x = start.x + ( nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
|
92
|
+ float const y = start.y + (!nozzle_clean_horizontal ? i * P : (A/P) * (P - fabs(fmod((i*P), (2*P)) - P)) );
|
93
|
93
|
|
94
|
94
|
do_blocking_move_to_xy(x, y);
|
95
|
95
|
}
|