Browse Source

♻️ Rename XATC z_values => z_offset

Scott Lahteine 3 years ago
parent
commit
98a17cd60d

+ 5
- 5
Marlin/src/feature/bedlevel/abl/x_twist.cpp View File

28
 XATC xatc;
28
 XATC xatc;
29
 
29
 
30
 float XATC::spacing, XATC::start;
30
 float XATC::spacing, XATC::start;
31
-xatc_points_t XATC::z_values;
31
+xatc_array_t XATC::z_offset;
32
 
32
 
33
 void XATC::print_points() {
33
 void XATC::print_points() {
34
   SERIAL_ECHOLNPGM(" X-Twist Correction:");
34
   SERIAL_ECHOLNPGM(" X-Twist Correction:");
35
   LOOP_L_N(x, XATC_MAX_POINTS) {
35
   LOOP_L_N(x, XATC_MAX_POINTS) {
36
     SERIAL_CHAR(' ');
36
     SERIAL_CHAR(' ');
37
-    if (!isnan(z_values[x])) {
38
-      if (z_values[x] >= 0) SERIAL_CHAR('+');
39
-      SERIAL_ECHO_F(z_values[x], 3);
37
+    if (!isnan(z_offset[x])) {
38
+      if (z_offset[x] >= 0) SERIAL_CHAR('+');
39
+      SERIAL_ECHO_F(z_offset[x], 3);
40
     }
40
     }
41
     else {
41
     else {
42
       LOOP_L_N(i, 6)
42
       LOOP_L_N(i, 6)
54
   int i = FLOOR(t);
54
   int i = FLOOR(t);
55
   LIMIT(i, 0, XATC_MAX_POINTS - 2);
55
   LIMIT(i, 0, XATC_MAX_POINTS - 2);
56
   t -= i;
56
   t -= i;
57
-  return lerp(t, z_values[i], z_values[i + 1]);
57
+  return lerp(t, z_offset[i], z_offset[i + 1]);
58
 }
58
 }
59
 
59
 
60
 #endif // X_AXIS_TWIST_COMPENSATION
60
 #endif // X_AXIS_TWIST_COMPENSATION

+ 2
- 2
Marlin/src/feature/bedlevel/abl/x_twist.h View File

23
 
23
 
24
 #include "../../../inc/MarlinConfigPre.h"
24
 #include "../../../inc/MarlinConfigPre.h"
25
 
25
 
26
-typedef float xatc_points_t[XATC_MAX_POINTS];
26
+typedef float xatc_array_t[XATC_MAX_POINTS];
27
 
27
 
28
 class XATC {
28
 class XATC {
29
 public:
29
 public:
30
   static float spacing, start;
30
   static float spacing, start;
31
-  static xatc_points_t z_values;
31
+  static xatc_array_t z_offset;
32
 
32
 
33
   static float compensation(const xy_pos_t &raw);
33
   static float compensation(const xy_pos_t &raw);
34
   static void print_points();
34
   static void print_points();

+ 3
- 3
Marlin/src/lcd/menu/menu_x_twist.cpp View File

77
 //
77
 //
78
 void xatc_wizard_set_offset_and_go_to_next_point() {
78
 void xatc_wizard_set_offset_and_go_to_next_point() {
79
   // Set Z-offset at probed point
79
   // Set Z-offset at probed point
80
-  xatc.z_values[manual_probe_index++] = probe.offset.z + current_position.z - measured_z;
80
+  xatc.z_offset[manual_probe_index++] = probe.offset.z + current_position.z - measured_z;
81
   // Go to next point
81
   // Go to next point
82
   ui.goto_screen(xatc_wizard_goto_next_point);
82
   ui.goto_screen(xatc_wizard_goto_next_point);
83
 }
83
 }
160
   else {
160
   else {
161
     // Compute the z-offset by averaging the values found with this wizard
161
     // Compute the z-offset by averaging the values found with this wizard
162
     z_offset = 0;
162
     z_offset = 0;
163
-    LOOP_L_N(i, XATC_MAX_POINTS) z_offset += xatc.z_values[i];
163
+    LOOP_L_N(i, XATC_MAX_POINTS) z_offset += xatc.z_offset[i];
164
     z_offset /= XATC_MAX_POINTS;
164
     z_offset /= XATC_MAX_POINTS;
165
 
165
 
166
     // Subtract the average from the values found with this wizard.
166
     // Subtract the average from the values found with this wizard.
167
     // This way they are indipendent from the z-offset
167
     // This way they are indipendent from the z-offset
168
-    LOOP_L_N(i, XATC_MAX_POINTS) xatc.z_values[i] -= z_offset;
168
+    LOOP_L_N(i, XATC_MAX_POINTS) xatc.z_offset[i] -= z_offset;
169
 
169
 
170
     ui.goto_screen(xatc_wizard_update_z_offset);
170
     ui.goto_screen(xatc_wizard_update_z_offset);
171
   }
171
   }

+ 1
- 4
Marlin/src/module/settings.cpp View File

863
           "Bilinear Z array is the wrong size."
863
           "Bilinear Z array is the wrong size."
864
         );
864
         );
865
         #if ENABLED(X_AXIS_TWIST_COMPENSATION)
865
         #if ENABLED(X_AXIS_TWIST_COMPENSATION)
866
-          static_assert(
867
-            sizeof(xatc.z_values) == (XATC_MAX_POINTS) * sizeof(xatc.z_values[0]),
868
-            "Z-offset mesh is the wrong size."
869
-          );
866
+          static_assert(COUNT(xatc.z_offset) == XATC_MAX_POINTS, "XATC Z-offset mesh is the wrong size.");
870
         #endif
867
         #endif
871
       #else
868
       #else
872
         const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0};
869
         const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0};

Loading…
Cancel
Save