Move fade_scaling_factor_for_z to Planner
This commit is contained in:
@@ -68,7 +68,7 @@
|
||||
* 219 z_fade_height (float)
|
||||
*
|
||||
* MESH_BED_LEVELING: 43 bytes
|
||||
* 223 M420 S from mbl.status (bool)
|
||||
* 223 M420 S planner.leveling_active (bool)
|
||||
* 224 mbl.z_offset (float)
|
||||
* 228 GRID_MAX_POINTS_X (uint8_t)
|
||||
* 229 GRID_MAX_POINTS_Y (uint8_t)
|
||||
@@ -88,7 +88,7 @@
|
||||
* 316 z_values[][] (float x9, up to float x256) +988
|
||||
*
|
||||
* AUTO_BED_LEVELING_UBL: 6 bytes
|
||||
* 324 G29 A ubl.state.active (bool)
|
||||
* 324 G29 A planner.leveling_active (bool)
|
||||
* 325 G29 S ubl.state.storage_slot (int8_t)
|
||||
*
|
||||
* DELTA: 48 bytes
|
||||
@@ -204,6 +204,10 @@ MarlinSettings settings;
|
||||
extern void refresh_bed_level();
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
float new_z_fade_height;
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Post-process after Retrieve or Reset
|
||||
*/
|
||||
@@ -233,7 +237,7 @@ void MarlinSettings::postprocess() {
|
||||
#endif
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
set_z_fade_height(planner.z_fade_height);
|
||||
set_z_fade_height(new_z_fade_height);
|
||||
#endif
|
||||
|
||||
#if HAS_BED_PROBE
|
||||
@@ -372,7 +376,7 @@ void MarlinSettings::postprocess() {
|
||||
sizeof(mbl.z_values) == GRID_MAX_POINTS * sizeof(mbl.z_values[0][0]),
|
||||
"MBL Z array is the wrong size."
|
||||
);
|
||||
const bool leveling_is_on = TEST(mbl.status, MBL_STATUS_HAS_MESH_BIT);
|
||||
const bool leveling_is_on = mbl.has_mesh;
|
||||
const uint8_t mesh_num_x = GRID_MAX_POINTS_X, mesh_num_y = GRID_MAX_POINTS_Y;
|
||||
EEPROM_WRITE(leveling_is_on);
|
||||
EEPROM_WRITE(mbl.z_offset);
|
||||
@@ -435,7 +439,7 @@ void MarlinSettings::postprocess() {
|
||||
#endif // AUTO_BED_LEVELING_BILINEAR
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
EEPROM_WRITE(ubl.state.active);
|
||||
EEPROM_WRITE(planner.leveling_active);
|
||||
EEPROM_WRITE(ubl.state.storage_slot);
|
||||
#else
|
||||
const bool ubl_active = false;
|
||||
@@ -751,7 +755,7 @@ void MarlinSettings::postprocess() {
|
||||
//
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
EEPROM_READ(planner.z_fade_height);
|
||||
EEPROM_READ(new_z_fade_height);
|
||||
#else
|
||||
EEPROM_READ(dummy);
|
||||
#endif
|
||||
@@ -768,7 +772,7 @@ void MarlinSettings::postprocess() {
|
||||
EEPROM_READ(mesh_num_y);
|
||||
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
mbl.status = leveling_is_on ? _BV(MBL_STATUS_HAS_MESH_BIT) : 0;
|
||||
mbl.has_mesh = leveling_is_on;
|
||||
mbl.z_offset = dummy;
|
||||
if (mesh_num_x == GRID_MAX_POINTS_X && mesh_num_y == GRID_MAX_POINTS_Y) {
|
||||
// EEPROM data fits the current mesh
|
||||
@@ -824,7 +828,7 @@ void MarlinSettings::postprocess() {
|
||||
}
|
||||
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
EEPROM_READ(ubl.state.active);
|
||||
EEPROM_READ(planner.leveling_active);
|
||||
EEPROM_READ(ubl.state.storage_slot);
|
||||
#else
|
||||
uint8_t dummyui8;
|
||||
@@ -1186,7 +1190,7 @@ void MarlinSettings::reset() {
|
||||
planner.max_jerk[E_AXIS] = DEFAULT_EJERK;
|
||||
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
planner.z_fade_height = 0.0;
|
||||
new_z_fade_height = 10.0;
|
||||
#endif
|
||||
|
||||
#if HAS_HOME_OFFSET
|
||||
@@ -1563,65 +1567,71 @@ void MarlinSettings::reset() {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
/**
|
||||
* Bed Leveling
|
||||
*/
|
||||
#if HAS_LEVELING
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Mesh Bed Leveling:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M420 S", leveling_is_valid() ? 1 : 0);
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.z_fade_height));
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
|
||||
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" G29 S3 X", (int)px + 1);
|
||||
SERIAL_ECHOPAIR(" Y", (int)py + 1);
|
||||
SERIAL_ECHOPGM(" Z");
|
||||
SERIAL_PROTOCOL_F(LINEAR_UNIT(mbl.z_values[px][py]), 5);
|
||||
SERIAL_EOL();
|
||||
SERIAL_ECHOLNPGM("Mesh Bed Leveling:");
|
||||
}
|
||||
}
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
ubl.echo_name();
|
||||
SERIAL_ECHOLNPGM(":");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M420 S", LEVELING_IS_ACTIVE() ? 1 : 0);
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
SERIAL_ECHOPAIR(" Z", planner.z_fade_height);
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
ubl.echo_name();
|
||||
SERIAL_ECHOLNPGM(":");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
|
||||
#elif HAS_ABL
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Auto Bed Leveling:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
|
||||
if (!forReplay) {
|
||||
SERIAL_EOL();
|
||||
ubl.report_state();
|
||||
SERIAL_ECHOLNPAIR("\nActive Mesh Slot: ", ubl.state.storage_slot);
|
||||
SERIAL_ECHOPAIR("EEPROM can hold ", calc_num_meshes());
|
||||
SERIAL_ECHOLNPGM(" meshes.\n");
|
||||
}
|
||||
|
||||
#elif HAS_ABL
|
||||
|
||||
if (!forReplay) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOLNPGM("Auto Bed Leveling:");
|
||||
}
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" M420 S", LEVELING_IS_ACTIVE() ? 1 : 0);
|
||||
SERIAL_ECHOPAIR(" M420 S", planner.leveling_active ? 1 : 0);
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
SERIAL_ECHOPAIR(" Z", LINEAR_UNIT(planner.z_fade_height));
|
||||
#endif
|
||||
SERIAL_EOL();
|
||||
|
||||
#endif
|
||||
#if ENABLED(MESH_BED_LEVELING)
|
||||
|
||||
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
|
||||
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
|
||||
CONFIG_ECHO_START;
|
||||
SERIAL_ECHOPAIR(" G29 S3 X", (int)px + 1);
|
||||
SERIAL_ECHOPAIR(" Y", (int)py + 1);
|
||||
SERIAL_ECHOPGM(" Z");
|
||||
SERIAL_PROTOCOL_F(LINEAR_UNIT(mbl.z_values[px][py]), 5);
|
||||
SERIAL_EOL();
|
||||
}
|
||||
}
|
||||
|
||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
||||
if (!forReplay) {
|
||||
SERIAL_EOL();
|
||||
ubl.report_state();
|
||||
SERIAL_ECHOLNPAIR("\nActive Mesh Slot: ", ubl.state.storage_slot);
|
||||
SERIAL_ECHOPAIR("EEPROM can hold ", calc_num_meshes());
|
||||
SERIAL_ECHOLNPGM(" meshes.\n");
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif // HAS_LEVELING
|
||||
|
||||
#if ENABLED(DELTA)
|
||||
if (!forReplay) {
|
||||
@@ -1757,7 +1767,7 @@ void MarlinSettings::reset() {
|
||||
#endif // FWRETRACT
|
||||
|
||||
/**
|
||||
* Auto Bed Leveling
|
||||
* Probe Offset
|
||||
*/
|
||||
#if HAS_BED_PROBE
|
||||
if (!forReplay) {
|
||||
|
||||
Reference in New Issue
Block a user