|
@@ -5038,12 +5038,16 @@ inline void gcode_M121() { endstops.enable_globally(false); }
|
5038
|
5038
|
*/
|
5039
|
5039
|
inline void gcode_M156() {
|
5040
|
5040
|
uint8_t addr = code_seen('A') ? code_value_short() : 0;
|
5041
|
|
- int bytes = code_seen('B') ? code_value_short() : 0;
|
|
5041
|
+ int bytes = code_seen('B') ? code_value_short() : 1;
|
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
|