Ver código fonte

Merge pull request #3798 from AnHardt/extend-M421

Extend M421 with I and J parameters
Scott Lahteine 8 anos atrás
pai
commit
cadf441059
2 arquivos alterados com 17 adições e 4 exclusões
  1. 15
    2
      Marlin/Marlin_main.cpp
  2. 2
    2
      Marlin/language.h

+ 15
- 2
Marlin/Marlin_main.cpp Ver arquivo

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

+ 2
- 2
Marlin/language.h Ver arquivo

@@ -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"

Carregando…
Cancelar
Salvar