Scott Lahteine 9 年之前
父節點
當前提交
a6d594665b
共有 1 個檔案被更改,包括 5 行新增1 行删除
  1. 5
    1
      Marlin/Marlin_main.cpp

+ 5
- 1
Marlin/Marlin_main.cpp 查看文件

@@ -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…
取消
儲存