MBL: Added keeping MBL active when homing single axises for #3750

This commit is contained in:
Edward Patel
2016-05-24 22:53:15 +02:00
committed by Scott Lahteine
parent 32f8300cc6
commit c06de0f097
6 changed files with 81 additions and 35 deletions

View File

@@ -58,7 +58,7 @@
* 188 M206 XYZ home_offset (float x3)
*
* Mesh bed leveling:
* 200 M420 S active (bool)
* 200 M420 S status (0 = empty, 1 = has mesh numbers)
* 201 z_offset (float) (added in V23)
* 205 mesh_num_x (uint8 as set in firmware)
* 206 mesh_num_y (uint8 as set in firmware)
@@ -187,6 +187,7 @@ void Config_StoreSettings() {
EEPROM_WRITE_VAR(i, planner.max_e_jerk);
EEPROM_WRITE_VAR(i, home_offset);
uint8_t dummy_uint8 = 0;
uint8_t mesh_num_x = 3;
uint8_t mesh_num_y = 3;
#if ENABLED(MESH_BED_LEVELING)
@@ -194,13 +195,13 @@ void Config_StoreSettings() {
typedef char c_assert[(sizeof(mbl.z_values) == (MESH_NUM_X_POINTS) * (MESH_NUM_Y_POINTS) * sizeof(dummy)) ? 1 : -1];
mesh_num_x = MESH_NUM_X_POINTS;
mesh_num_y = MESH_NUM_Y_POINTS;
EEPROM_WRITE_VAR(i, mbl.active);
dummy_uint8 = mbl.status & 0x01; // Do not save 'is active'
EEPROM_WRITE_VAR(i, dummy_uint8);
EEPROM_WRITE_VAR(i, mbl.z_offset);
EEPROM_WRITE_VAR(i, mesh_num_x);
EEPROM_WRITE_VAR(i, mesh_num_y);
EEPROM_WRITE_VAR(i, mbl.z_values);
#else
uint8_t dummy_uint8 = 0;
dummy = 0.0f;
EEPROM_WRITE_VAR(i, dummy_uint8);
EEPROM_WRITE_VAR(i, dummy);
@@ -376,7 +377,7 @@ void Config_RetrieveSettings() {
EEPROM_READ_VAR(i, mesh_num_x);
EEPROM_READ_VAR(i, mesh_num_y);
#if ENABLED(MESH_BED_LEVELING)
mbl.active = dummy_uint8;
mbl.status = dummy_uint8;
mbl.z_offset = dummy;
if (mesh_num_x == MESH_NUM_X_POINTS && mesh_num_y == MESH_NUM_Y_POINTS) {
EEPROM_READ_VAR(i, mbl.z_values);
@@ -550,7 +551,7 @@ void Config_ResetDefault() {
home_offset[X_AXIS] = home_offset[Y_AXIS] = home_offset[Z_AXIS] = 0;
#if ENABLED(MESH_BED_LEVELING)
mbl.active = false;
mbl.reset();
#endif
#if ENABLED(AUTO_BED_LEVELING_FEATURE)
@@ -729,7 +730,7 @@ void Config_PrintSettings(bool forReplay) {
SERIAL_ECHOLNPGM("Mesh bed leveling:");
CONFIG_ECHO_START;
}
SERIAL_ECHOPAIR(" M420 S", mbl.active);
SERIAL_ECHOPAIR(" M420 S", mbl.has_mesh() ? 1 : 0);
SERIAL_ECHOPAIR(" X", MESH_NUM_X_POINTS);
SERIAL_ECHOPAIR(" Y", MESH_NUM_Y_POINTS);
SERIAL_EOL;