Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions Marlin/src/feature/bedlevel/abl/bbl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ class LevelingBilinear {
static xy_float_t grid_factor_virt;
#if ENABLED(VARIABLE_GRID_POINTS)
static xy_uint_t nr_grid_points_virt;
#else
static constexpr xy_uint_t nr_grid_points_virt { ABL_MAX_POINTS_VIRT_X, ABL_MAX_POINTS_VIRT_Y };
#endif

static float virt_coord(const uint8_t x, const uint8_t y);
Expand Down
4 changes: 0 additions & 4 deletions Marlin/src/feature/bedlevel/ubl/ubl.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,10 +62,6 @@ typedef struct {
#endif
} G29_parameters_t;

#if ENABLED(VARIABLE_GRID_POINTS)
class unified_bed_leveling;
#endif

class unified_bed_leveling {
private:

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1731,7 +1731,7 @@ typedef struct { uint8_t sx, ex, sy, ey; bool yfirst; } smart_fill_info;

SERIAL_ECHOPGM("Extrapolating mesh...");

const float weight_scaled = weight_factor * _MAX(mesh_dist.x, mesh_dist.y);
const float weight_scaled = weight_factor * _MAX(TERN(VARIABLE_GRID_POINTS, mesh_dist.x, MESH_X_DIST), TERN(VARIABLE_GRID_POINTS, mesh_dist.y, MESH_Y_DIST));

GRID_LOOP_COND(jx, jy) if (!isnan(z_values[jx][jy])) SBI(bitmap[jx], jy);

Expand Down
24 changes: 17 additions & 7 deletions Marlin/src/module/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ typedef struct SettingsDataStruct {
xy_pos_t bilinear_grid_spacing, bilinear_start; // G29 L F
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
#if ENABLED(VARIABLE_GRID_POINTS)
xy_uint8_t bilinear_grid_points;
xy_uint8_t nr_grid_points;
#endif
bed_mesh_t z_values; // G29
#else
Expand Down Expand Up @@ -3180,8 +3180,12 @@ void MarlinSettings::postprocess() {

// Write crc to MAT along with other data, or just tack on to the beginning or end
persistentStore.access_start();
const bool err = persistentStore.write_data(pos, (uint8_t *)&bedlevel.nr_grid_points, sizeof(bedlevel.nr_grid_points), &crc)
|| persistentStore.write_data(pos, src, MESH_DATA_SIZE, &crc);
#if ENABLED(VARIABLE_GRID_POINTS)
const bool err = persistentStore.write_data(pos, (uint8_t *)&bedlevel.nr_grid_points, sizeof(bedlevel.nr_grid_points), &crc)
|| persistentStore.write_data(pos, src, MESH_DATA_SIZE, &crc);
#else
const bool err = persistentStore.write_data(pos, src, MESH_DATA_SIZE, &crc);
#endif
persistentStore.access_finish();

if (err) SERIAL_ECHOLNPGM("?Unable to save mesh data.");
Expand Down Expand Up @@ -3215,9 +3219,13 @@ void MarlinSettings::postprocess() {
#endif

persistentStore.access_start();
xy_uint8_t nr_grid_points;
bool err = persistentStore.read_data(pos, (uint8_t *)&nr_grid_points, sizeof(nr_grid_points), &crc)
|| persistentStore.read_data(pos, dest, MESH_DATA_SIZE, &crc);
#if ENABLED(VARIABLE_GRID_POINTS)
xy_uint8_t nr_grid_points;
bool err = persistentStore.read_data(pos, (uint8_t *)&nr_grid_points, sizeof(nr_grid_points), &crc)
|| persistentStore.read_data(pos, dest, MESH_DATA_SIZE, &crc);
#else
uint16_t err = persistentStore.read_data(pos, dest, MESH_DATA_SIZE, &crc);
#endif
persistentStore.access_finish();

#if ENABLED(OPTIMIZED_MESH_STORAGE)
Expand All @@ -3243,7 +3251,9 @@ void MarlinSettings::postprocess() {
if (err)
SERIAL_ECHOLNPGM("?Unable to load mesh data.");
else {
bedlevel.set_nr_grid_points(nr_grid_points);
#if ENABLED(VARIABLE_GRID_POINTS)
bedlevel.set_nr_grid_points(nr_grid_points);
#endif
DEBUG_ECHOLNPGM("Mesh loaded from slot ", slot);
}

Expand Down
Loading