Merge upstream changes from Marlin 2.1.1
This commit is contained in:
@@ -67,14 +67,17 @@ void GcodeSuite::M420() {
|
||||
const float x_min = probe.min_x(), x_max = probe.max_x(),
|
||||
y_min = probe.min_y(), y_max = probe.max_y();
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
bilinear_start.set(x_min, y_min);
|
||||
bilinear_grid_spacing.set((x_max - x_min) / (GRID_MAX_CELLS_X),
|
||||
(y_max - y_min) / (GRID_MAX_CELLS_Y));
|
||||
xy_pos_t start, spacing;
|
||||
start.set(x_min, y_min);
|
||||
spacing.set((x_max - x_min) / (GRID_MAX_CELLS_X),
|
||||
(y_max - y_min) / (GRID_MAX_CELLS_Y));
|
||||
bedlevel.set_grid(spacing, start);
|
||||
#endif
|
||||
GRID_LOOP(x, y) {
|
||||
Z_VALUES(x, y) = 0.001 * random(-200, 200);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)));
|
||||
bedlevel.z_values[x][y] = 0.001 * random(-200, 200);
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, bedlevel.z_values[x][y]));
|
||||
}
|
||||
TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level());
|
||||
SERIAL_ECHOPGM("Simulated " STRINGIFY(GRID_MAX_POINTS_X) "x" STRINGIFY(GRID_MAX_POINTS_Y) " mesh ");
|
||||
SERIAL_ECHOPGM(" (", x_min);
|
||||
SERIAL_CHAR(','); SERIAL_ECHO(y_min);
|
||||
@@ -98,7 +101,7 @@ void GcodeSuite::M420() {
|
||||
set_bed_leveling_enabled(false);
|
||||
|
||||
#if ENABLED(EEPROM_SETTINGS)
|
||||
const int8_t storage_slot = parser.has_value() ? parser.value_int() : ubl.storage_slot;
|
||||
const int8_t storage_slot = parser.has_value() ? parser.value_int() : bedlevel.storage_slot;
|
||||
const int16_t a = settings.calc_num_meshes();
|
||||
|
||||
if (!a) {
|
||||
@@ -113,7 +116,7 @@ void GcodeSuite::M420() {
|
||||
}
|
||||
|
||||
settings.load_mesh(storage_slot);
|
||||
ubl.storage_slot = storage_slot;
|
||||
bedlevel.storage_slot = storage_slot;
|
||||
|
||||
#else
|
||||
|
||||
@@ -125,10 +128,10 @@ void GcodeSuite::M420() {
|
||||
|
||||
// L or V display the map info
|
||||
if (parser.seen("LV")) {
|
||||
ubl.display_map(parser.byteval('T'));
|
||||
bedlevel.display_map(parser.byteval('T'));
|
||||
SERIAL_ECHOPGM("Mesh is ");
|
||||
if (!ubl.mesh_is_valid()) SERIAL_ECHOPGM("in");
|
||||
SERIAL_ECHOLNPGM("valid\nStorage slot: ", ubl.storage_slot);
|
||||
if (!bedlevel.mesh_is_valid()) SERIAL_ECHOPGM("in");
|
||||
SERIAL_ECHOLNPGM("valid\nStorage slot: ", bedlevel.storage_slot);
|
||||
}
|
||||
|
||||
#endif // AUTO_BED_LEVELING_UBL
|
||||
@@ -145,7 +148,7 @@ void GcodeSuite::M420() {
|
||||
#if ENABLED(AUTO_BED_LEVELING_UBL)
|
||||
|
||||
set_bed_leveling_enabled(false);
|
||||
ubl.adjust_mesh_to_mean(true, cval);
|
||||
bedlevel.adjust_mesh_to_mean(true, cval);
|
||||
|
||||
#else
|
||||
|
||||
@@ -153,7 +156,7 @@ void GcodeSuite::M420() {
|
||||
|
||||
// Get the sum and average of all mesh values
|
||||
float mesh_sum = 0;
|
||||
GRID_LOOP(x, y) mesh_sum += Z_VALUES(x, y);
|
||||
GRID_LOOP(x, y) mesh_sum += bedlevel.z_values[x][y];
|
||||
const float zmean = mesh_sum / float(GRID_MAX_POINTS);
|
||||
|
||||
#else // midrange
|
||||
@@ -161,7 +164,7 @@ void GcodeSuite::M420() {
|
||||
// Find the low and high mesh values.
|
||||
float lo_val = 100, hi_val = -100;
|
||||
GRID_LOOP(x, y) {
|
||||
const float z = Z_VALUES(x, y);
|
||||
const float z = bedlevel.z_values[x][y];
|
||||
NOMORE(lo_val, z);
|
||||
NOLESS(hi_val, z);
|
||||
}
|
||||
@@ -175,10 +178,10 @@ void GcodeSuite::M420() {
|
||||
set_bed_leveling_enabled(false);
|
||||
// Subtract the mean from all values
|
||||
GRID_LOOP(x, y) {
|
||||
Z_VALUES(x, y) -= zmean;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, Z_VALUES(x, y)));
|
||||
bedlevel.z_values[x][y] -= zmean;
|
||||
TERN_(EXTENSIBLE_UI, ExtUI::onMeshUpdate(x, y, bedlevel.z_values[x][y]));
|
||||
}
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, bed_level_virt_interpolate());
|
||||
TERN_(AUTO_BED_LEVELING_BILINEAR, bedlevel.refresh_bed_level());
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -195,15 +198,14 @@ void GcodeSuite::M420() {
|
||||
// V to print the matrix or mesh
|
||||
if (seenV) {
|
||||
#if ABL_PLANAR
|
||||
planner.bed_level_matrix.debug(PSTR("Bed Level Correction Matrix:"));
|
||||
planner.bed_level_matrix.debug(F("Bed Level Correction Matrix:"));
|
||||
#else
|
||||
if (leveling_is_valid()) {
|
||||
#if ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||
print_bilinear_leveling_grid();
|
||||
TERN_(ABL_BILINEAR_SUBDIVISION, print_bilinear_leveling_grid_virt());
|
||||
bedlevel.print_leveling_grid();
|
||||
#elif ENABLED(MESH_BED_LEVELING)
|
||||
SERIAL_ECHOLNPGM("Mesh Bed Level data:");
|
||||
mbl.report_mesh();
|
||||
bedlevel.report_mesh();
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
@@ -243,15 +245,15 @@ void GcodeSuite::M420() {
|
||||
}
|
||||
|
||||
void GcodeSuite::M420_report(const bool forReplay/*=true*/) {
|
||||
report_heading_etc(forReplay, PSTR(
|
||||
report_heading_etc(forReplay, F(
|
||||
TERN(MESH_BED_LEVELING, "Mesh Bed Leveling", TERN(AUTO_BED_LEVELING_UBL, "Unified Bed Leveling", "Auto Bed Leveling"))
|
||||
));
|
||||
SERIAL_ECHOPGM_P(
|
||||
PSTR(" M420 S"), planner.leveling_active
|
||||
SERIAL_ECHOF(
|
||||
F(" M420 S"), planner.leveling_active
|
||||
#if ENABLED(ENABLE_LEVELING_FADE_HEIGHT)
|
||||
, SP_Z_STR, LINEAR_UNIT(planner.z_fade_height)
|
||||
, FPSTR(SP_Z_STR), LINEAR_UNIT(planner.z_fade_height)
|
||||
#endif
|
||||
, PSTR(" ; Leveling ")
|
||||
, F(" ; Leveling ")
|
||||
);
|
||||
serialprintln_onoff(planner.leveling_active);
|
||||
}
|
||||
|
Reference in New Issue
Block a user