Browse Source

Merge pull request #4608 from thinkyhead/rc_more_twibus_tweaks

Additional details for I2C_SLAVE_ADDRESS
pull/1/head
Scott Lahteine 8 years ago
committed by GitHub
parent
commit
464d594450
  1. 2
      .travis.yml
  2. 2
      Marlin/Configuration_adv.h
  3. 2
      Marlin/Marlin_main.cpp
  4. 11
      Marlin/SanityCheck.h
  5. 2
      Marlin/example_configurations/Cartesio/Configuration_adv.h
  6. 2
      Marlin/example_configurations/Felix/Configuration_adv.h
  7. 2
      Marlin/example_configurations/Hephestos/Configuration_adv.h
  8. 2
      Marlin/example_configurations/Hephestos_2/Configuration_adv.h
  9. 2
      Marlin/example_configurations/K8200/Configuration_adv.h
  10. 2
      Marlin/example_configurations/K8400/Configuration_adv.h
  11. 2
      Marlin/example_configurations/RigidBot/Configuration_adv.h
  12. 2
      Marlin/example_configurations/SCARA/Configuration_adv.h
  13. 2
      Marlin/example_configurations/TAZ4/Configuration_adv.h
  14. 2
      Marlin/example_configurations/WITBOX/Configuration_adv.h
  15. 2
      Marlin/example_configurations/delta/biv2.5/Configuration_adv.h
  16. 2
      Marlin/example_configurations/delta/generic/Configuration_adv.h
  17. 2
      Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h
  18. 2
      Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h
  19. 2
      Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h
  20. 2
      Marlin/example_configurations/makibox/Configuration_adv.h
  21. 2
      Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h
  22. 5
      Marlin/twibus.cpp

2
.travis.yml

@ -209,7 +209,7 @@ script:
# #
- restore_configs - restore_configs
- opt_enable_adv BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS - opt_enable_adv BEZIER_CURVE_SUPPORT EXPERIMENTAL_I2CBUS
- opt_set_adv I2C_SLAVE_ADDRESS 1 - opt_set_adv I2C_SLAVE_ADDRESS 63
- build_marlin - build_marlin
# #
# Enable COREXY # Enable COREXY

2
Marlin/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/Marlin_main.cpp

@ -5294,7 +5294,7 @@ inline void gcode_M121() { endstops.enable_globally(false); }
} }
} }
#endif //EXPERIMENTAL_I2CBUS #endif // EXPERIMENTAL_I2CBUS
/** /**
* M200: Set filament diameter and set E axis units to cubic units * M200: Set filament diameter and set E axis units to cubic units

11
Marlin/SanityCheck.h

@ -747,3 +747,14 @@
#if ENABLED(EMERGENCY_PARSER) && defined(USBCON) #if ENABLED(EMERGENCY_PARSER) && defined(USBCON)
#error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)." #error "EMERGENCY_PARSER does not work on boards with AT90USB processors (USBCON)."
#endif #endif
/**
* I2C bus
*/
#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
#error "I2C_SLAVE_ADDRESS can't be over 127. (Only 7 bits allowed.)"
#endif
#endif

2
Marlin/example_configurations/Cartesio/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/Felix/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/Hephestos/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/Hephestos_2/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/K8200/Configuration_adv.h

@ -801,6 +801,6 @@ const unsigned int dropsegments = 2; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/K8400/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/RigidBot/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/SCARA/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/TAZ4/Configuration_adv.h

@ -803,6 +803,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/WITBOX/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/delta/biv2.5/Configuration_adv.h

@ -797,6 +797,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/delta/generic/Configuration_adv.h

@ -797,6 +797,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/delta/kossel_mini/Configuration_adv.h

@ -796,6 +796,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/delta/kossel_pro/Configuration_adv.h

@ -801,6 +801,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/delta/kossel_xl/Configuration_adv.h

@ -797,6 +797,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/makibox/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

2
Marlin/example_configurations/tvrrug/Round2/Configuration_adv.h

@ -795,6 +795,6 @@ const unsigned int dropsegments = 5; //everything with less than this number of
// @section i2cbus // @section i2cbus
//#define EXPERIMENTAL_I2CBUS //#define EXPERIMENTAL_I2CBUS
#define I2C_SLAVE_ADDRESS 0 // Set non-zero to act as a slave #define I2C_SLAVE_ADDRESS 0 // Set a value from 8 to 127 to act as a slave
#endif // CONFIGURATION_ADV_H #endif // CONFIGURATION_ADV_H

5
Marlin/twibus.cpp

@ -43,6 +43,11 @@ void TWIBus::reset() {
} }
void TWIBus::address(const uint8_t adr) { void TWIBus::address(const uint8_t adr) {
if (adr < 8 || adr > 127) {
SERIAL_ECHO_START;
SERIAL_ECHOLNPGM("Bad I2C address (8-127)");
}
this->addr = adr; this->addr = adr;
#if ENABLED(DEBUG_TWIBUS) #if ENABLED(DEBUG_TWIBUS)

Loading…
Cancel
Save