Skip to content

Commit 7ca1550

Browse files
hannesweisbachthinkyhead
authored andcommitted
✨ TMC Driver distinct baudrates (MarlinFirmware#22008)
1 parent 665a71b commit 7ca1550

File tree

1 file changed

+50
-1
lines changed

1 file changed

+50
-1
lines changed

Marlin/src/module/stepper/trinamic.cpp

Lines changed: 50 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,55 @@ enum StealthIndex : uint8_t { STEALTH_AXIS_XY, STEALTH_AXIS_Z, STEALTH_AXIS_E };
129129
#define TMC_BAUD_RATE TERN(HAS_TMC_SW_SERIAL, 57600, 115200)
130130
#endif
131131

132+
#ifndef TMC_X_BAUD_RATE
133+
#define TMC_X_BAUD_RATE TMC_BAUD_RATE
134+
#endif
135+
#ifndef TMC_X2_BAUD_RATE
136+
#define TMC_X2_BAUD_RATE TMC_BAUD_RATE
137+
#endif
138+
#ifndef TMC_Y_BAUD_RATE
139+
#define TMC_Y_BAUD_RATE TMC_BAUD_RATE
140+
#endif
141+
#ifndef TMC_Y2_BAUD_RATE
142+
#define TMC_Y2_BAUD_RATE TMC_BAUD_RATE
143+
#endif
144+
#ifndef TMC_Z_BAUD_RATE
145+
#define TMC_Z_BAUD_RATE TMC_BAUD_RATE
146+
#endif
147+
#ifndef TMC_Z2_BAUD_RATE
148+
#define TMC_Z2_BAUD_RATE TMC_BAUD_RATE
149+
#endif
150+
#ifndef TMC_Z3_BAUD_RATE
151+
#define TMC_Z3_BAUD_RATE TMC_BAUD_RATE
152+
#endif
153+
#ifndef TMC_Z4_BAUD_RATE
154+
#define TMC_Z4_BAUD_RATE TMC_BAUD_RATE
155+
#endif
156+
#ifndef TMC_E0_BAUD_RATE
157+
#define TMC_E0_BAUD_RATE TMC_BAUD_RATE
158+
#endif
159+
#ifndef TMC_E1_BAUD_RATE
160+
#define TMC_E1_BAUD_RATE TMC_BAUD_RATE
161+
#endif
162+
#ifndef TMC_E2_BAUD_RATE
163+
#define TMC_E2_BAUD_RATE TMC_BAUD_RATE
164+
#endif
165+
#ifndef TMC_E3_BAUD_RATE
166+
#define TMC_E3_BAUD_RATE TMC_BAUD_RATE
167+
#endif
168+
#ifndef TMC_E4_BAUD_RATE
169+
#define TMC_E4_BAUD_RATE TMC_BAUD_RATE
170+
#endif
171+
#ifndef TMC_E5_BAUD_RATE
172+
#define TMC_E5_BAUD_RATE TMC_BAUD_RATE
173+
#endif
174+
#ifndef TMC_E6_BAUD_RATE
175+
#define TMC_E6_BAUD_RATE TMC_BAUD_RATE
176+
#endif
177+
#ifndef TMC_E7_BAUD_RATE
178+
#define TMC_E7_BAUD_RATE TMC_BAUD_RATE
179+
#endif
180+
132181
#if HAS_DRIVER(TMC2130)
133182
template<char AXIS_LETTER, char DRIVER_ID, AxisEnum AXIS_ID>
134183
void tmc_init(TMCMarlin<TMC2130Stepper, AXIS_LETTER, DRIVER_ID, AXIS_ID> &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 };
364413
} sp_helper;
365414

366415
#define HW_SERIAL_BEGIN(A) do{ if (!sp_helper.began(TMCAxis::A, &A##_HARDWARE_SERIAL)) \
367-
A##_HARDWARE_SERIAL.begin(TMC_BAUD_RATE); }while(0)
416+
A##_HARDWARE_SERIAL.begin(TMC_##A##_BAUD_RATE); }while(0)
368417
#endif
369418

370419
#if AXIS_HAS_UART(X)

0 commit comments

Comments
 (0)