Browse Source

Add missing SoftwareSerial begin for TMC2208

Based on #9299
pull/1/head
Scott Lahteine 7 years ago
parent
commit
db031d5d76
  1. 22
      Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h
  2. 69
      Marlin/src/module/stepper_indirection.cpp

22
Marlin/src/HAL/HAL_AVR/SanityCheck_AVR_8_bit.h

@ -100,17 +100,17 @@
* TMC2208 software UART and ENDSTOP_INTERRUPTS both use pin change interrupts (PCI)
*/
#if ENABLED(HAVE_TMC2208) && ENABLED(ENDSTOP_INTERRUPTS_FEATURE) && !( \
ENABLED( X_HARDWARE_SERIAL ) \
|| ENABLED( X2_HARDWARE_SERIAL ) \
|| ENABLED( Y_HARDWARE_SERIAL ) \
|| ENABLED( Y2_HARDWARE_SERIAL ) \
|| ENABLED( Z_HARDWARE_SERIAL ) \
|| ENABLED( Z2_HARDWARE_SERIAL ) \
|| ENABLED( E0_HARDWARE_SERIAL ) \
|| ENABLED( E1_HARDWARE_SERIAL ) \
|| ENABLED( E2_HARDWARE_SERIAL ) \
|| ENABLED( E3_HARDWARE_SERIAL ) \
|| ENABLED( E4_HARDWARE_SERIAL ) )
defined(X_HARDWARE_SERIAL ) \
|| defined(X2_HARDWARE_SERIAL) \
|| defined(Y_HARDWARE_SERIAL ) \
|| defined(Y2_HARDWARE_SERIAL) \
|| defined(Z_HARDWARE_SERIAL ) \
|| defined(Z2_HARDWARE_SERIAL) \
|| defined(E0_HARDWARE_SERIAL) \
|| defined(E1_HARDWARE_SERIAL) \
|| defined(E2_HARDWARE_SERIAL) \
|| defined(E3_HARDWARE_SERIAL) \
|| defined(E4_HARDWARE_SERIAL) )
#error "select hardware UART for TMC2208 to use both TMC2208 and ENDSTOP_INTERRUPTS_FEATURE."
#endif

69
Marlin/src/module/stepper_indirection.cpp

@ -257,82 +257,82 @@
#include "planner.h"
#define _TMC2208_DEFINE_HARDWARE(ST) TMC2208Stepper stepper##ST(&ST##_HARDWARE_SERIAL)
#define _TMC2208_DEFINE_SOFTWARE(ST) SoftwareSerial stepper##ST##_serial = SoftwareSerial(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN); \
#define _TMC2208_DEFINE_SOFTWARE(ST) SoftwareSerial ST##_HARDWARE_SERIAL = SoftwareSerial(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN); \
TMC2208Stepper stepper##ST(&stepper##ST##_serial, ST##_SERIAL_RX_PIN > -1)
// Stepper objects of TMC2208 steppers used
#if ENABLED(X_IS_TMC2208)
#if defined(X_HARDWARE_SERIAL)
#ifdef X_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(X);
#else
_TMC2208_DEFINE_SOFTWARE(X);
#endif
#endif
#if ENABLED(X2_IS_TMC2208)
#if defined(X2_HARDWARE_SERIAL)
#ifdef X2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(X2);
#else
_TMC2208_DEFINE_SOFTWARE(X2);
#endif
#endif
#if ENABLED(Y_IS_TMC2208)
#if defined(Y_HARDWARE_SERIAL)
#ifdef Y_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Y);
#else
_TMC2208_DEFINE_SOFTWARE(Y);
#endif
#endif
#if ENABLED(Y2_IS_TMC2208)
#if defined(Y2_HARDWARE_SERIAL)
#ifdef Y2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Y2);
#else
_TMC2208_DEFINE_SOFTWARE(Y2);
#endif
#endif
#if ENABLED(Z_IS_TMC2208)
#if defined(Z_HARDWARE_SERIAL)
#ifdef Z_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Z);
#else
_TMC2208_DEFINE_SOFTWARE(Z);
#endif
#endif
#if ENABLED(Z2_IS_TMC2208)
#if defined(Z2_HARDWARE_SERIAL)
#ifdef Z2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(Z2);
#else
_TMC2208_DEFINE_SOFTWARE(Z2);
#endif
#endif
#if ENABLED(E0_IS_TMC2208)
#if defined(E0_HARDWARE_SERIAL)
#ifdef E0_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E0);
#else
_TMC2208_DEFINE_SOFTWARE(E0);
#endif
#endif
#if ENABLED(E1_IS_TMC2208)
#if defined(E1_HARDWARE_SERIAL)
#ifdef E1_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E1);
#else
_TMC2208_DEFINE_SOFTWARE(E1);
#endif
#endif
#if ENABLED(E2_IS_TMC2208)
#if defined(E2_HARDWARE_SERIAL)
#ifdef E2_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E2);
#else
_TMC2208_DEFINE_SOFTWARE(E2);
#endif
#endif
#if ENABLED(E3_IS_TMC2208)
#if defined(E3_HARDWARE_SERIAL)
#ifdef E3_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E3);
#else
_TMC2208_DEFINE_SOFTWARE(E3);
#endif
#endif
#if ENABLED(E4_IS_TMC2208)
#if defined(E4_HARDWARE_SERIAL)
#ifdef E4_HARDWARE_SERIAL
_TMC2208_DEFINE_HARDWARE(E4);
#else
_TMC2208_DEFINE_SOFTWARE(E4);
@ -340,38 +340,38 @@
#endif
void tmc2208_serial_begin() {
#if ENABLED(X_IS_TMC2208) && defined(X_HARDWARE_SERIAL)
X_HARDWARE_SERIAL.begin(250000);
#if ENABLED(X_IS_TMC2208)
X_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(X2_IS_TMC2208) && defined(X2_HARDWARE_SERIAL)
X2_HARDWARE_SERIAL.begin(250000);
#if ENABLED(X2_IS_TMC2208)
X2_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(Y_IS_TMC2208) && defined(Y_HARDWARE_SERIAL)
Y_HARDWARE_SERIAL.begin(250000);
#if ENABLED(Y_IS_TMC2208)
Y_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(Y2_IS_TMC2208) && defined(Y2_HARDWARE_SERIAL)
Y2_HARDWARE_SERIAL.begin(250000);
#if ENABLED(Y2_IS_TMC2208)
Y2_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(Z_IS_TMC2208) && defined(Z_HARDWARE_SERIAL)
Z_HARDWARE_SERIAL.begin(250000);
#if ENABLED(Z_IS_TMC2208)
Z_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(Z2_IS_TMC2208) && defined(Z2_HARDWARE_SERIAL)
Z2_HARDWARE_SERIAL.begin(250000);
#if ENABLED(Z2_IS_TMC2208)
Z2_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(E0_IS_TMC2208) && defined(E0_HARDWARE_SERIAL)
E0_HARDWARE_SERIAL.begin(250000);
#if ENABLED(E0_IS_TMC2208)
E0_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(E1_IS_TMC2208) && defined(E1_HARDWARE_SERIAL)
E1_HARDWARE_SERIAL.begin(250000);
#if ENABLED(E1_IS_TMC2208)
E1_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(E2_IS_TMC2208) && defined(E2_HARDWARE_SERIAL)
E2_HARDWARE_SERIAL.begin(250000);
#if ENABLED(E2_IS_TMC2208)
E2_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(E3_IS_TMC2208) && defined(E3_HARDWARE_SERIAL)
E3_HARDWARE_SERIAL.begin(250000);
#if ENABLED(E3_IS_TMC2208)
E3_HARDWARE_SERIAL.begin(115200);
#endif
#if ENABLED(E4_IS_TMC2208) && defined(E4_HARDWARE_SERIAL)
E4_HARDWARE_SERIAL.begin(250000);
#if ENABLED(E4_IS_TMC2208)
E4_HARDWARE_SERIAL.begin(115200);
#endif
}
@ -450,7 +450,6 @@
}
#endif // HAVE_TMC2208
//
// L6470 Driver objects and inits
//

Loading…
Cancel
Save