Tweaks to E2END, mesh slot offset

This commit is contained in:
Scott Lahteine
2018-03-10 03:07:50 -06:00
parent 5ce64f6d16
commit 4b5a42f86a
3 changed files with 11 additions and 8 deletions

View File

@@ -1482,6 +1482,10 @@ void MarlinSettings::postprocess() {
return (meshes_end - meshes_start_index()) / sizeof(ubl.z_values);
}
int MarlinSettings::mesh_slot_offset(const int8_t slot) {
return meshes_end - (slot + 1) * sizeof(ubl.z_values);
}
void MarlinSettings::store_mesh(const int8_t slot) {
#if ENABLED(AUTO_BED_LEVELING_UBL)
@@ -1497,9 +1501,8 @@ void MarlinSettings::postprocess() {
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
int pos = meshes_end - (slot + 1) * sizeof(ubl.z_values);
write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
// Write crc to MAT along with other data, or just tack on to the beginning or end
@@ -1528,8 +1531,8 @@ void MarlinSettings::postprocess() {
return;
}
int pos = mesh_slot_offset(slot);
uint16_t crc = 0;
int pos = meshes_end - (slot + 1) * sizeof(ubl.z_values);
uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&ubl.z_values;
read_data(pos, dest, sizeof(ubl.z_values), &crc);