From 7ca155077503cb2c62bf5ed739f9c6a2280a1cd9 Mon Sep 17 00:00:00 2001 From: hannesweisbach Date: Wed, 2 Jun 2021 06:20:47 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20TMC=20Driver=20distinct=20baudrates?= =?UTF-8?q?=20(#22008)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Marlin/src/module/stepper/trinamic.cpp | 51 +++++++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/Marlin/src/module/stepper/trinamic.cpp b/Marlin/src/module/stepper/trinamic.cpp index 8c943048ba..560e27ecd1 100644 --- a/Marlin/src/module/stepper/trinamic.cpp +++ b/Marlin/src/module/stepper/trinamic.cpp @@ -129,6 +129,55 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; #define TMC_BAUD_RATE TERN(HAS_TMC_SW_SERIAL, 57600, 115200) #endif +#ifndef TMC_X_BAUD_RATE + #define TMC_X_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_X2_BAUD_RATE + #define TMC_X2_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_Y_BAUD_RATE + #define TMC_Y_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_Y2_BAUD_RATE + #define TMC_Y2_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_Z_BAUD_RATE + #define TMC_Z_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_Z2_BAUD_RATE + #define TMC_Z2_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_Z3_BAUD_RATE + #define TMC_Z3_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_Z4_BAUD_RATE + #define TMC_Z4_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E0_BAUD_RATE + #define TMC_E0_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E1_BAUD_RATE + #define TMC_E1_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E2_BAUD_RATE + #define TMC_E2_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E3_BAUD_RATE + #define TMC_E3_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E4_BAUD_RATE + #define TMC_E4_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E5_BAUD_RATE + #define TMC_E5_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E6_BAUD_RATE + #define TMC_E6_BAUD_RATE TMC_BAUD_RATE +#endif +#ifndef TMC_E7_BAUD_RATE + #define TMC_E7_BAUD_RATE TMC_BAUD_RATE +#endif + #if HAS_DRIVER(TMC2130) template void tmc_init(TMCMarlin &st, const uint16_t mA, const uint16_t microsteps, const uint32_t hyb_thrs, const bool stealth, const chopper_timing_t &chop_init, const bool interpolate) { @@ -364,7 +413,7 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E }; } sp_helper; #define HW_SERIAL_BEGIN(A) do{ if (!sp_helper.began(TMCAxis::A, &A##_HARDWARE_SERIAL)) \ - A##_HARDWARE_SERIAL.begin(TMC_BAUD_RATE); }while(0) + A##_HARDWARE_SERIAL.begin(TMC_##A##_BAUD_RATE); }while(0) #endif #if AXIS_HAS_UART(X)