Move M260_M261 to cpp

2.0.x
Scott Lahteine 7 years ago
parent 3e761696a0
commit d4d3d92f8a

@ -84,6 +84,7 @@
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "feature/twibus.h"
TWIBus i2c;
#endif
#if ENABLED(I2C_POSITION_ENCODERS)
@ -98,10 +99,6 @@
CardReader card;
#endif
#if ENABLED(EXPERIMENTAL_I2CBUS)
TWIBus i2c;
#endif
#if ENABLED(G38_PROBE_TARGET)
bool G38_move = false,
G38_endstop_hit = false;
@ -355,10 +352,6 @@ bool pin_is_protected(const int8_t pin) {
return false;
}
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "gcode/feature/i2c/M260_M261.h"
#endif
#if HAS_SERVOS
#include "gcode/control/M280.h"
#endif

@ -143,6 +143,11 @@ void manage_inactivity(bool ignore_stepper_queue = false);
#endif // !MIXING_EXTRUDER
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "feature/twibus.h"
extern TWIBus i2c;
#endif
#if ENABLED(G38_PROBE_TARGET)
extern bool G38_move, // flag to tell the interrupt handler that a G38 command is being run
G38_endstop_hit; // flag from the interrupt handler to indicate if the endstop went active

@ -20,6 +20,14 @@
*
*/
#include "../../../inc/MarlinConfig.h"
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "../../gcode.h"
#include "../../../Marlin.h" // for i2c
/**
* M260: Send data to a I2C slave device
*
@ -36,7 +44,7 @@
* M260 R1 ; Reset the buffer without sending data
*
*/
void gcode_M260() {
void GcodeSuite::M260() {
// Set the target address
if (parser.seen('A')) i2c.address(parser.value_byte());
@ -55,7 +63,7 @@ void gcode_M260() {
*
* Usage: M261 A<slave device address base 10> B<number of bytes>
*/
void gcode_M261() {
void GcodeSuite::M261() {
if (parser.seen('A')) i2c.address(parser.value_byte());
uint8_t bytes = parser.byteval('B', 1);
@ -68,3 +76,5 @@ void gcode_M261() {
SERIAL_ERRORLN("Bad i2c request");
}
}
#endif

@ -121,8 +121,6 @@ extern void gcode_M164();
extern void gcode_M165();
extern void gcode_M240();
extern void gcode_M250();
extern void gcode_M260();
extern void gcode_M261();
extern void gcode_M280();
extern void gcode_M300();
extern void gcode_M301();
@ -602,16 +600,9 @@ void GcodeSuite::process_next_command() {
#endif // HAS_LCD_CONTRAST
#if ENABLED(EXPERIMENTAL_I2CBUS)
case 260: // M260: Send data to an i2c slave
gcode_M260();
break;
case 261: // M261: Request data from an i2c slave
gcode_M261();
break;
#endif // EXPERIMENTAL_I2CBUS
case 260: M260(); break; // M260: Send data to an i2c slave
case 261: M261(); break; // M261: Request data from an i2c slave
#endif
#if ENABLED(PREVENT_COLD_EXTRUSION)
case 302: // M302: Allow cold extrudes (set the minimum extrude temperature)

Loading…
Cancel
Save