Unify debugging output with debug_out.h (#13388)
This commit is contained in:
@@ -42,6 +42,9 @@
|
||||
#include "../../feature/bedlevel/bedlevel.h"
|
||||
#endif
|
||||
|
||||
#define DEBUG_OUT ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
#include "../../core/debug_out.h"
|
||||
|
||||
float z_auto_align_xpos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_X,
|
||||
z_auto_align_ypos[Z_STEPPER_COUNT] = Z_STEPPER_ALIGN_Y;
|
||||
|
||||
@@ -59,19 +62,15 @@ inline void set_all_z_lock(const bool lock) {
|
||||
* Parameters: I<iterations> T<accuracy> A<amplification>
|
||||
*/
|
||||
void GcodeSuite::G34() {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
SERIAL_ECHOLNPGM(">>> G34");
|
||||
log_machine_info();
|
||||
}
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
DEBUG_ECHOLNPGM(">>> G34");
|
||||
log_machine_info();
|
||||
}
|
||||
|
||||
do { // break out on error
|
||||
|
||||
if (!TEST(axis_known_position, X_AXIS) || !TEST(axis_known_position, Y_AXIS)) {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> XY homing required.");
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> XY homing required.");
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -128,9 +127,7 @@ void GcodeSuite::G34() {
|
||||
z_measured[Z_STEPPER_COUNT] = { 0 };
|
||||
bool err_break = false;
|
||||
for (uint8_t iteration = 0; iteration < z_auto_align_iterations; ++iteration) {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> probing all positions.");
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> probing all positions.");
|
||||
|
||||
// Reset minimum value
|
||||
float z_measured_min = 100000.0f;
|
||||
@@ -141,19 +138,12 @@ void GcodeSuite::G34() {
|
||||
|
||||
// Stop on error
|
||||
if (isnan(z_measured[zstepper])) {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> PROBING FAILED!");
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> PROBING FAILED!");
|
||||
err_break = true;
|
||||
break;
|
||||
}
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
SERIAL_ECHOPAIR("> Z", int(zstepper + 1));
|
||||
SERIAL_ECHOLNPAIR(" measured position is ", z_measured[zstepper]);
|
||||
}
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " measured position is ", z_measured[zstepper]);
|
||||
|
||||
// Remember the maximum position to calculate the correction
|
||||
z_measured_min = MIN(z_measured_min, z_measured[zstepper]);
|
||||
@@ -178,9 +168,7 @@ void GcodeSuite::G34() {
|
||||
// Check for lost accuracy compared to last move
|
||||
if (last_z_align_move[zstepper] < z_align_abs - 1.0) {
|
||||
// Stop here
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> detected decreasing accuracy.");
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> detected decreasing accuracy.");
|
||||
err_break = true;
|
||||
break;
|
||||
}
|
||||
@@ -190,12 +178,7 @@ void GcodeSuite::G34() {
|
||||
// Only stop early if all measured points achieve accuracy target
|
||||
if (z_align_abs > z_auto_align_accuracy) success_break = false;
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) {
|
||||
SERIAL_ECHOPAIR("> Z", int(zstepper + 1));
|
||||
SERIAL_ECHOLNPAIR(" corrected by ", z_align_move);
|
||||
}
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPAIR("> Z", int(zstepper + 1), " corrected by ", z_align_move);
|
||||
|
||||
switch (zstepper) {
|
||||
case 0: stepper.set_z_lock(false); break;
|
||||
@@ -219,9 +202,7 @@ void GcodeSuite::G34() {
|
||||
stepper.set_separate_multi_axis(false);
|
||||
|
||||
if (success_break) {
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("> achieved target accuracy.");
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("> achieved target accuracy.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -252,9 +233,7 @@ void GcodeSuite::G34() {
|
||||
|
||||
} while(0);
|
||||
|
||||
#if ENABLED(DEBUG_LEVELING_FEATURE)
|
||||
if (DEBUGGING(LEVELING)) SERIAL_ECHOLNPGM("<<< G34");
|
||||
#endif
|
||||
if (DEBUGGING(LEVELING)) DEBUG_ECHOLNPGM("<<< G34");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user