Tweaks to E2END, mesh slot offset
This commit is contained in:
parent
5ce64f6d16
commit
4b5a42f86a
@ -1482,6 +1482,10 @@ void MarlinSettings::postprocess() {
|
|||||||
return (meshes_end - meshes_start_index()) / sizeof(ubl.z_values);
|
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) {
|
void MarlinSettings::store_mesh(const int8_t slot) {
|
||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
@ -1497,9 +1501,8 @@ void MarlinSettings::postprocess() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pos = mesh_slot_offset(slot);
|
||||||
uint16_t crc = 0;
|
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_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
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int pos = mesh_slot_offset(slot);
|
||||||
uint16_t crc = 0;
|
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;
|
uint8_t * const dest = into ? (uint8_t*)into : (uint8_t*)&ubl.z_values;
|
||||||
read_data(pos, dest, sizeof(ubl.z_values), &crc);
|
read_data(pos, dest, sizeof(ubl.z_values), &crc);
|
||||||
|
|
||||||
|
@ -55,6 +55,7 @@ class MarlinSettings {
|
|||||||
static int16_t meshes_start_index();
|
static int16_t meshes_start_index();
|
||||||
FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
|
FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
|
||||||
static uint16_t calc_num_meshes();
|
static uint16_t calc_num_meshes();
|
||||||
|
static int mesh_slot_offset(const int8_t slot);
|
||||||
static void store_mesh(const int8_t slot);
|
static void store_mesh(const int8_t slot);
|
||||||
static void load_mesh(const int8_t slot, void * const into=NULL);
|
static void load_mesh(const int8_t slot, void * const into=NULL);
|
||||||
|
|
||||||
@ -82,9 +83,8 @@ class MarlinSettings {
|
|||||||
|
|
||||||
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
|
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
|
||||||
// That can store is enabled
|
// That can store is enabled
|
||||||
static int16_t meshes_begin;
|
static constexpr int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
|
||||||
const static int16_t meshes_end = E2END - 128; // 128 is a placeholder for the size of the MAT; the MAT will always
|
// live at the very end of the eeprom
|
||||||
// live at the very end of the eeprom
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1163,13 +1163,13 @@
|
|||||||
|
|
||||||
SERIAL_ECHO_START();
|
SERIAL_ECHO_START();
|
||||||
SERIAL_ECHOLNPGM("EEPROM Dump:");
|
SERIAL_ECHOLNPGM("EEPROM Dump:");
|
||||||
for (uint16_t i = 0; i < E2END + 1; i += 16) {
|
for (uint16_t i = 0; i <= E2END; i += 16) {
|
||||||
if (!(i & 0x3)) idle();
|
if (!(i & 0x3)) idle();
|
||||||
print_hex_word(i);
|
print_hex_word(i);
|
||||||
SERIAL_ECHOPGM(": ");
|
SERIAL_ECHOPGM(": ");
|
||||||
for (uint16_t j = 0; j < 16; j++) {
|
for (uint16_t j = 0; j < 16; j++) {
|
||||||
kkkk = i + j;
|
kkkk = i + j;
|
||||||
eeprom_read_block(&cccc, (const void *) kkkk, sizeof(unsigned char));
|
eeprom_read_block(&cccc, (const void *)kkkk, sizeof(unsigned char));
|
||||||
print_hex_byte(cccc);
|
print_hex_byte(cccc);
|
||||||
SERIAL_ECHO(' ');
|
SERIAL_ECHO(' ');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user