From 4199191e999667e66cbaa4ff7844c520774304ed Mon Sep 17 00:00:00 2001 From: Scott Lahteine Date: Tue, 15 Feb 2022 15:09:09 -0600 Subject: [PATCH] =?UTF-8?q?=E2=99=BB=EF=B8=8F=20Rename=20XATC=20z=5Fvalues?= =?UTF-8?q?=20=3D>=20z=5Foffset?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/feature/bedlevel/abl/x_twist.cpp | 10 +++++----- Marlin/src/feature/bedlevel/abl/x_twist.h | 4 ++-- Marlin/src/lcd/menu/menu_x_twist.cpp | 6 +++--- Marlin/src/module/settings.cpp | 5 +---- 4 files changed, 11 insertions(+), 14 deletions(-) diff --git a/Marlin/src/feature/bedlevel/abl/x_twist.cpp b/Marlin/src/feature/bedlevel/abl/x_twist.cpp index 000c1e2294..24fdbca950 100644 --- a/Marlin/src/feature/bedlevel/abl/x_twist.cpp +++ b/Marlin/src/feature/bedlevel/abl/x_twist.cpp @@ -28,15 +28,15 @@ XATC xatc; float XATC::spacing, XATC::start; -xatc_points_t XATC::z_values; +xatc_array_t XATC::z_offset; void XATC::print_points() { SERIAL_ECHOLNPGM(" X-Twist Correction:"); LOOP_L_N(x, XATC_MAX_POINTS) { SERIAL_CHAR(' '); - if (!isnan(z_values[x])) { - if (z_values[x] >= 0) SERIAL_CHAR('+'); - SERIAL_ECHO_F(z_values[x], 3); + if (!isnan(z_offset[x])) { + if (z_offset[x] >= 0) SERIAL_CHAR('+'); + SERIAL_ECHO_F(z_offset[x], 3); } else { LOOP_L_N(i, 6) @@ -54,7 +54,7 @@ float XATC::compensation(const xy_pos_t &raw) { int i = FLOOR(t); LIMIT(i, 0, XATC_MAX_POINTS - 2); t -= i; - return lerp(t, z_values[i], z_values[i + 1]); + return lerp(t, z_offset[i], z_offset[i + 1]); } #endif // X_AXIS_TWIST_COMPENSATION diff --git a/Marlin/src/feature/bedlevel/abl/x_twist.h b/Marlin/src/feature/bedlevel/abl/x_twist.h index bbad9e73ef..9deb45a8b7 100644 --- a/Marlin/src/feature/bedlevel/abl/x_twist.h +++ b/Marlin/src/feature/bedlevel/abl/x_twist.h @@ -23,12 +23,12 @@ #include "../../../inc/MarlinConfigPre.h" -typedef float xatc_points_t[XATC_MAX_POINTS]; +typedef float xatc_array_t[XATC_MAX_POINTS]; class XATC { public: static float spacing, start; - static xatc_points_t z_values; + static xatc_array_t z_offset; static float compensation(const xy_pos_t &raw); static void print_points(); diff --git a/Marlin/src/lcd/menu/menu_x_twist.cpp b/Marlin/src/lcd/menu/menu_x_twist.cpp index 288f16603a..fab3b5ae11 100644 --- a/Marlin/src/lcd/menu/menu_x_twist.cpp +++ b/Marlin/src/lcd/menu/menu_x_twist.cpp @@ -77,7 +77,7 @@ void xatc_wizard_update_z_offset() { // void xatc_wizard_set_offset_and_go_to_next_point() { // Set Z-offset at probed point - xatc.z_values[manual_probe_index++] = probe.offset.z + current_position.z - measured_z; + xatc.z_offset[manual_probe_index++] = probe.offset.z + current_position.z - measured_z; // Go to next point ui.goto_screen(xatc_wizard_goto_next_point); } @@ -160,12 +160,12 @@ void xatc_wizard_goto_next_point() { else { // Compute the z-offset by averaging the values found with this wizard z_offset = 0; - LOOP_L_N(i, XATC_MAX_POINTS) z_offset += xatc.z_values[i]; + LOOP_L_N(i, XATC_MAX_POINTS) z_offset += xatc.z_offset[i]; z_offset /= XATC_MAX_POINTS; // Subtract the average from the values found with this wizard. // This way they are indipendent from the z-offset - LOOP_L_N(i, XATC_MAX_POINTS) xatc.z_values[i] -= z_offset; + LOOP_L_N(i, XATC_MAX_POINTS) xatc.z_offset[i] -= z_offset; ui.goto_screen(xatc_wizard_update_z_offset); } diff --git a/Marlin/src/module/settings.cpp b/Marlin/src/module/settings.cpp index 17a6500b80..db9fc7eb2f 100644 --- a/Marlin/src/module/settings.cpp +++ b/Marlin/src/module/settings.cpp @@ -863,10 +863,7 @@ void MarlinSettings::postprocess() { "Bilinear Z array is the wrong size." ); #if ENABLED(X_AXIS_TWIST_COMPENSATION) - static_assert( - sizeof(xatc.z_values) == (XATC_MAX_POINTS) * sizeof(xatc.z_values[0]), - "Z-offset mesh is the wrong size." - ); + static_assert(COUNT(xatc.z_offset) == XATC_MAX_POINTS, "XATC Z-offset mesh is the wrong size."); #endif #else const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0};