Fix E2END and add EEPROM to Smart RAMPS

Reference #9983
This commit is contained in:
Scott Lahteine
2018-03-10 03:02:53 -06:00
parent ddce486360
commit 239902f861
8 changed files with 19 additions and 10 deletions

View File

@ -1494,6 +1494,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)
@ -1509,8 +1513,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);
HAL::PersistentStore::access_start();
const bool status = HAL::PersistentStore::write_data(pos, (uint8_t *)&ubl.z_values, sizeof(ubl.z_values), &crc);
@ -1546,8 +1550,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;
HAL::PersistentStore::access_start();

View File

@ -73,6 +73,7 @@ class MarlinSettings {
static int16_t meshes_start_index();
FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
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 load_mesh(const int8_t slot, void * const into=NULL);
@ -104,8 +105,8 @@ class MarlinSettings {
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
// That can store is enabled
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
static constexpr 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
#endif