Scott Lahteine 9 years ago
parent
commit
a6d594665b
1 changed files with 5 additions and 1 deletions
  1. 5
    1
      Marlin/Marlin_main.cpp

+ 5
- 1
Marlin/Marlin_main.cpp View File

@@ -5040,10 +5040,14 @@ inline void gcode_M121() { endstops.enable_globally(false); }
5040 5040
     uint8_t addr = code_seen('A') ? code_value_short() : 0;
5041 5041
     int bytes    = code_seen('B') ? code_value_short() : 0;
5042 5042
 
5043
-    if (addr && bytes) {
5043
+    if (addr && bytes > 0 && bytes <= 32) {
5044 5044
       i2c.address(addr);
5045 5045
       i2c.reqbytes(bytes);
5046 5046
     }
5047
+    else {
5048
+      SERIAL_ERROR_START;
5049
+      SERIAL_ERRORLN("Bad i2c request");
5050
+    }
5047 5051
   }
5048 5052
 
5049 5053
 #endif //EXPERIMENTAL_I2CBUS

Loading…
Cancel
Save