X Twist Compensation & Calibration (#23238)

This commit is contained in:
Giuseppe499
2021-12-07 02:53:51 +01:00
committed by Scott Lahteine
parent 15204470a8
commit efd67cf80d
20 changed files with 416 additions and 21 deletions

View File

@ -63,6 +63,9 @@
#if HAS_LEVELING
#include "../feature/bedlevel/bedlevel.h"
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
#include "../feature/bedlevel/abl/x_twist.h"
#endif
#endif
#if ENABLED(Z_STEPPER_AUTO_ALIGN)
@ -250,6 +253,9 @@ typedef struct SettingsDataStruct {
xy_pos_t bilinear_grid_spacing, bilinear_start; // G29 L F
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
bed_mesh_t z_values; // G29
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
XATC xatc; // TBD
#endif
#else
float z_values[3][3];
#endif
@ -814,6 +820,12 @@ void MarlinSettings::postprocess() {
sizeof(z_values) == (GRID_MAX_POINTS) * sizeof(z_values[0][0]),
"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."
);
#endif
#else
const xy_pos_t bilinear_start{0}, bilinear_grid_spacing{0};
#endif
@ -827,6 +839,9 @@ void MarlinSettings::postprocess() {
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
EEPROM_WRITE(z_values); // 9-256 floats
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
EEPROM_WRITE(xatc);
#endif
#else
dummyf = 0;
for (uint16_t q = grid_max_x * grid_max_y; q--;) EEPROM_WRITE(dummyf);
@ -1691,6 +1706,9 @@ void MarlinSettings::postprocess() {
EEPROM_READ(bilinear_grid_spacing); // 2 ints
EEPROM_READ(bilinear_start); // 2 ints
EEPROM_READ(z_values); // 9 to 256 floats
#if ENABLED(X_AXIS_TWIST_COMPENSATION)
EEPROM_READ(xatc);
#endif
}
else // EEPROM data is stale
#endif // AUTO_BED_LEVELING_BILINEAR
@ -3198,6 +3216,12 @@ void MarlinSettings::reset() {
}
}
// TODO: Create G-code for settings
//#if ENABLED(X_AXIS_TWIST_COMPENSATION)
// CONFIG_ECHO_START();
// xatc.print_points();
//#endif
#endif
#endif // HAS_LEVELING