Ver código fonte

Merge pull request #9810 from thinkyhead/bf2_better_M503

[2.0.x] Mesh export in Bilinear + UBL M503
Scott Lahteine 7 anos atrás
pai
commit
1c13cc9b48
Nenhuma conta vinculada ao e-mail do autor do commit

+ 23
- 0
Marlin/src/feature/bedlevel/ubl/ubl.cpp Ver arquivo

@@ -44,6 +44,29 @@
44 44
     SERIAL_PROTOCOLPGM_P(port, "Unified Bed Leveling");
45 45
   }
46 46
 
47
+  void unified_bed_leveling::report_current_mesh(
48
+    #if NUM_SERIAL > 1
49
+      const int8_t port/*= -1*/
50
+    #endif
51
+  ) {
52
+    if (!leveling_is_valid()) return;
53
+    SERIAL_ECHO_START_P(port);
54
+    SERIAL_ECHOLNPGM_P(port, "  G29 I 999");
55
+    for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
56
+      for (uint8_t y = 0;  y < GRID_MAX_POINTS_Y; y++)
57
+        if (!isnan(z_values[x][y])) {
58
+          SERIAL_ECHO_START_P(port);
59
+          SERIAL_ECHOPAIR_P(port, "  M421 I", x);
60
+          SERIAL_ECHOPAIR_P(port, " J", y);
61
+          SERIAL_ECHOPGM_P(port, " Z");
62
+          SERIAL_ECHO_F_P(port, z_values[x][y], 6);
63
+          SERIAL_ECHOPAIR_P(port, " ; X", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
64
+          SERIAL_ECHOPAIR_P(port, ", Y", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
65
+          SERIAL_EOL_P(port);
66
+          safe_delay(75); // Prevent Printrun from exploding
67
+        }
68
+  }
69
+
47 70
   void unified_bed_leveling::report_state(
48 71
     #if NUM_SERIAL > 1
49 72
       const int8_t port/*= -1*/

+ 5
- 0
Marlin/src/feature/bedlevel/ubl/ubl.h Ver arquivo

@@ -107,6 +107,11 @@ class unified_bed_leveling {
107 107
         const int8_t port = -1
108 108
       #endif
109 109
     );
110
+    static void report_current_mesh(
111
+      #if NUM_SERIAL > 1
112
+        const int8_t port = -1
113
+      #endif
114
+    );
110 115
     static void report_state(
111 116
       #if NUM_SERIAL > 1
112 117
         const int8_t port = -1

+ 2
- 15
Marlin/src/feature/bedlevel/ubl/ubl_G29.cpp Ver arquivo

@@ -600,21 +600,8 @@
600 600
     if (parser.seen('S')) {     // Store (or Save) Current Mesh Data
601 601
       g29_storage_slot = parser.has_value() ? parser.value_int() : storage_slot;
602 602
 
603
-      if (g29_storage_slot == -1) {                     // Special case, we are going to 'Export' the mesh to the
604
-        SERIAL_ECHOLNPGM("G29 I 999");              // host in a form it can be reconstructed on a different machine
605
-        for (uint8_t x = 0; x < GRID_MAX_POINTS_X; x++)
606
-          for (uint8_t y = 0;  y < GRID_MAX_POINTS_Y; y++)
607
-            if (!isnan(z_values[x][y])) {
608
-              SERIAL_ECHOPAIR("M421 I ", x);
609
-              SERIAL_ECHOPAIR(" J ", y);
610
-              SERIAL_ECHOPGM(" Z ");
611
-              SERIAL_ECHO_F(z_values[x][y], 6);
612
-              SERIAL_ECHOPAIR(" ; X ", LOGICAL_X_POSITION(mesh_index_to_xpos(x)));
613
-              SERIAL_ECHOPAIR(", Y ", LOGICAL_Y_POSITION(mesh_index_to_ypos(y)));
614
-              SERIAL_EOL();
615
-            }
616
-        return;
617
-      }
603
+      if (g29_storage_slot == -1)                     // Special case, we are going to 'Export' the mesh to the
604
+        return report_current_mesh();
618 605
 
619 606
       int16_t a = settings.calc_num_meshes();
620 607
 

+ 31
- 8
Marlin/src/module/configuration_store.cpp Ver arquivo

@@ -2098,14 +2098,16 @@ void MarlinSettings::reset(
2098 2098
 
2099 2099
       #if ENABLED(MESH_BED_LEVELING)
2100 2100
 
2101
-        for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2102
-          for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2103
-            CONFIG_ECHO_START;
2104
-            SERIAL_ECHOPAIR_P(port, "  G29 S3 X", (int)px + 1);
2105
-            SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
2106
-            SERIAL_ECHOPGM_P(port, " Z");
2107
-            SERIAL_PROTOCOL_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5);
2108
-            SERIAL_EOL_P(port);
2101
+        if (leveling_is_valid()) {
2102
+          for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2103
+            for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2104
+              CONFIG_ECHO_START;
2105
+              SERIAL_ECHOPAIR_P(port, "  G29 S3 X", (int)px + 1);
2106
+              SERIAL_ECHOPAIR_P(port, " Y", (int)py + 1);
2107
+              SERIAL_ECHOPGM_P(port, " Z");
2108
+              SERIAL_PROTOCOL_F_P(port, LINEAR_UNIT(mbl.z_values[px][py]), 5);
2109
+              SERIAL_EOL_P(port);
2110
+            }
2109 2111
           }
2110 2112
         }
2111 2113
 
@@ -2119,6 +2121,27 @@ void MarlinSettings::reset(
2119 2121
           SERIAL_ECHOLNPGM_P(port, " meshes.\n");
2120 2122
         }
2121 2123
 
2124
+        ubl.report_current_mesh(
2125
+          #if ADD_PORT_ARG
2126
+            port
2127
+          #endif
2128
+        );
2129
+
2130
+      #elif ENABLED(AUTO_BED_LEVELING_BILINEAR)
2131
+
2132
+        if (leveling_is_valid()) {
2133
+          for (uint8_t py = 0; py < GRID_MAX_POINTS_Y; py++) {
2134
+            for (uint8_t px = 0; px < GRID_MAX_POINTS_X; px++) {
2135
+              CONFIG_ECHO_START;
2136
+              SERIAL_ECHOPAIR_P(port, "  G29 W I", (int)px + 1);
2137
+              SERIAL_ECHOPAIR_P(port, " J", (int)py + 1);
2138
+              SERIAL_ECHOPGM_P(port, " Z");
2139
+              SERIAL_PROTOCOL_F_P(port, LINEAR_UNIT(z_values[px][py]), 5);
2140
+              SERIAL_EOL_P(port);
2141
+            }
2142
+          }
2143
+        }
2144
+
2122 2145
       #endif
2123 2146
 
2124 2147
     #endif // HAS_LEVELING

Carregando…
Cancelar
Salvar