Parcourir la source

Small reduction in M421 code

Scott Lahteine il y a 8 ans
Parent
révision
360adc6a3b
2 fichiers modifiés avec 8 ajouts et 11 suppressions
  1. 7
    10
      Marlin/Marlin_main.cpp
  2. 1
    1
      Marlin/language.h

+ 7
- 10
Marlin/Marlin_main.cpp Voir le fichier

5904
    * Use either 'M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>'
5904
    * Use either 'M421 X<mm> Y<mm> Z<mm>' or 'M421 I<xindex> J<yindex> Z<mm>'
5905
    */
5905
    */
5906
   inline void gcode_M421() {
5906
   inline void gcode_M421() {
5907
-    float x = 0, y = 0, z = 0;
5908
-    int8_t px = 0, py = 0;
5909
-    bool err = false, hasX, hasY, hasZ, hasI, hasJ;
5910
-    if ((hasX = code_seen('X'))) x = code_value();
5911
-    if ((hasY = code_seen('Y'))) y = code_value();
5912
-    if ((hasZ = code_seen('Z'))) z = code_value();
5907
+    int8_t px, py;
5908
+    float z = 0;
5909
+    bool hasX, hasY, hasZ, hasI, hasJ;
5910
+    if ((hasX = code_seen('X'))) px = mbl.probe_index_x(code_value());
5911
+    if ((hasY = code_seen('Y'))) py = mbl.probe_index_y(code_value());
5913
     if ((hasI = code_seen('I'))) px = code_value();
5912
     if ((hasI = code_seen('I'))) px = code_value();
5914
     if ((hasJ = code_seen('J'))) py = code_value();
5913
     if ((hasJ = code_seen('J'))) py = code_value();
5914
+    if ((hasZ = code_seen('Z'))) z = code_value();
5915
 
5915
 
5916
     if (hasX && hasY && hasZ) {
5916
     if (hasX && hasY && hasZ) {
5917
 
5917
 
5918
-      px = mbl.probe_index_x(x);
5919
-      py = mbl.probe_index_y(y);
5920
-
5921
       if (px >= 0 && py >= 0)
5918
       if (px >= 0 && py >= 0)
5922
         mbl.set_z(px, py, z);
5919
         mbl.set_z(px, py, z);
5923
       else {
5920
       else {
5935
     }
5932
     }
5936
     else {
5933
     else {
5937
       SERIAL_ERROR_START;
5934
       SERIAL_ERROR_START;
5938
-      SERIAL_ERRORLNPGM(MSG_ERR_M421_REQUIRES_XYZ);
5935
+      SERIAL_ERRORLNPGM(MSG_ERR_M421_PARAMETERS);
5939
     }
5936
     }
5940
   }
5937
   }
5941
 
5938
 

+ 1
- 1
Marlin/language.h Voir le fichier

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

Chargement…
Annuler
Enregistrer