소스 검색

Fix M421 AUTO_BED_LEVELING_BILINEAR and AUTO_BED_LEVELING_UBL

M421 was not connected up for AUTO_BED_LEVELING_BILINEAR.
M421 needed to migrate mesh data to new UBL EEPROM layout.
Roxy-3D 7 년 전
부모
커밋
0423e93c42
2개의 변경된 파일36개의 추가작업 그리고 5개의 파일을 삭제
  1. 30
    4
      Marlin/Marlin_main.cpp
  2. 6
    1
      Marlin/UBL_G29.cpp

+ 30
- 4
Marlin/Marlin_main.cpp 파일 보기

@@ -178,7 +178,7 @@
178 178
  * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
179 179
  * M410 - Quickstop. Abort all planned moves.
180 180
  * M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
181
- * M421 - Set a single Z coordinate in the Mesh Leveling grid. X<units> Y<units> Z<units> (Requires MESH_BED_LEVELING)
181
+ * M421 - Set a single Z coordinate in the Mesh Leveling grid. X<units> Y<units> Z<units> (Requires MESH_BED_LEVELING or AUTO_BED_LEVELING_UBL)
182 182
  * M428 - Set the home_offset based on the current_position. Nearest edge applies.
183 183
  * M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS)
184 184
  * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
@@ -7557,8 +7557,7 @@ void quickstop_stepper() {
7557 7557
   }
7558 7558
 #endif
7559 7559
 
7560
-#if ENABLED(MESH_BED_LEVELING)
7561
-
7560
+#if ENABLED(MESH_BED_LEVELING) 
7562 7561
   /**
7563 7562
    * M421: Set a single Mesh Bed Leveling Z coordinate
7564 7563
    * Use either 'M421 X<linear> Y<linear> Z<linear>' or 'M421 I<xindex> J<yindex> Z<linear>'
@@ -7628,7 +7627,34 @@ void quickstop_stepper() {
7628 7627
       SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
7629 7628
     }
7630 7629
   }
7630
+#elif ENABLED(AUTO_BED_LEVELING_UBL)
7631
+  /**
7632
+   * M421: Set a single Mesh Bed Leveling Z coordinate
7633
+   *
7634
+   *   M421 I<xindex> J<yindex> Z<linear>
7635
+   */
7636
+  inline void gcode_M421() {
7637
+    int8_t px = 0, py = 0;
7638
+    float z = 0;
7639
+    bool hasI, hasJ, hasZ;
7640
+    if ((hasI = code_seen('I'))) px = code_value_axis_units(X_AXIS);
7641
+    if ((hasJ = code_seen('J'))) py = code_value_axis_units(Y_AXIS);
7642
+    if ((hasZ = code_seen('Z'))) z = code_value_axis_units(Z_AXIS);
7631 7643
 
7644
+    if (hasI && hasJ && hasZ) {
7645
+      if (WITHIN(px, 0, UBL_MESH_NUM_Y_POINTS - 1) && WITHIN(py, 0, UBL_MESH_NUM_Y_POINTS - 1)) {
7646
+        ubl.z_values[px][py] = z;
7647
+      }
7648
+      else {
7649
+        SERIAL_ERROR_START;
7650
+        SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
7651
+      }
7652
+    }
7653
+    else {
7654
+      SERIAL_ERROR_START;
7655
+      SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
7656
+    }
7657
+  }
7632 7658
 #endif
7633 7659
 
7634 7660
 #if DISABLED(NO_WORKSPACE_OFFSETS)
@@ -9387,7 +9413,7 @@ void process_next_command() {
9387 9413
           break;
9388 9414
       #endif
9389 9415
 
9390
-      #if ENABLED(MESH_BED_LEVELING)
9416
+      #if ENABLED(MESH_BED_LEVELING) || ENABLED(AUTO_BED_LEVELING_UBL) || ENABLED(AUTO_BED_LEVELING_BILINEAR)
9391 9417
         case 421: // M421: Set a Mesh Bed Leveling Z coordinate
9392 9418
           gcode_M421();
9393 9419
           break;

+ 6
- 1
Marlin/UBL_G29.cpp 파일 보기

@@ -327,8 +327,13 @@
327 327
     // Invalidate Mesh Points. This command is a little bit asymetrical because
328 328
     // it directly specifies the repetition count and does not use the 'R' parameter.
329 329
     if (code_seen('I')) {
330
+      int cnt = 0;
330 331
       repetition_cnt = code_has_value() ? code_value_int() : 1;
331 332
       while (repetition_cnt--) {
333
+        if (cnt>20) {
334
+          cnt = 0;
335
+          idle();
336
+        }
332 337
         const mesh_index_pair location = find_closest_mesh_point_of_type(REAL, x_pos, y_pos, 0, NULL, false);  // The '0' says we want to use the nozzle's position
333 338
         if (location.x_index < 0) {
334 339
           SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
@@ -1433,4 +1438,4 @@
1433 1438
     SERIAL_ECHOLNPGM("Done Editing Mesh");
1434 1439
   }
1435 1440
 
1436
-#endif // AUTO_BED_LEVELING_UBL
1441
+#endif // AUTO_BED_LEVELING_UBL

Loading…
취소
저장