@@ -91,7 +91,7 @@ void GcodeSuite::G34() {
|
||||
digipot_i2c.set_current(Z_AXIS, target_current)
|
||||
#elif HAS_TRINAMIC_CONFIG
|
||||
const uint16_t target_current = parser.intval('S', GANTRY_CALIBRATION_CURRENT);
|
||||
static uint16_t previous_current_arr[NUM_Z_STEPPER_DRIVERS];
|
||||
static uint16_t previous_current_arr[NUM_Z_STEPPERS];
|
||||
#if AXIS_IS_TMC(Z)
|
||||
previous_current_arr[0] = stepperZ.getMilliamps();
|
||||
stepperZ.rms_current(target_current);
|
||||
|
@@ -52,9 +52,9 @@
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
#if NUM_Z_STEPPERS >= 3
|
||||
#define TRIPLE_Z 1
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
#if NUM_Z_STEPPERS >= 4
|
||||
#define QUAD_Z 1
|
||||
#endif
|
||||
#endif
|
||||
@@ -180,11 +180,11 @@ void GcodeSuite::G34() {
|
||||
// This hack is un-done at the end of G34 - either by re-homing, or by using the probed heights of the last iteration.
|
||||
|
||||
#if !HAS_Z_STEPPER_ALIGN_STEPPER_XY
|
||||
float last_z_align_move[NUM_Z_STEPPER_DRIVERS] = ARRAY_N_1(NUM_Z_STEPPER_DRIVERS, 10000.0f);
|
||||
float last_z_align_move[NUM_Z_STEPPERS] = ARRAY_N_1(NUM_Z_STEPPERS, 10000.0f);
|
||||
#else
|
||||
float last_z_align_level_indicator = 10000.0f;
|
||||
#endif
|
||||
float z_measured[NUM_Z_STEPPER_DRIVERS] = { 0 },
|
||||
float z_measured[NUM_Z_STEPPERS] = { 0 },
|
||||
z_maxdiff = 0.0f,
|
||||
amplification = z_auto_align_amplification;
|
||||
|
||||
@@ -217,9 +217,9 @@ void GcodeSuite::G34() {
|
||||
float z_measured_max = -100000.0f;
|
||||
|
||||
// Probe all positions (one per Z-Stepper)
|
||||
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
|
||||
LOOP_L_N(i, NUM_Z_STEPPERS) {
|
||||
// iteration odd/even --> downward / upward stepper sequence
|
||||
const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPER_DRIVERS - 1 - i : i;
|
||||
const uint8_t iprobe = (iteration & 1) ? NUM_Z_STEPPERS - 1 - i : i;
|
||||
|
||||
// Safe clearance even on an incline
|
||||
if ((iteration == 0 || i > 0) && z_probe > current_position.z) do_blocking_move_to_z(z_probe);
|
||||
@@ -270,20 +270,20 @@ void GcodeSuite::G34() {
|
||||
// This allows the actual adjustment logic to be shared by both algorithms.
|
||||
linear_fit_data lfd;
|
||||
incremental_LSF_reset(&lfd);
|
||||
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
|
||||
LOOP_L_N(i, NUM_Z_STEPPERS) {
|
||||
SERIAL_ECHOLNPGM("PROBEPT_", i, ": ", z_measured[i]);
|
||||
incremental_LSF(&lfd, z_stepper_align.xy[i], z_measured[i]);
|
||||
}
|
||||
finish_incremental_LSF(&lfd);
|
||||
|
||||
z_measured_min = 100000.0f;
|
||||
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
|
||||
LOOP_L_N(i, NUM_Z_STEPPERS) {
|
||||
z_measured[i] = -(lfd.A * z_stepper_align.stepper_xy[i].x + lfd.B * z_stepper_align.stepper_xy[i].y + lfd.D);
|
||||
z_measured_min = _MIN(z_measured_min, z_measured[i]);
|
||||
}
|
||||
|
||||
SERIAL_ECHOLNPGM(
|
||||
LIST_N(DOUBLE(NUM_Z_STEPPER_DRIVERS),
|
||||
LIST_N(DOUBLE(NUM_Z_STEPPERS),
|
||||
"Calculated Z1=", z_measured[0],
|
||||
" Z2=", z_measured[1],
|
||||
" Z3=", z_measured[2],
|
||||
@@ -307,7 +307,7 @@ void GcodeSuite::G34() {
|
||||
|
||||
#if HAS_STATUS_MESSAGE
|
||||
char fstr1[10];
|
||||
char msg[6 + (6 + 5) * NUM_Z_STEPPER_DRIVERS + 1]
|
||||
char msg[6 + (6 + 5) * NUM_Z_STEPPERS + 1]
|
||||
#if TRIPLE_Z
|
||||
, fstr2[10], fstr3[10]
|
||||
#if QUAD_Z
|
||||
@@ -345,12 +345,12 @@ void GcodeSuite::G34() {
|
||||
|
||||
// Calculate mean value as a reference
|
||||
float z_measured_mean = 0.0f;
|
||||
LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) z_measured_mean += z_measured[zstepper];
|
||||
z_measured_mean /= NUM_Z_STEPPER_DRIVERS;
|
||||
LOOP_L_N(zstepper, NUM_Z_STEPPERS) z_measured_mean += z_measured[zstepper];
|
||||
z_measured_mean /= NUM_Z_STEPPERS;
|
||||
|
||||
// Calculate the sum of the absolute deviations from the mean value
|
||||
float z_align_level_indicator = 0.0f;
|
||||
LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS)
|
||||
LOOP_L_N(zstepper, NUM_Z_STEPPERS)
|
||||
z_align_level_indicator += ABS(z_measured[zstepper] - z_measured_mean);
|
||||
|
||||
// If it's getting worse, stop and throw an error
|
||||
@@ -365,7 +365,7 @@ void GcodeSuite::G34() {
|
||||
|
||||
bool success_break = true;
|
||||
// Correct the individual stepper offsets
|
||||
LOOP_L_N(zstepper, NUM_Z_STEPPER_DRIVERS) {
|
||||
LOOP_L_N(zstepper, NUM_Z_STEPPERS) {
|
||||
// Calculate current stepper move
|
||||
float z_align_move = z_measured[zstepper] - z_measured_min;
|
||||
const float z_align_abs = ABS(z_align_move);
|
||||
@@ -515,9 +515,9 @@ void GcodeSuite::M422() {
|
||||
#endif
|
||||
}
|
||||
|
||||
if (!WITHIN(position_index, 1, NUM_Z_STEPPER_DRIVERS)) {
|
||||
if (!WITHIN(position_index, 1, NUM_Z_STEPPERS)) {
|
||||
SERIAL_ECHOF(err_string);
|
||||
SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPER_DRIVERS) ").");
|
||||
SERIAL_ECHOLNPGM(" index invalid (1.." STRINGIFY(NUM_Z_STEPPERS) ").");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -544,7 +544,7 @@ void GcodeSuite::M422() {
|
||||
|
||||
void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
|
||||
report_heading(forReplay, F(STR_Z_AUTO_ALIGN));
|
||||
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
|
||||
LOOP_L_N(i, NUM_Z_STEPPERS) {
|
||||
report_echo_start(forReplay);
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
PSTR(" M422 S"), i + 1,
|
||||
@@ -553,7 +553,7 @@ void GcodeSuite::M422_report(const bool forReplay/*=true*/) {
|
||||
);
|
||||
}
|
||||
#if HAS_Z_STEPPER_ALIGN_STEPPER_XY
|
||||
LOOP_L_N(i, NUM_Z_STEPPER_DRIVERS) {
|
||||
LOOP_L_N(i, NUM_Z_STEPPERS) {
|
||||
report_echo_start(forReplay);
|
||||
SERIAL_ECHOLNPGM_P(
|
||||
PSTR(" M422 W"), i + 1,
|
||||
|
@@ -93,12 +93,12 @@
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
if (parser.seenval('Z')) {
|
||||
const float z_adj = parser.value_linear_units();
|
||||
#if NUM_Z_STEPPER_DRIVERS == 2
|
||||
#if NUM_Z_STEPPERS == 2
|
||||
endstops.z2_endstop_adj = z_adj;
|
||||
#else
|
||||
const int ind = parser.intval('S');
|
||||
#define _SET_ZADJ(N) if (!ind || ind == N) endstops.z##N##_endstop_adj = z_adj;
|
||||
REPEAT_S(2, INCREMENT(NUM_Z_STEPPER_DRIVERS), _SET_ZADJ)
|
||||
REPEAT_S(2, INCREMENT(NUM_Z_STEPPERS), _SET_ZADJ)
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -114,11 +114,11 @@
|
||||
SERIAL_ECHOLNPGM_P(SP_Y_STR, LINEAR_UNIT(endstops.y2_endstop_adj));
|
||||
#endif
|
||||
#if ENABLED(Z_MULTI_ENDSTOPS)
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 3
|
||||
#if NUM_Z_STEPPERS >= 3
|
||||
SERIAL_ECHOPGM(" S2 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
|
||||
report_echo_start(forReplay);
|
||||
SERIAL_ECHOPGM(" M666 S3 Z", LINEAR_UNIT(endstops.z3_endstop_adj));
|
||||
#if NUM_Z_STEPPER_DRIVERS >= 4
|
||||
#if NUM_Z_STEPPERS >= 4
|
||||
report_echo_start(forReplay);
|
||||
SERIAL_ECHOPGM(" M666 S4 Z", LINEAR_UNIT(endstops.z4_endstop_adj));
|
||||
#endif
|
||||
|
@@ -50,9 +50,9 @@
|
||||
* W[linear] 0/1 Enable park & Z Raise
|
||||
* X[linear] Park X (Requires TOOLCHANGE_PARK)
|
||||
* Y[linear] Park Y (Requires TOOLCHANGE_PARK)
|
||||
* I[linear] Park I (Requires TOOLCHANGE_PARK and NUM_AXES >= 4)
|
||||
* J[linear] Park J (Requires TOOLCHANGE_PARK and NUM_AXES >= 5)
|
||||
* K[linear] Park K (Requires TOOLCHANGE_PARK and NUM_AXES >= 6)
|
||||
* I[linear] Park I (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 4)
|
||||
* J[linear] Park J (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 5)
|
||||
* K[linear] Park K (Requires TOOLCHANGE_PARK and LINEAR_AXES >= 6)
|
||||
* Z[linear] Z Raise
|
||||
* F[speed] Fan Speed 0-255
|
||||
* D[seconds] Fan time
|
||||
|
@@ -34,7 +34,7 @@
|
||||
#include "../../../module/tool_change.h"
|
||||
#endif
|
||||
|
||||
#if ENABLED(HAS_PRUSA_MMU2)
|
||||
#if HAS_PRUSA_MMU2
|
||||
#include "../../../feature/mmu/mmu2.h"
|
||||
#if ENABLED(MMU2_MENUS)
|
||||
#include "../../../lcd/menu/menu_mmu2.h"
|
||||
|
Reference in New Issue
Block a user