ソースを参照

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 8年前
コミット
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
  * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
178
  * M407 - Display measured filament diameter in millimeters. (Requires FILAMENT_WIDTH_SENSOR)
179
  * M410 - Quickstop. Abort all planned moves.
179
  * M410 - Quickstop. Abort all planned moves.
180
  * M420 - Enable/Disable Leveling (with current values) S1=enable S0=disable (Requires MESH_BED_LEVELING or ABL)
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
  * M428 - Set the home_offset based on the current_position. Nearest edge applies.
182
  * M428 - Set the home_offset based on the current_position. Nearest edge applies.
183
  * M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS)
183
  * M500 - Store parameters in EEPROM. (Requires EEPROM_SETTINGS)
184
  * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
184
  * M501 - Restore parameters from EEPROM. (Requires EEPROM_SETTINGS)
7557
   }
7557
   }
7558
 #endif
7558
 #endif
7559
 
7559
 
7560
-#if ENABLED(MESH_BED_LEVELING)
7561
-
7560
+#if ENABLED(MESH_BED_LEVELING) 
7562
   /**
7561
   /**
7563
    * M421: Set a single Mesh Bed Leveling Z coordinate
7562
    * M421: Set a single Mesh Bed Leveling Z coordinate
7564
    * Use either 'M421 X<linear> Y<linear> Z<linear>' or 'M421 I<xindex> J<yindex> Z<linear>'
7563
    * Use either 'M421 X<linear> Y<linear> Z<linear>' or 'M421 I<xindex> J<yindex> Z<linear>'
7628
       SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
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
 #endif
7658
 #endif
7633
 
7659
 
7634
 #if DISABLED(NO_WORKSPACE_OFFSETS)
7660
 #if DISABLED(NO_WORKSPACE_OFFSETS)
9387
           break;
9413
           break;
9388
       #endif
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
         case 421: // M421: Set a Mesh Bed Leveling Z coordinate
9417
         case 421: // M421: Set a Mesh Bed Leveling Z coordinate
9392
           gcode_M421();
9418
           gcode_M421();
9393
           break;
9419
           break;

+ 6
- 1
Marlin/UBL_G29.cpp ファイルの表示

327
     // Invalidate Mesh Points. This command is a little bit asymetrical because
327
     // Invalidate Mesh Points. This command is a little bit asymetrical because
328
     // it directly specifies the repetition count and does not use the 'R' parameter.
328
     // it directly specifies the repetition count and does not use the 'R' parameter.
329
     if (code_seen('I')) {
329
     if (code_seen('I')) {
330
+      int cnt = 0;
330
       repetition_cnt = code_has_value() ? code_value_int() : 1;
331
       repetition_cnt = code_has_value() ? code_value_int() : 1;
331
       while (repetition_cnt--) {
332
       while (repetition_cnt--) {
333
+        if (cnt>20) {
334
+          cnt = 0;
335
+          idle();
336
+        }
332
         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
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
         if (location.x_index < 0) {
338
         if (location.x_index < 0) {
334
           SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
339
           SERIAL_PROTOCOLLNPGM("Entire Mesh invalidated.\n");
1433
     SERIAL_ECHOLNPGM("Done Editing Mesh");
1438
     SERIAL_ECHOLNPGM("Done Editing Mesh");
1434
   }
1439
   }
1435
 
1440
 
1436
-#endif // AUTO_BED_LEVELING_UBL
1441
+#endif // AUTO_BED_LEVELING_UBL

読み込み中…
キャンセル
保存