Skip to content

Commit

Permalink
EXPERIMENTAL_I2CBUS is just skeleton code
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Jan 15, 2023
1 parent 11d10f3 commit 946b805
Show file tree
Hide file tree
Showing 16 changed files with 24 additions and 25 deletions.
9 changes: 5 additions & 4 deletions Marlin/Configuration_adv.h
Original file line number Diff line number Diff line change
Expand Up @@ -3233,8 +3233,9 @@
/**
* TWI/I2C BUS
*
* Enabling this will allow you to send and receive I2C data from slave devices
* on the bus.
* This feature is an EXPERIMENTAL feature so it shall not be used on production
* machines. Enabling this will allow you to send and receive I2C data from slave
* devices on the bus.
*
* ; Example #1
* ; This macro send the string "Marlin" to the slave device with address 0x63 (99)
Expand All @@ -3257,8 +3258,8 @@
* echo:i2c-reply: from:99 bytes:5 data:hello
*/

//#define I2CBUS
#if ENABLED(I2CBUS)
//#define EXPERIMENTAL_I2CBUS
#if ENABLED(EXPERIMENTAL_I2CBUS)
#define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/HAL/LPC1768/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static_assert(DISABLED(BAUD_RATE_GCODE), "BAUD_RATE_GCODE is not yet supported o
//
// Flag any i2c pin conflicts
//
#if ANY(HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC, I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
#if ANY(HAS_MOTOR_CURRENT_I2C, HAS_MOTOR_CURRENT_DAC, EXPERIMENTAL_I2CBUS, I2C_POSITION_ENCODERS, PCA9632, I2C_EEPROM)
#define USEDI2CDEV_M 1 // <Arduino>/Wire.cpp

#if USEDI2CDEV_M == 0 // P0_27 [D57] (AUX-1) .......... P0_28 [D58] (AUX-1)
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/MarlinCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@
#include "feature/dac/stepper_dac.h"
#endif

#if ENABLED(I2CBUS)
#if ENABLED(EXPERIMENTAL_I2CBUS)
#include "feature/twibus.h"
#endif

Expand Down Expand Up @@ -1532,7 +1532,7 @@ void setup() {
SETUP_RUN(I2CPEM.init());
#endif

#if ENABLED(I2CBUS) && I2C_SLAVE_ADDRESS > 0
#if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
SETUP_LOG("i2c...");
i2c.onReceive(i2c_on_receive);
i2c.onRequest(i2c_on_request);
Expand Down
4 changes: 2 additions & 2 deletions Marlin/src/feature/twibus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../inc/MarlinConfig.h"

#if ENABLED(I2CBUS)
#if ENABLED(EXPERIMENTAL_I2CBUS)

#include "twibus.h"

Expand Down Expand Up @@ -234,4 +234,4 @@ void TWIBus::flush() {

#endif

#endif // I2CBUS
#endif // EXPERIMENTAL_I2CBUS
2 changes: 1 addition & 1 deletion Marlin/src/gcode/feature/i2c/M260_M261.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "../../../inc/MarlinConfig.h"

#if ENABLED(I2CBUS)
#if ENABLED(EXPERIMENTAL_I2CBUS)

#include "../../gcode.h"

Expand Down
2 changes: 1 addition & 1 deletion Marlin/src/gcode/gcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -803,7 +803,7 @@ void GcodeSuite::process_parsed_command(const bool no_ok/*=false*/) {
case 256: M256(); break; // M256: Set LCD brightness
#endif

#if ENABLED(I2CBUS)
#if ENABLED(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
Expand Down
6 changes: 3 additions & 3 deletions Marlin/src/gcode/gcode.h
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@
* M250 - Set LCD contrast: "M250 C<contrast>" (0-63). (Requires LCD support)
* M255 - Set LCD sleep time: "M255 S<minutes>" (0-99). (Requires an LCD with brightness or sleep/wake)
* M256 - Set LCD brightness: "M256 B<brightness>" (0-255). (Requires an LCD with brightness control)
* M260 - i2c Send Data (Requires I2CBUS)
* M261 - i2c Request Data (Requires I2CBUS)
* M260 - i2c Send Data (Requires EXPERIMENTAL_I2CBUS)
* M261 - i2c Request Data (Requires EXPERIMENTAL_I2CBUS)
* M280 - Set servo position absolute: "M280 P<index> S<angle|µs>". (Requires servos)
* M281 - Set servo min|max position: "M281 P<index> L<min> U<max>". (Requires EDITABLE_SERVO_ANGLES)
* M282 - Detach servo: "M282 P<index>". (Requires SERVO_DETACH_GCODE)
Expand Down Expand Up @@ -902,7 +902,7 @@ class GcodeSuite {
static void M256_report(const bool forReplay=true);
#endif

#if ENABLED(I2CBUS)
#if ENABLED(EXPERIMENTAL_I2CBUS)
static void M260();
static void M261();
#endif
Expand Down
4 changes: 1 addition & 3 deletions Marlin/src/inc/SanityCheck.h
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,6 @@
#error "MILLISECONDS_PREHEAT_TIME is now PREHEAT_TIME_HOTEND_MS."
#elif defined(EXPERIMENTAL_SCURVE)
#error "EXPERIMENTAL_SCURVE is no longer needed and should be removed."
#elif defined(EXPERIMENTAL_I2CBUS)
#error "EXPERIMENTAL_I2CBUS is now I2CBUS."
#endif

// L64xx stepper drivers have been removed
Expand Down Expand Up @@ -2888,7 +2886,7 @@ static_assert(Y_MAX_LENGTH >= Y_BED_SIZE, "Movement bounds (Y_MIN_POS, Y_MAX_POS
/**
* I2C bus
*/
#if ENABLED(I2CBUS) && I2C_SLAVE_ADDRESS > 0
#if ENABLED(EXPERIMENTAL_I2CBUS) && I2C_SLAVE_ADDRESS > 0
#if I2C_SLAVE_ADDRESS < 8
#error "I2C_SLAVE_ADDRESS can't be less than 8. (Addresses 0 - 7 are reserved.)"
#elif I2C_SLAVE_ADDRESS > 127
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/LPC1769
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ opt_set MOTHERBOARD BOARD_COHESION3D_REMIX \
opt_enable AUTO_BED_LEVELING_BILINEAR EEPROM_SETTINGS EEPROM_CHITCHAT MECHANICAL_GANTRY_CALIBRATION \
TMC_USE_SW_SPI MONITOR_DRIVER_STATUS STEALTHCHOP_XY STEALTHCHOP_Z HYBRID_THRESHOLD \
SENSORLESS_PROBING Z_SAFE_HOMING X_STALL_SENSITIVITY Y_STALL_SENSITIVITY Z_STALL_SENSITIVITY TMC_DEBUG \
I2CBUS
EXPERIMENTAL_I2CBUS
opt_disable PSU_CONTROL Z_MIN_PROBE_USES_Z_MIN_ENDSTOP_PIN
exec_test $1 $2 "Cohesion3D Remix DELTA + ABL Bilinear + EEPROM + SENSORLESS_PROBING" "$3"

Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/SAMD21_minitronics20
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
SQUARE_WAVE_STEPPING
SQUARE_WAVE_STEPPING EXPERIMENTAL_SCURVE
exec_test $1 $2 "Minitronics 2.0 with assorted features" "$3"

# clean up
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/SAMD51_grandcentral_m4
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R
SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
SQUARE_WAVE_STEPPING TMC_DEBUG
SQUARE_WAVE_STEPPING TMC_DEBUG EXPERIMENTAL_SCURVE
exec_test $1 $2 "Grand Central M4 with assorted features" "$3"

# clean up
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/rambo
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ opt_enable EEPROM_SETTINGS EEPROM_CHITCHAT REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CO
SDSUPPORT PCA9632 SOUND_MENU_ITEM GCODE_REPEAT_MARKERS \
AUTO_BED_LEVELING_LINEAR PROBE_MANUALLY LCD_BED_LEVELING \
LIN_ADVANCE ADVANCE_K_EXTRA \
INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT I2CBUS M100_FREE_MEMORY_WATCHER \
INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT EXPERIMENTAL_I2CBUS M100_FREE_MEMORY_WATCHER \
NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE \
ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE ADVANCED_PAUSE_CONTINUOUS_PURGE FILAMENT_LOAD_UNLOAD_GCODES \
PRINTCOUNTER SERVICE_NAME_1 SERVICE_INTERVAL_1 M114_DETAIL
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/teensy31
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ opt_enable EEPROM_SETTINGS FILAMENT_WIDTH_SENSOR CALIBRATION_GCODE BAUD_RATE_GCO
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET PRINTCOUNTER SLOW_PWM_HEATERS PIDTEMPBED \
INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER \
NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE PARK_HEAD_ON_PAUSE \
ARC_SUPPORT BEZIER_CURVE_SUPPORT I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES \
ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES \
PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \
HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT
exec_test $1 $2 "Teensy3.1 with many features" "$3"
2 changes: 1 addition & 1 deletion buildroot/tests/teensy35
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ opt_enable REPRAP_DISCOUNT_FULL_GRAPHIC_SMART_CONTROLLER SDSUPPORT SDCARD_SORT_A
FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET BABYSTEP_ZPROBE_GFX_OVERLAY \
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT M100_FREE_MEMORY_WATCHER \
ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \
ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \
PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \
HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT
exec_test $1 $2 "Teensy3.5 with many features" "$3"
Expand Down
2 changes: 1 addition & 1 deletion buildroot/tests/teensy41
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ opt_enable MAX31865_SENSOR_OHMS_0 MAX31865_CALIBRATION_OHMS_0 \
FIX_MOUNTED_PROBE Z_SAFE_HOMING AUTO_BED_LEVELING_BILINEAR Z_MIN_PROBE_REPEATABILITY_TEST DEBUG_LEVELING_FEATURE \
BABYSTEPPING BABYSTEP_XY BABYSTEP_ZPROBE_OFFSET \
PRINTCOUNTER NOZZLE_PARK_FEATURE NOZZLE_CLEAN_FEATURE SLOW_PWM_HEATERS PIDTEMPBED EEPROM_SETTINGS INCH_MODE_SUPPORT TEMPERATURE_UNITS_SUPPORT \
ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \
ADVANCED_PAUSE_FEATURE ARC_SUPPORT BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS EXTENDED_CAPABILITIES_REPORT AUTO_REPORT_TEMPERATURES PARK_HEAD_ON_PAUSE \
PHOTO_GCODE PHOTO_POSITION PHOTO_SWITCH_POSITION PHOTO_SWITCH_MS PHOTO_DELAY_MS PHOTO_RETRACT_MM \
HOST_ACTION_COMMANDS HOST_PROMPT_SUPPORT
opt_add EXTUI_EXAMPLE
Expand Down
2 changes: 1 addition & 1 deletion ini/features.ini
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ HAS_FILAMENT_SENSOR = src_filter=+<src/feature/runout.cpp> +<
MK2_MULTIPLEXER = src_filter=+<src/feature/snmm.cpp>
HAS_CUTTER = src_filter=+<src/feature/spindle_laser.cpp> +<src/gcode/control/M3-M5.cpp>
HAS_DRIVER_SAFE_POWER_PROTECT = src_filter=+<src/feature/stepper_driver_safety.cpp>
I2CBUS = src_filter=+<src/feature/twibus.cpp> +<src/gcode/feature/i2c>
EXPERIMENTAL_I2CBUS = src_filter=+<src/feature/twibus.cpp> +<src/gcode/feature/i2c>
G26_MESH_VALIDATION = src_filter=+<src/gcode/bedlevel/G26.cpp>
ASSISTED_TRAMMING = src_filter=+<src/feature/tramming.cpp> +<src/gcode/bedlevel/G35.cpp>
HAS_MESH = src_filter=+<src/gcode/bedlevel/G42.cpp>
Expand Down

0 comments on commit 946b805

Please sign in to comment.