mirror of
https://github.com/MarlinFirmware/Marlin.git
synced 2025-01-18 23:49:49 +00:00
Mesh export in Bilinear + UBL M503 (#9818)
This commit is contained in:
parent
97a35dd534
commit
9d7a1ae9f5
4 changed files with 48 additions and 24 deletions
|
@ -2061,6 +2061,7 @@ void MarlinSettings::reset() {
|
||||||
|
|
||||||
#if ENABLED(MESH_BED_LEVELING)
|
#if ENABLED(MESH_BED_LEVELING)
|
||||||
|
|
||||||
|
if (leveling_is_valid()) {
|
||||||
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
|
for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
|
||||||
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
|
for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
|
||||||
CONFIG_ECHO_START;
|
CONFIG_ECHO_START;
|
||||||
|
@ -2071,6 +2072,7 @@ void MarlinSettings::reset() {
|
||||||
SERIAL_EOL();
|
SERIAL_EOL();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
#elif ENABLED(AUTO_BED_LEVELING_UBL)
|
||||||
|
|
||||||
|
@ -2082,6 +2084,23 @@ void MarlinSettings::reset() {
|
||||||
SERIAL_ECHOLNPGM(" meshes.\n");
|
SERIAL_ECHOLNPGM(" meshes.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubl.report_current_mesh();
|
||||||
|
|
||||||
|
#elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
|
||||||
|
|
||||||
|
if (leveling_is_valid()) {
|
||||||
|
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 W I", (int)px + 1);
|
||||||
|
SERIAL_ECHOPAIR(" J", (int)py + 1);
|
||||||
|
SERIAL_ECHOPGM(" Z");
|
||||||
|
SERIAL_PROTOCOL_F(LINEAR_UNIT(z_values[px][py]), 5);
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif // HAS_LEVELING
|
#endif // HAS_LEVELING
|
||||||
|
|
|
@ -37,6 +37,24 @@
|
||||||
|
|
||||||
void unified_bed_leveling::echo_name() { SERIAL_PROTOCOLPGM("Unified Bed Leveling"); }
|
void unified_bed_leveling::echo_name() { SERIAL_PROTOCOLPGM("Unified Bed Leveling"); }
|
||||||
|
|
||||||
|
void unified_bed_leveling::report_current_mesh() {
|
||||||
|
if (!leveling_is_valid()) return;
|
||||||
|
SERIAL_ECHO_START();
|
||||||
|
SERIAL_ECHOLNPGM(" G29 I 999");
|
||||||
|
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
|
||||||
|
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
|
||||||
|
if (!isnan(z_values[x][y])) {
|
||||||
|
SERIAL_ECHO_START();
|
||||||
|
SERIAL_ECHOPAIR(" M421 I ", x);
|
||||||
|
SERIAL_ECHOPAIR(" J ", y);
|
||||||
|
SERIAL_ECHOPGM(" Z ");
|
||||||
|
SERIAL_ECHO_F(z_values[x][y], 6);
|
||||||
|
SERIAL_ECHOPAIR(" ; X ", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
|
||||||
|
SERIAL_ECHOPAIR(", Y ", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
|
||||||
|
SERIAL_EOL();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void unified_bed_leveling::report_state() {
|
void unified_bed_leveling::report_state() {
|
||||||
echo_name();
|
echo_name();
|
||||||
SERIAL_PROTOCOLPGM(" System v" UBL_VERSION " ");
|
SERIAL_PROTOCOLPGM(" System v" UBL_VERSION " ");
|
||||||
|
|
|
@ -109,6 +109,7 @@ class unified_bed_leveling {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
static void echo_name();
|
static void echo_name();
|
||||||
|
static void report_current_mesh();
|
||||||
static void report_state();
|
static void report_state();
|
||||||
static void save_ubl_active_state_and_disable();
|
static void save_ubl_active_state_and_disable();
|
||||||
static void restore_ubl_active_state_and_leave();
|
static void restore_ubl_active_state_and_leave();
|
||||||
|
|
|
@ -596,21 +596,8 @@
|
||||||
if (parser.seen('S')) { // Store (or Save) Current Mesh Data
|
if (parser.seen('S')) { // Store (or Save) Current Mesh Data
|
||||||
g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
|
g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
|
||||||
|
|
||||||
if (g29_storage_slot == -1) { // Special case, we are going to 'Export' the mesh to the
|
if (g29_storage_slot == -1) // Special case, we are going to 'Export' the mesh to the
|
||||||
SERIAL_ECHOLNPGM("G29 I 999"); // host in a form it can be reconstructed on a different machine
|
return report_current_mesh();
|
||||||
for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
|
|
||||||
for (uint8_t y = 0; y < GRID_MAX_POINTS_Y; y++)
|
|
||||||
if (!isnan(z_values[x][y])) {
|
|
||||||
SERIAL_ECHOPAIR("M421 I ", x);
|
|
||||||
SERIAL_ECHOPAIR(" J ", y);
|
|
||||||
SERIAL_ECHOPGM(" Z ");
|
|
||||||
SERIAL_ECHO_F(z_values[x][y], 6);
|
|
||||||
SERIAL_ECHOPAIR(" ; X ", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
|
|
||||||
SERIAL_ECHOPAIR(", Y ", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
|
|
||||||
SERIAL_EOL();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
int16_t a = settings.calc_num_meshes();
|
int16_t a = settings.calc_num_meshes();
|
||||||
|
|
||||||
|
@ -764,7 +751,6 @@
|
||||||
z_values[location.x_index][location.y_index] = measured_z;
|
z_values[location.x_index][location.y_index] = measured_z;
|
||||||
}
|
}
|
||||||
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
SERIAL_FLUSH(); // Prevent host M105 buffer overrun.
|
||||||
|
|
||||||
} while (location.x_index >= 0 && --max_iterations);
|
} while (location.x_index >= 0 && --max_iterations);
|
||||||
|
|
||||||
STOW_PROBE();
|
STOW_PROBE();
|
||||||
|
|
Loading…
Reference in a new issue