|
@@ -5259,15 +5259,13 @@ inline void gcode_M121() { endstops.enable_globally(false); }
|
5259
|
5259
|
*/
|
5260
|
5260
|
inline void gcode_M155() {
|
5261
|
5261
|
// Set the target address
|
5262
|
|
- if (code_seen('A'))
|
5263
|
|
- i2c.address(code_value_byte());
|
|
5262
|
+ if (code_seen('A')) i2c.address(code_value_byte());
|
5264
|
5263
|
|
5265
|
5264
|
// Add a new byte to the buffer
|
5266
|
|
- else if (code_seen('B'))
|
5267
|
|
- i2c.addbyte(code_value_int());
|
|
5265
|
+ if (code_seen('B')) i2c.addbyte(code_value_byte());
|
5268
|
5266
|
|
5269
|
5267
|
// Flush the buffer to the bus
|
5270
|
|
- else if (code_seen('S')) i2c.send();
|
|
5268
|
+ if (code_seen('S')) i2c.send();
|
5271
|
5269
|
|
5272
|
5270
|
// Reset and rewind the buffer
|
5273
|
5271
|
else if (code_seen('R')) i2c.reset();
|
|
@@ -5279,11 +5277,11 @@ inline void gcode_M121() { endstops.enable_globally(false); }
|
5279
|
5277
|
* Usage: M156 A<slave device address base 10> B<number of bytes>
|
5280
|
5278
|
*/
|
5281
|
5279
|
inline void gcode_M156() {
|
5282
|
|
- uint8_t addr = code_seen('A') ? code_value_byte() : 0;
|
5283
|
|
- int bytes = code_seen('B') ? code_value_int() : 1;
|
|
5280
|
+ if (code_seen('A')) i2c.address(code_value_byte());
|
5284
|
5281
|
|
5285
|
|
- if (addr && bytes > 0 && bytes <= 32) {
|
5286
|
|
- i2c.address(addr);
|
|
5282
|
+ uint8_t bytes = code_seen('B') ? code_value_byte() : 1;
|
|
5283
|
+
|
|
5284
|
+ if (i2c.addr > 0 && bytes > 0 && bytes <= 32) {
|
5287
|
5285
|
i2c.reqbytes(bytes);
|
5288
|
5286
|
}
|
5289
|
5287
|
else {
|