Kaynağa Gözat

Extend M421 with I and J parameters

Extend M421 with I and J parameters
AnHardt 8 yıl önce
ebeveyn
işleme
f5a036510f
2 değiştirilmiş dosya ile 17 ekleme ve 4 silme
  1. 15
    2
      Marlin/Marlin_main.cpp
  2. 2
    2
      Marlin/language.h

+ 15
- 2
Marlin/Marlin_main.cpp Dosyayı Görüntüle

@@ -5899,12 +5899,16 @@ inline void gcode_M410() { stepper.quick_stop(); }
5899 5899
 
5900 5900
   /**
5901 5901
    * M421: Set a single Mesh Bed Leveling Z coordinate
5902
+   * Use either 'M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>'
5902 5903
    */
5903 5904
   inline void gcode_M421() {
5904 5905
     float x = 0, y = 0, z = 0;
5905
-    bool err = false, hasX, hasY, hasZ;
5906
+    int8_t i = 0, j = 0;
5907
+    bool err = false, hasX, hasY, hasZ, hasI, hasJ;
5906 5908
     if ((hasX = code_seen('X'))) x = code_value();
5907 5909
     if ((hasY = code_seen('Y'))) y = code_value();
5910
+    if ((hasI = code_seen('I'))) i = code_value();
5911
+    if ((hasJ = code_seen('J'))) j = code_value();
5908 5912
     if ((hasZ = code_seen('Z'))) z = code_value();
5909 5913
 
5910 5914
     if (hasX && hasY && hasZ) {
@@ -5919,7 +5923,16 @@ inline void gcode_M410() { stepper.quick_stop(); }
5919 5923
         SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
5920 5924
       }
5921 5925
     }
5922
-    else {
5926
+    else if (hasI && hasJ && hasZ) {
5927
+      if (i >= 0 && i < MESH_NUM_X_POINTS && j >= 0 && j < MESH_NUM_Y_POINTS)
5928
+        mbl.set_z(i, j, z);
5929
+      else {
5930
+        SERIAL_ERROR_START;
5931
+        SERIAL_ERRORLNPGM(MSG_ERR_MESH_XY);
5932
+      }
5933
+    }
5934
+    else 
5935
+    {
5923 5936
       SERIAL_ERROR_START;
5924 5937
       SERIAL_ERRORLNPGM(MSG_ERR_M421_REQUIRES_XYZ);
5925 5938
     }

+ 2
- 2
Marlin/language.h Dosyayı Görüntüle

@@ -147,8 +147,8 @@
147 147
 #define MSG_Z2_MAX                          "z2_max: "
148 148
 #define MSG_Z_PROBE                         "z_probe: "
149 149
 #define MSG_ERR_MATERIAL_INDEX              "M145 S<index> out of range (0-1)"
150
-#define MSG_ERR_M421_REQUIRES_XYZ           "M421 requires XYZ parameters"
151
-#define MSG_ERR_MESH_XY                     "Mesh XY cannot be resolved"
150
+#define MSG_ERR_M421_REQUIRES_XYZ           "M421 requires XYZ or IJZ parameters"
151
+#define MSG_ERR_MESH_XY                     "Mesh XY or IJ cannot be resolved"
152 152
 #define MSG_ERR_M428_TOO_FAR                "Too far from reference point"
153 153
 #define MSG_ERR_M303_DISABLED               "PIDTEMP disabled"
154 154
 #define MSG_M119_REPORT                     "Reporting endstop status"

Loading…
İptal
Kaydet