Skip to content

Commit c8793c0

Browse files
🔧 SQUARE_WAVE_STEPPING => EDGE_STEPPING (MarlinFirmware#25526)
Co-Authored-By: Scott Lahteine <[email protected]>
1 parent a89ede6 commit c8793c0

File tree

7 files changed

+39
-38
lines changed

7 files changed

+39
-38
lines changed

Marlin/Configuration_adv.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,7 +3154,7 @@
31543154
*
31553155
* It is recommended to set HOMING_BUMP_MM to { 0, 0, 0 }.
31563156
*
3157-
* SPI_ENDSTOPS *** Beta feature! *** TMC2130/TMC5160 Only ***
3157+
* SPI_ENDSTOPS *** TMC2130/TMC5160 Only ***
31583158
* Poll the driver through SPI to determine load when homing.
31593159
* Removes the need for a wire from DIAG1 to an endstop pin.
31603160
*
@@ -3182,7 +3182,7 @@
31823182
//#define U_STALL_SENSITIVITY 8
31833183
//#define V_STALL_SENSITIVITY 8
31843184
//#define W_STALL_SENSITIVITY 8
3185-
//#define SPI_ENDSTOPS // TMC2130 only
3185+
//#define SPI_ENDSTOPS // TMC2130/TMC5160 only
31863186
//#define IMPROVE_HOMING_RELIABILITY
31873187
#endif
31883188

@@ -3201,10 +3201,9 @@
32013201
//#define TMC_HOME_PHASE { 896, 896, 896 }
32023202

32033203
/**
3204-
* Beta feature!
3205-
* Create a 50/50 square wave step pulse optimal for stepper drivers.
3204+
* Step on both rising and falling edge signals (as with a square wave).
32063205
*/
3207-
//#define SQUARE_WAVE_STEPPING
3206+
//#define EDGE_STEPPING
32083207

32093208
/**
32103209
* Enable M122 debugging command for TMC stepper drivers.

Marlin/src/inc/SanityCheck.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -678,6 +678,8 @@
678678
#error "INVERT_*_STEP_PIN true is now STEP_STATE_* LOW, and INVERT_*_STEP_PIN false is now STEP_STATE_* HIGH."
679679
#elif defined(PROBE_PT_1_X) || defined(PROBE_PT_1_Y) || defined(PROBE_PT_2_X) || defined(PROBE_PT_2_Y) || defined(PROBE_PT_3_X) || defined(PROBE_PT_3_Y)
680680
#error "PROBE_PT_[123]_[XY] is now defined using PROBE_PT_[123] with an array { x, y }."
681+
#elif defined(SQUARE_WAVE_STEPPING)
682+
#error "SQUARE_WAVE_STEPPING is now EDGE_STEPPING."
681683
#endif
682684

683685
// L64xx stepper drivers have been removed

Marlin/src/module/stepper/trinamic.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ enum StealthIndex : uint8_t {
227227
chopconf.intpol = interpolate;
228228
chopconf.hend = chop_init.hend + 3;
229229
chopconf.hstrt = chop_init.hstrt - 1;
230-
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
230+
TERN_(EDGE_STEPPING, chopconf.dedge = true);
231231
st.CHOPCONF(chopconf.sr);
232232

233233
st.rms_current(mA, hold_multiplier);
@@ -262,7 +262,7 @@ enum StealthIndex : uint8_t {
262262
chopconf.intpol = interpolate;
263263
chopconf.hend = chop_init.hend + 3;
264264
chopconf.hstrt = chop_init.hstrt - 1;
265-
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
265+
TERN_(EDGE_STEPPING, chopconf.dedge = true);
266266
st.CHOPCONF(chopconf.sr);
267267

268268
st.rms_current(mA, hold_multiplier);
@@ -684,7 +684,7 @@ enum StealthIndex : uint8_t {
684684
chopconf.intpol = interpolate;
685685
chopconf.hend = chop_init.hend + 3;
686686
chopconf.hstrt = chop_init.hstrt - 1;
687-
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
687+
TERN_(EDGE_STEPPING, chopconf.dedge = true);
688688
st.CHOPCONF(chopconf.sr);
689689

690690
st.rms_current(mA, hold_multiplier);
@@ -726,7 +726,7 @@ enum StealthIndex : uint8_t {
726726
chopconf.intpol = interpolate;
727727
chopconf.hend = chop_init.hend + 3;
728728
chopconf.hstrt = chop_init.hstrt - 1;
729-
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
729+
TERN_(EDGE_STEPPING, chopconf.dedge = true);
730730
st.CHOPCONF(chopconf.sr);
731731

732732
st.rms_current(mA, hold_multiplier);
@@ -766,7 +766,7 @@ enum StealthIndex : uint8_t {
766766
st.sdoff(0);
767767
st.rms_current(mA);
768768
st.microsteps(microsteps);
769-
TERN_(SQUARE_WAVE_STEPPING, st.dedge(true));
769+
TERN_(EDGE_STEPPING, st.dedge(true));
770770
st.intpol(interpolate);
771771
st.diss2g(true); // Disable short to ground protection. Too many false readings?
772772
TERN_(TMC_DEBUG, st.rdsel(0b01));
@@ -784,7 +784,7 @@ enum StealthIndex : uint8_t {
784784
chopconf.intpol = interpolate;
785785
chopconf.hend = chop_init.hend + 3;
786786
chopconf.hstrt = chop_init.hstrt - 1;
787-
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
787+
TERN_(EDGE_STEPPING, chopconf.dedge = true);
788788
st.CHOPCONF(chopconf.sr);
789789

790790
st.rms_current(mA, hold_multiplier);
@@ -819,7 +819,7 @@ enum StealthIndex : uint8_t {
819819
chopconf.intpol = interpolate;
820820
chopconf.hend = chop_init.hend + 3;
821821
chopconf.hstrt = chop_init.hstrt - 1;
822-
TERN_(SQUARE_WAVE_STEPPING, chopconf.dedge = true);
822+
TERN_(EDGE_STEPPING, chopconf.dedge = true);
823823
st.CHOPCONF(chopconf.sr);
824824

825825
st.rms_current(mA, hold_multiplier);

Marlin/src/module/stepper/trinamic.h

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
void restore_trinamic_drivers();
116116
void reset_trinamic_drivers();
117117

118-
#define AXIS_HAS_SQUARE_WAVE(A) (AXIS_IS_TMC(A) && ENABLED(SQUARE_WAVE_STEPPING))
118+
#define AXIS_HAS_DEDGE(A) (AXIS_IS_TMC(A) && ENABLED(EDGE_STEPPING))
119119

120120
// X Stepper
121121
#if AXIS_IS_TMC(X)
@@ -126,7 +126,7 @@ void reset_trinamic_drivers();
126126
#define X_ENABLE_WRITE(STATE) stepperX.toff((STATE)==X_ENABLE_ON ? chopper_timing_X.toff : 0)
127127
#define X_ENABLE_READ() stepperX.isEnabled()
128128
#endif
129-
#if AXIS_HAS_SQUARE_WAVE(X)
129+
#if AXIS_HAS_DEDGE(X)
130130
#define X_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X_STEP_PIN); }while(0)
131131
#endif
132132
#endif
@@ -140,7 +140,7 @@ void reset_trinamic_drivers();
140140
#define Y_ENABLE_WRITE(STATE) stepperY.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y.toff : 0)
141141
#define Y_ENABLE_READ() stepperY.isEnabled()
142142
#endif
143-
#if AXIS_HAS_SQUARE_WAVE(Y)
143+
#if AXIS_HAS_DEDGE(Y)
144144
#define Y_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y_STEP_PIN); }while(0)
145145
#endif
146146
#endif
@@ -154,7 +154,7 @@ void reset_trinamic_drivers();
154154
#define Z_ENABLE_WRITE(STATE) stepperZ.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z.toff : 0)
155155
#define Z_ENABLE_READ() stepperZ.isEnabled()
156156
#endif
157-
#if AXIS_HAS_SQUARE_WAVE(Z)
157+
#if AXIS_HAS_DEDGE(Z)
158158
#define Z_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z_STEP_PIN); }while(0)
159159
#endif
160160
#endif
@@ -171,7 +171,7 @@ void reset_trinamic_drivers();
171171
#define X2_ENABLE_WRITE(STATE) stepperX2.toff((STATE)==X_ENABLE_ON ? chopper_timing_X2.toff : 0)
172172
#define X2_ENABLE_READ() stepperX2.isEnabled()
173173
#endif
174-
#if AXIS_HAS_SQUARE_WAVE(X2)
174+
#if AXIS_HAS_DEDGE(X2)
175175
#define X2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(X2_STEP_PIN); }while(0)
176176
#endif
177177
#endif
@@ -188,7 +188,7 @@ void reset_trinamic_drivers();
188188
#define Y2_ENABLE_WRITE(STATE) stepperY2.toff((STATE)==Y_ENABLE_ON ? chopper_timing_Y2.toff : 0)
189189
#define Y2_ENABLE_READ() stepperY2.isEnabled()
190190
#endif
191-
#if AXIS_HAS_SQUARE_WAVE(Y2)
191+
#if AXIS_HAS_DEDGE(Y2)
192192
#define Y2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Y2_STEP_PIN); }while(0)
193193
#endif
194194
#endif
@@ -205,7 +205,7 @@ void reset_trinamic_drivers();
205205
#define Z2_ENABLE_WRITE(STATE) stepperZ2.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z2.toff : 0)
206206
#define Z2_ENABLE_READ() stepperZ2.isEnabled()
207207
#endif
208-
#if AXIS_HAS_SQUARE_WAVE(Z2)
208+
#if AXIS_HAS_DEDGE(Z2)
209209
#define Z2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z2_STEP_PIN); }while(0)
210210
#endif
211211
#endif
@@ -222,7 +222,7 @@ void reset_trinamic_drivers();
222222
#define Z3_ENABLE_WRITE(STATE) stepperZ3.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z3.toff : 0)
223223
#define Z3_ENABLE_READ() stepperZ3.isEnabled()
224224
#endif
225-
#if AXIS_HAS_SQUARE_WAVE(Z3)
225+
#if AXIS_HAS_DEDGE(Z3)
226226
#define Z3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z3_STEP_PIN); }while(0)
227227
#endif
228228
#endif
@@ -239,7 +239,7 @@ void reset_trinamic_drivers();
239239
#define Z4_ENABLE_WRITE(STATE) stepperZ4.toff((STATE)==Z_ENABLE_ON ? chopper_timing_Z4.toff : 0)
240240
#define Z4_ENABLE_READ() stepperZ4.isEnabled()
241241
#endif
242-
#if AXIS_HAS_SQUARE_WAVE(Z4)
242+
#if AXIS_HAS_DEDGE(Z4)
243243
#define Z4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(Z4_STEP_PIN); }while(0)
244244
#endif
245245
#endif
@@ -253,7 +253,7 @@ void reset_trinamic_drivers();
253253
#define I_ENABLE_WRITE(STATE) stepperI.toff((STATE)==I_ENABLE_ON ? chopper_timing.toff : 0)
254254
#define I_ENABLE_READ() stepperI.isEnabled()
255255
#endif
256-
#if AXIS_HAS_SQUARE_WAVE(I)
256+
#if AXIS_HAS_DEDGE(I)
257257
#define I_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(I_STEP_PIN); }while(0)
258258
#endif
259259
#endif
@@ -267,7 +267,7 @@ void reset_trinamic_drivers();
267267
#define J_ENABLE_WRITE(STATE) stepperJ.toff((STATE)==J_ENABLE_ON ? chopper_timing.toff : 0)
268268
#define J_ENABLE_READ() stepperJ.isEnabled()
269269
#endif
270-
#if AXIS_HAS_SQUARE_WAVE(J)
270+
#if AXIS_HAS_DEDGE(J)
271271
#define J_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(J_STEP_PIN); }while(0)
272272
#endif
273273
#endif
@@ -281,7 +281,7 @@ void reset_trinamic_drivers();
281281
#define K_ENABLE_WRITE(STATE) stepperK.toff((STATE)==K_ENABLE_ON ? chopper_timing.toff : 0)
282282
#define K_ENABLE_READ() stepperK.isEnabled()
283283
#endif
284-
#if AXIS_HAS_SQUARE_WAVE(K)
284+
#if AXIS_HAS_DEDGE(K)
285285
#define K_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(K_STEP_PIN); }while(0)
286286
#endif
287287
#endif
@@ -295,7 +295,7 @@ void reset_trinamic_drivers();
295295
#define U_ENABLE_WRITE(STATE) stepperU.toff((STATE)==U_ENABLE_ON ? chopper_timing_U.toff : 0)
296296
#define U_ENABLE_READ() stepperU.isEnabled()
297297
#endif
298-
#if AXIS_HAS_SQUARE_WAVE(U)
298+
#if AXIS_HAS_DEDGE(U)
299299
#define U_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(U_STEP_PIN); }while(0)
300300
#endif
301301
#endif
@@ -309,7 +309,7 @@ void reset_trinamic_drivers();
309309
#define V_ENABLE_WRITE(STATE) stepperV.toff((STATE)==V_ENABLE_ON ? chopper_timing_V.toff : 0)
310310
#define V_ENABLE_READ() stepperV.isEnabled()
311311
#endif
312-
#if AXIS_HAS_SQUARE_WAVE(V)
312+
#if AXIS_HAS_DEDGE(V)
313313
#define V_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(V_STEP_PIN); }while(0)
314314
#endif
315315
#endif
@@ -323,7 +323,7 @@ void reset_trinamic_drivers();
323323
#define W_ENABLE_WRITE(STATE) stepperW.toff((STATE)==W_ENABLE_ON ? chopper_timing_W.toff : 0)
324324
#define W_ENABLE_READ() stepperW.isEnabled()
325325
#endif
326-
#if AXIS_HAS_SQUARE_WAVE(W)
326+
#if AXIS_HAS_DEDGE(W)
327327
#define W_STEP_WRITE(STATE) do{ if(STATE) TOGGLE(W_STEP_PIN); }while(0)
328328
#endif
329329
#endif
@@ -340,7 +340,7 @@ void reset_trinamic_drivers();
340340
#define E0_ENABLE_WRITE(STATE) stepperE0.toff((STATE)==E_ENABLE_ON ? chopper_timing_E0.toff : 0)
341341
#define E0_ENABLE_READ() stepperE0.isEnabled()
342342
#endif
343-
#if AXIS_HAS_SQUARE_WAVE(E0)
343+
#if AXIS_HAS_DEDGE(E0)
344344
#define E0_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E0_STEP_PIN); }while(0)
345345
#endif
346346
#endif
@@ -357,7 +357,7 @@ void reset_trinamic_drivers();
357357
#define E1_ENABLE_WRITE(STATE) stepperE1.toff((STATE)==E_ENABLE_ON ? chopper_timing_E1.toff : 0)
358358
#define E1_ENABLE_READ() stepperE1.isEnabled()
359359
#endif
360-
#if AXIS_HAS_SQUARE_WAVE(E1)
360+
#if AXIS_HAS_DEDGE(E1)
361361
#define E1_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E1_STEP_PIN); }while(0)
362362
#endif
363363
#endif
@@ -374,7 +374,7 @@ void reset_trinamic_drivers();
374374
#define E2_ENABLE_WRITE(STATE) stepperE2.toff((STATE)==E_ENABLE_ON ? chopper_timing_E2.toff : 0)
375375
#define E2_ENABLE_READ() stepperE2.isEnabled()
376376
#endif
377-
#if AXIS_HAS_SQUARE_WAVE(E2)
377+
#if AXIS_HAS_DEDGE(E2)
378378
#define E2_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E2_STEP_PIN); }while(0)
379379
#endif
380380
#endif
@@ -391,7 +391,7 @@ void reset_trinamic_drivers();
391391
#define E3_ENABLE_WRITE(STATE) stepperE3.toff((STATE)==E_ENABLE_ON ? chopper_timing_E3.toff : 0)
392392
#define E3_ENABLE_READ() stepperE3.isEnabled()
393393
#endif
394-
#if AXIS_HAS_SQUARE_WAVE(E3)
394+
#if AXIS_HAS_DEDGE(E3)
395395
#define E3_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E3_STEP_PIN); }while(0)
396396
#endif
397397
#endif
@@ -408,7 +408,7 @@ void reset_trinamic_drivers();
408408
#define E4_ENABLE_WRITE(STATE) stepperE4.toff((STATE)==E_ENABLE_ON ? chopper_timing_E4.toff : 0)
409409
#define E4_ENABLE_READ() stepperE4.isEnabled()
410410
#endif
411-
#if AXIS_HAS_SQUARE_WAVE(E4)
411+
#if AXIS_HAS_DEDGE(E4)
412412
#define E4_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E4_STEP_PIN); }while(0)
413413
#endif
414414
#endif
@@ -425,7 +425,7 @@ void reset_trinamic_drivers();
425425
#define E5_ENABLE_WRITE(STATE) stepperE5.toff((STATE)==E_ENABLE_ON ? chopper_timing_E5.toff : 0)
426426
#define E5_ENABLE_READ() stepperE5.isEnabled()
427427
#endif
428-
#if AXIS_HAS_SQUARE_WAVE(E5)
428+
#if AXIS_HAS_DEDGE(E5)
429429
#define E5_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E5_STEP_PIN); }while(0)
430430
#endif
431431
#endif
@@ -442,7 +442,7 @@ void reset_trinamic_drivers();
442442
#define E6_ENABLE_WRITE(STATE) stepperE6.toff((STATE)==E_ENABLE_ON ? chopper_timing_E6.toff : 0)
443443
#define E6_ENABLE_READ() stepperE6.isEnabled()
444444
#endif
445-
#if AXIS_HAS_SQUARE_WAVE(E6)
445+
#if AXIS_HAS_DEDGE(E6)
446446
#define E6_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E6_STEP_PIN); }while(0)
447447
#endif
448448
#endif
@@ -459,7 +459,7 @@ void reset_trinamic_drivers();
459459
#define E7_ENABLE_WRITE(STATE) stepperE7.toff((STATE)==E_ENABLE_ON ? chopper_timing_E7.toff : 0)
460460
#define E7_ENABLE_READ() stepperE7.isEnabled()
461461
#endif
462-
#if AXIS_HAS_SQUARE_WAVE(E7)
462+
#if AXIS_HAS_DEDGE(E7)
463463
#define E7_STEP_WRITE(STATE) do{ if (STATE) TOGGLE(E7_STEP_PIN); }while(0)
464464
#endif
465465
#endif

buildroot/tests/FYSETC_F6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ opt_set MOTHERBOARD BOARD_FYSETC_F6_13 \
6464
X_HARDWARE_SERIAL Serial2
6565
opt_enable USE_ZMIN_PLUG FIX_MOUNTED_PROBE AUTO_BED_LEVELING_BILINEAR PAUSE_BEFORE_DEPLOY_STOW \
6666
FYSETC_242_OLED_12864 EEPROM_SETTINGS EEPROM_CHITCHAT M114_DETAIL Z_SAFE_HOMING \
67-
STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING SQUARE_WAVE_STEPPING
67+
STEALTHCHOP_XY STEALTHCHOP_Z STEALTHCHOP_E HYBRID_THRESHOLD SENSORLESS_HOMING EDGE_STEPPING
6868
exec_test $1 $2 "FYSETC_F6 | SCARA | Mixed TMC | EEPROM" "$3"
6969

7070
# clean up

buildroot/tests/SAMD21_minitronics20

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE BLTOUCH Z_MIN_PROBE_REPEATABILITY_TEST \
2626
SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
2727
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \
2828
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
29-
SQUARE_WAVE_STEPPING
29+
EDGE_STEPPING
3030
exec_test $1 $2 "Minitronics 2.0 with assorted features" "$3"
3131

3232
# clean up

buildroot/tests/SAMD51_grandcentral_m4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ opt_enable ENDSTOP_INTERRUPTS_FEATURE S_CURVE_ACCELERATION BLTOUCH Z_MIN_PROBE_R
2626
SCROLL_LONG_FILENAMES BABYSTEPPING DOUBLECLICK_FOR_Z_BABYSTEPPING \
2727
MOVE_Z_WHEN_IDLE BABYSTEP_ZPROBE_OFFSET BABYSTEP_GFX_OVERLAY \
2828
LIN_ADVANCE ADVANCED_PAUSE_FEATURE PARK_HEAD_ON_PAUSE MONITOR_DRIVER_STATUS SENSORLESS_HOMING \
29-
SQUARE_WAVE_STEPPING TMC_DEBUG
29+
EDGE_STEPPING TMC_DEBUG
3030
exec_test $1 $2 "Grand Central M4 with assorted features" "$3"
3131

3232
# clean up

0 commit comments

Comments
 (0)