Skip to content

Commit c57f715

Browse files
committed
🎨 Trinamic cleanup
1 parent 580c99e commit c57f715

13 files changed

+39
-54
lines changed

Marlin/src/MarlinCore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1258,7 +1258,7 @@ void setup() {
12581258
SETUP_RUN(runout.setup());
12591259
#endif
12601260

1261-
#if HAS_TMC220x
1261+
#if HAS_TMC_UART
12621262
SETUP_RUN(tmc_serial_begin());
12631263
#endif
12641264

Marlin/src/feature/tmc_util.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -614,9 +614,10 @@
614614
default: break;
615615
}
616616
}
617-
#endif
617+
#endif // TMC2160 || TMC5160
618618

619619
#if HAS_TMC220x
620+
620621
static void _tmc_status(TMC2208Stepper &st, const TMC_debug_enum i) {
621622
switch (i) {
622623
case TMC_PWM_SCALE_SUM: SERIAL_ECHO(st.pwm_scale_sum()); break;
@@ -664,7 +665,8 @@
664665
}
665666
}
666667
#endif
667-
#endif
668+
669+
#endif // HAS_TMC220x
668670

669671
#if HAS_DRIVER(TMC2660)
670672
static void _tmc_parse_drv_status(TMC2660Stepper, const TMC_drv_status_enum) { }

Marlin/src/feature/tmc_util.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
#include <TMCStepper.h>
3030
#include "../module/planner.h"
3131

32-
#define CHOPPER_DEFAULT_12V { 3, -1, 1 }
32+
#define CHOPPER_DEFAULT_12V { 3, -1, 1 } // { toff, hend, hstrt }
3333
#define CHOPPER_DEFAULT_19V { 4, 1, 1 }
3434
#define CHOPPER_DEFAULT_24V { 4, 2, 1 }
3535
#define CHOPPER_DEFAULT_36V { 5, 2, 4 }

Marlin/src/module/stepper/trinamic.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ enum StealthIndex : uint8_t {
5656
#else
5757
#define TMC_UART_HW_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(&ST##_HARDWARE_SERIAL, float(ST##_RSENSE), ST##_SLAVE_ADDRESS)
5858
#endif
59+
5960
#define TMC_UART_SW_DEFINE(IC, ST, L, AI) TMCMarlin<IC##Stepper, L, AI> stepper##ST(ST##_SERIAL_RX_PIN, ST##_SERIAL_TX_PIN, float(ST##_RSENSE), ST##_SLAVE_ADDRESS)
6061

6162
#define _TMC_SPI_DEFINE(IC, ST, AI) __TMC_SPI_DEFINE(IC, ST, TMC_##ST##_LABEL, AI)
@@ -292,7 +293,7 @@ enum StealthIndex : uint8_t {
292293
//
293294
// TMC2208/2209 Driver objects and inits
294295
//
295-
#if HAS_TMC220x
296+
#if HAS_TMC_UART
296297
#if AXIS_HAS_UART(X)
297298
#ifdef X_HARDWARE_SERIAL
298299
TMC_UART_DEFINE(HW, X, X);

Marlin/src/module/stepper/trinamic.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@
108108
#define CHOPPER_TIMING_E CHOPPER_TIMING
109109
#endif
110110

111-
#if HAS_TMC220x
111+
#if HAS_TMC_UART
112112
void tmc_serial_begin();
113113
#endif
114114

Marlin/src/pins/esp32/pins_FYSETC_E4.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040

4141
#if HAS_TMC_UART
4242
//
43-
// TMC2209 stepper drivers
43+
// TMC2208/TMC2209 stepper drivers
4444
//
4545
#define X_HARDWARE_SERIAL Serial1
4646
#define Y_HARDWARE_SERIAL Serial1

Marlin/src/pins/esp32/pins_GODI_CONTROLLER_V1_0.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696

9797
#if HAS_TMC_UART
9898
//
99-
// TMC2209 stepper drivers
99+
// TMC2208/TMC2209 stepper drivers
100100
//
101101

102102
//

Marlin/src/pins/lpc1768/pins_MKS_SBASE.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@
294294
#endif // HAS_WIRED_LCD
295295

296296
/**
297-
* Example for trinamic drivers using the J8 connector on MKs Sbase.
297+
* Example for Trinamic drivers using the J8 connector on MKS Sbase.
298298
* 2130s need 1 pin for each driver. 2208/2209s need 2 pins for serial control.
299299
* This board does not have enough pins to use hardware serial.
300300
*/

Marlin/src/pins/ramps/pins_ZRIB_V53.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@
187187

188188
#if HAS_TMC_UART
189189
/**
190-
* TMC2209 stepper drivers
190+
* TMC2208/TMC2209 stepper drivers
191191
*
192192
* Hardware serial communication ports.
193193
* If undefined software serial is used according to the pins below

Marlin/src/pins/stm32f1/pins_BTT_SKR_CR6.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136

137137
#if HAS_TMC_UART
138138
/**
139-
* TMC2209 stepper drivers
139+
* TMC2208/TMC2209 stepper drivers
140140
* Hardware serial communication ports.
141141
*/
142142
#define X_HARDWARE_SERIAL MSerial4

Marlin/src/pins/stm32f1/pins_FLSUN_HISPEED.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
*/
126126
#if HAS_TMC_UART
127127
// SoftwareSerial with one pin per driver
128-
// Compatible with TMC2208 and TMC2209 drivers
128+
// Compatible with TMC2208/TMC2209 drivers
129129
#define X_SERIAL_TX_PIN PA10 // RXD1
130130
#define Y_SERIAL_TX_PIN PA9 // TXD1
131131
#define Z_SERIAL_TX_PIN PC7 // IO1
@@ -169,7 +169,7 @@
169169
//
170170
// EXTRUDER
171171
//
172-
#if AXIS_DRIVER_TYPE_E0(TMC2208) || AXIS_DRIVER_TYPE_E0(TMC2209)
172+
#if AXIS_HAS_UART(E0)
173173
#define E0_SERIAL_TX_PIN PA8 // IO0
174174
#else
175175
// Motor current PWM pins

Marlin/src/pins/stm32f1/pins_KEDI_CONTROLLER_V1_2.h

+22-40
Original file line numberDiff line numberDiff line change
@@ -94,47 +94,29 @@
9494
#endif
9595

9696
// CS Pins (One pin for each driver)
97-
#if HAS_DRIVER(TMC2130) || HAS_DRIVER(TMC2160) || HAS_DRIVER(TMC2660) || HAS_DRIVER(TMC5130) || HAS_DRIVER(TMC5160)
98-
#ifndef X_CS_PIN
99-
#define X_CS_PIN PC10
100-
#endif
101-
#ifndef Y_CS_PIN
102-
#define Y_CS_PIN PC11
103-
#endif
104-
#ifndef Z_CS_PIN
105-
#define Z_CS_PIN PC12
106-
#endif
107-
#ifndef E0_CS_PIN
108-
#define E0_CS_PIN PC14
109-
#endif
97+
#if HAS_TMC_SPI
98+
#ifndef X_CS_PIN
99+
#define X_CS_PIN PC10
100+
#endif
101+
#ifndef Y_CS_PIN
102+
#define Y_CS_PIN PC11
103+
#endif
104+
#ifndef Z_CS_PIN
105+
#define Z_CS_PIN PC12
106+
#endif
107+
#ifndef E0_CS_PIN
108+
#define E0_CS_PIN PC14
109+
#endif
110110
#endif
111111

112-
// TMC2208 or TMC2209 on UART
113-
#if HAS_DRIVER(TMC2208) || HAS_DRIVER(TMC2209)
114-
115-
// UART Pins (Single pin for both RX & TX)
116-
#ifndef X_PIN_UART
117-
#define X_PIN_UART PC10
118-
#endif
119-
#ifndef Y_PIN_UART
120-
#define Y_PIN_UART PC11
121-
#endif
122-
#ifndef Z_PIN_UART
123-
#define Z_PIN_UART PC12
124-
#endif
125-
#ifndef E0_PIN_UART
126-
#define E0_PIN_UART PC14
127-
#endif
128-
129-
// Configurating Pins
130-
#define X_SERIAL_TX_PIN X_PIN_UART
131-
#define X_SERIAL_RX_PIN X_PIN_UART
132-
#define Y_SERIAL_TX_PIN Y_PIN_UART
133-
#define Y_SERIAL_RX_PIN Y_PIN_UART
134-
#define Z_SERIAL_TX_PIN Z_PIN_UART
135-
#define Z_SERIAL_RX_PIN Z_PIN_UART
136-
#define E0_SERIAL_TX_PIN E0_PIN_UART
137-
#define E0_SERIAL_RX_PIN E0_PIN_UART
112+
/**
113+
* TMC2208/TMC2209 stepper drivers
114+
*/
115+
#if HAS_TMC_UART
116+
#define X_SERIAL_TX_PIN PC10
117+
#define Y_SERIAL_TX_PIN PC11
118+
#define Z_SERIAL_TX_PIN PC12
119+
#define E0_SERIAL_TX_PIN PC14
138120
#endif
139121

140122
//
@@ -225,7 +207,7 @@
225207

226208
#define FORCE_SOFT_SPI // SPI MODE3
227209

228-
#define LED_PIN EXP1_05_PIN // red pwm
210+
#define LED_PIN EXP1_05_PIN // red pwm
229211
//#define LED_PIN EXP1_04_PIN // green
230212
//#define LED_PIN EXP1_03_PIN // blue
231213

Marlin/src/pins/stm32f1/pins_MKS_ROBIN.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@
232232
#endif
233233

234234
//
235-
// Trinamic TMC2208/2209 UART
235+
// Trinamic TMC2208/TMC2209 UART
236236
//
237237
#if HAS_TMC_UART
238238
/**

0 commit comments

Comments
 (0)