UBL G29 works without settings.load()
This commit is contained in:
parent
950be70a33
commit
e89f1453ab
|
@ -309,12 +309,6 @@
|
|||
|
||||
void unified_bed_leveling::G29() {
|
||||
|
||||
if (!settings.calc_num_meshes()) {
|
||||
SERIAL_PROTOCOLLNPGM("?Enable EEPROM and init with");
|
||||
SERIAL_PROTOCOLLNPGM("M502, M500, M501 in that order.\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (g29_parameter_parsing()) return; // abort if parsing the simple parameters causes a problem,
|
||||
|
||||
// Check for commands that require the printer to be homed
|
||||
|
@ -1272,8 +1266,8 @@
|
|||
SERIAL_EOL();
|
||||
safe_delay(50);
|
||||
|
||||
SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.get_start_of_meshes()));
|
||||
SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.get_end_of_meshes()));
|
||||
SERIAL_PROTOCOLPAIR("Meshes go from ", hex_address((void*)settings.meshes_start_index()));
|
||||
SERIAL_PROTOCOLLNPAIR(" to ", hex_address((void*)settings.meshes_end_index()));
|
||||
safe_delay(50);
|
||||
|
||||
SERIAL_PROTOCOLLNPAIR("sizeof(ubl) : ", (int)sizeof(ubl));
|
||||
|
@ -1282,7 +1276,7 @@
|
|||
SERIAL_EOL();
|
||||
safe_delay(25);
|
||||
|
||||
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.get_end_of_meshes() - settings.get_start_of_meshes())));
|
||||
SERIAL_PROTOCOLLNPAIR("EEPROM free for UBL: ", hex_address((void*)(settings.meshes_end_index() - settings.meshes_start_index())));
|
||||
safe_delay(50);
|
||||
|
||||
SERIAL_PROTOCOLPAIR("EEPROM can hold ", settings.calc_num_meshes());
|
||||
|
|
|
@ -2309,7 +2309,6 @@ void kill_screen(const char* lcd_msg) {
|
|||
MENU_BACK(MSG_UBL_LEVEL_BED);
|
||||
if (!WITHIN(ubl_storage_slot, 0, a - 1)) {
|
||||
STATIC_ITEM(MSG_NO_STORAGE);
|
||||
STATIC_ITEM(MSG_INIT_EEPROM);
|
||||
}
|
||||
else {
|
||||
MENU_ITEM_EDIT(int3, MSG_UBL_STORAGE_SLOT, &ubl_storage_slot, 0, a - 1);
|
||||
|
|
|
@ -343,10 +343,6 @@ void MarlinSettings::postprocess() {
|
|||
|
||||
bool MarlinSettings::eeprom_error, MarlinSettings::validating;
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
int16_t MarlinSettings::meshes_begin;
|
||||
#endif
|
||||
|
||||
bool MarlinSettings::size_error(const uint16_t size) {
|
||||
if (size != datasize()) {
|
||||
SERIAL_ERROR_START();
|
||||
|
@ -1337,9 +1333,6 @@ void MarlinSettings::postprocess() {
|
|||
}
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
meshes_begin = (eeprom_index + 32) & 0xFFF8; // Pad the end of configuration data so it
|
||||
// can float up or down a little bit without
|
||||
// disrupting the mesh data
|
||||
ubl.report_state();
|
||||
|
||||
if (!validating) {
|
||||
|
@ -1408,12 +1401,13 @@ void MarlinSettings::postprocess() {
|
|||
}
|
||||
#endif
|
||||
|
||||
int16_t MarlinSettings::meshes_start_index() {
|
||||
return (datasize() + EEPROM_OFFSET + 32) & 0xFFF8; // Pad the end of configuration data so it can float up
|
||||
// or down a little bit without disrupting the mesh data
|
||||
}
|
||||
|
||||
uint16_t MarlinSettings::calc_num_meshes() {
|
||||
//obviously this will get more sophisticated once we've added an actual MAT
|
||||
|
||||
if (meshes_begin <= 0) return 0;
|
||||
|
||||
return (meshes_end - meshes_begin) / sizeof(ubl.z_values);
|
||||
return (meshes_end - meshes_start_index()) / sizeof(ubl.z_values);
|
||||
}
|
||||
|
||||
void MarlinSettings::store_mesh(const int8_t slot) {
|
||||
|
|
|
@ -38,13 +38,10 @@ class MarlinSettings {
|
|||
bool success = true;
|
||||
reset();
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
if ((success = save())) {
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
success = load(); // UBL uses load() to know the end of EEPROM
|
||||
#elif ENABLED(EEPROM_CHITCHAT)
|
||||
report();
|
||||
#endif
|
||||
}
|
||||
success = save();
|
||||
#if ENABLED(EEPROM_CHITCHAT)
|
||||
if (success) report();
|
||||
#endif
|
||||
#endif
|
||||
return success;
|
||||
}
|
||||
|
@ -55,8 +52,8 @@ class MarlinSettings {
|
|||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
|
||||
// That can store is enabled
|
||||
FORCE_INLINE static int16_t get_start_of_meshes() { return meshes_begin; }
|
||||
FORCE_INLINE static int16_t get_end_of_meshes() { return meshes_end; }
|
||||
static int16_t meshes_start_index();
|
||||
FORCE_INLINE static int16_t meshes_end_index() { return meshes_end; }
|
||||
static uint16_t calc_num_meshes();
|
||||
static void store_mesh(const int8_t slot);
|
||||
static void load_mesh(const int8_t slot, void * const into=NULL);
|
||||
|
@ -85,7 +82,6 @@ class MarlinSettings {
|
|||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL) // Eventually make these available if any leveling system
|
||||
// That can store is enabled
|
||||
static int16_t meshes_begin;
|
||||
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
|
||||
|
||||
|
|
Loading…
Reference in a new issue