Browse Source

Print error for M42 bad pin

Scott Lahteine 8 years ago
parent
commit
c6dd539c84
2 changed files with 6 additions and 1 deletions
  1. 5
    1
      Marlin/Marlin_main.cpp
  2. 1
    0
      Marlin/language.h

+ 5
- 1
Marlin/Marlin_main.cpp View File

@@ -4230,7 +4230,11 @@ inline void gcode_M42() {
4230 4230
   if (pin_number < 0) return;
4231 4231
 
4232 4232
   for (uint8_t i = 0; i < COUNT(sensitive_pins); i++)
4233
-    if (pin_number == sensitive_pins[i]) return;
4233
+    if (pin_number == sensitive_pins[i]) {
4234
+      SERIAL_ERROR_START;
4235
+      SERIAL_ERRORLNPGM(MSG_ERR_PROTECTED_PIN);
4236
+      return;
4237
+    }
4234 4238
 
4235 4239
   pinMode(pin_number, OUTPUT);
4236 4240
   digitalWrite(pin_number, pin_status);

+ 1
- 0
Marlin/language.h View File

@@ -151,6 +151,7 @@
151 151
 #define MSG_ERR_M421_PARAMETERS             "M421 requires XYZ or IJZ parameters"
152 152
 #define MSG_ERR_MESH_XY                     "Mesh XY or IJ cannot be resolved"
153 153
 #define MSG_ERR_ARC_ARGS                    "G2/G3 bad parameters"
154
+#define MSG_ERR_PROTECTED_PIN               "Protected Pin"
154 155
 #define MSG_ERR_M428_TOO_FAR                "Too far from reference point"
155 156
 #define MSG_ERR_M303_DISABLED               "PIDTEMP disabled"
156 157
 #define MSG_M119_REPORT                     "Reporting endstop status"

Loading…
Cancel
Save