64
64
#if HAS_LEVELING
65
65
#include " ../feature/bedlevel/bedlevel.h"
66
66
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
67
- #include " ../feature/bedlevel/abl/ x_twist.h"
67
+ #include " ../feature/x_twist.h"
68
68
#endif
69
69
#endif
70
70
@@ -269,13 +269,17 @@ typedef struct SettingsDataStruct {
269
269
xy_pos_t bilinear_grid_spacing, bilinear_start; // G29 L F
270
270
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
271
271
bed_mesh_t z_values; // G29
272
- #if ENABLED(X_AXIS_TWIST_COMPENSATION)
273
- XATC xatc; // TBD
274
- #endif
275
272
#else
276
273
float z_values[3 ][3 ];
277
274
#endif
278
275
276
+ //
277
+ // X_AXIS_TWIST_COMPENSATION
278
+ //
279
+ #if ENABLED(X_AXIS_TWIST_COMPENSATION)
280
+ XATC xatc; // TBD
281
+ #endif
282
+
279
283
//
280
284
// AUTO_BED_LEVELING_UBL
281
285
//
@@ -298,7 +302,7 @@ typedef struct SettingsDataStruct {
298
302
int16_t z_offsets_bed[COUNT(ptc.z_offsets_bed)]; // M871 B I V
299
303
#endif
300
304
#if ENABLED(PTC_HOTEND)
301
- int16_t z_offsets_hotend[COUNT(ptc.z_offsets_hotend)]; // M871 E I V
305
+ int16_t z_offsets_hotend[COUNT(ptc.z_offsets_hotend)]; // M871 E I V
302
306
#endif
303
307
#endif
304
308
@@ -873,9 +877,6 @@ void MarlinSettings::postprocess() {
873
877
sizeof (z_values) == (GRID_MAX_POINTS) * sizeof (z_values[0 ][0 ]),
874
878
" Bilinear Z array is the wrong size."
875
879
);
876
- #if ENABLED(X_AXIS_TWIST_COMPENSATION)
877
- static_assert (COUNT (xatc.z_offset ) == XATC_MAX_POINTS, " XATC Z-offset mesh is the wrong size." );
878
- #endif
879
880
#else
880
881
const xy_pos_t bilinear_start{0 }, bilinear_grid_spacing{0 };
881
882
#endif
@@ -889,15 +890,20 @@ void MarlinSettings::postprocess() {
889
890
890
891
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
891
892
EEPROM_WRITE (z_values); // 9-256 floats
892
- #if ENABLED(X_AXIS_TWIST_COMPENSATION)
893
- EEPROM_WRITE (xatc);
894
- #endif
895
893
#else
896
894
dummyf = 0 ;
897
895
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE (dummyf);
898
896
#endif
899
897
}
900
898
899
+ //
900
+ // X Axis Twist Compensation
901
+ //
902
+ #if ENABLED(X_AXIS_TWIST_COMPENSATION)
903
+ _FIELD_TEST (xatc);
904
+ EEPROM_WRITE (xatc);
905
+ #endif
906
+
901
907
//
902
908
// Unified Bed Leveling
903
909
//
@@ -1785,9 +1791,6 @@ void MarlinSettings::postprocess() {
1785
1791
EEPROM_READ (bilinear_grid_spacing); // 2 ints
1786
1792
EEPROM_READ (bilinear_start); // 2 ints
1787
1793
EEPROM_READ (z_values); // 9 to 256 floats
1788
- #if ENABLED(X_AXIS_TWIST_COMPENSATION)
1789
- EEPROM_READ (xatc);
1790
- #endif
1791
1794
}
1792
1795
else // EEPROM data is stale
1793
1796
#endif // AUTO_BED_LEVELING_BILINEAR
@@ -1800,6 +1803,13 @@ void MarlinSettings::postprocess() {
1800
1803
}
1801
1804
}
1802
1805
1806
+ //
1807
+ // X Axis Twist Compensation
1808
+ //
1809
+ #if ENABLED(X_AXIS_TWIST_COMPENSATION)
1810
+ EEPROM_READ (xatc);
1811
+ #endif
1812
+
1803
1813
//
1804
1814
// Unified Bed Leveling active state
1805
1815
//
@@ -2849,6 +2859,14 @@ void MarlinSettings::reset() {
2849
2859
TERN_ (ENABLE_LEVELING_FADE_HEIGHT, new_z_fade_height = (DEFAULT_LEVELING_FADE_HEIGHT));
2850
2860
TERN_ (HAS_LEVELING, reset_bed_level ());
2851
2861
2862
+ //
2863
+ // X Axis Twist Compensation
2864
+ //
2865
+ TERN_ (X_AXIS_TWIST_COMPENSATION, xatc.reset ());
2866
+
2867
+ //
2868
+ // Nozzle-to-probe Offset
2869
+ //
2852
2870
#if HAS_BED_PROBE
2853
2871
constexpr float dpo[] = NOZZLE_TO_PROBE_OFFSET;
2854
2872
static_assert (COUNT (dpo) == LINEAR_AXES, " NOZZLE_TO_PROBE_OFFSET must contain offsets for each linear axis X, Y, Z...." );
@@ -3313,14 +3331,14 @@ void MarlinSettings::reset() {
3313
3331
}
3314
3332
}
3315
3333
3316
- // TODO: Create G-code for settings
3317
- // #if ENABLED(X_AXIS_TWIST_COMPENSATION)
3318
- // CONFIG_ECHO_START();
3319
- // xatc.print_points();
3320
- // #endif
3321
-
3322
3334
#endif
3323
3335
3336
+ // TODO: Create G-code for settings
3337
+ // #if ENABLED(X_AXIS_TWIST_COMPENSATION)
3338
+ // CONFIG_ECHO_START();
3339
+ // xatc.print_points();
3340
+ // #endif
3341
+
3324
3342
#endif // HAS_LEVELING
3325
3343
3326
3344
//
0 commit comments