Skip to content

Commit

Permalink
Fix for "typo" blocking StealthChop mode for TMC2209 drivers when it …
Browse files Browse the repository at this point in the history
…should be for TMC2660. Ref. issue #17.
  • Loading branch information
terjeio committed Dec 26, 2024
1 parent 531fae8 commit ad0e4c1
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions trinamic.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,24 @@
#endif
#include "../trinamic/tmc2130hal.h"
#endif

#if TRINAMIC_ENABLE == 2209
#ifndef R_SENSE
#define R_SENSE 110
#endif
#ifdef TMC_STEALTHCHOP
#undef TMC_STEALTHCHOP
#endif
#define TMC_STEALTHCHOP 0 // not supported
#include "../trinamic/tmc2209hal.h"
#endif

#if TRINAMIC_ENABLE == 2660
#ifndef R_SENSE
#define R_SENSE 50
#endif
#ifndef TMC_STEALTHCHOP
#define TMC_STEALTHCHOP 0 // not supported
#endif
#include "../trinamic/tmc2660hal.h"
#endif

#if TRINAMIC_ENABLE == 5160
#ifndef R_SENSE
#define R_SENSE 75
Expand All @@ -83,18 +85,10 @@
#define PWM_THRESHOLD_VELOCITY 0 // mm/min - 0 to disable, should be set > homing seek rate when enabled (use M913 to set at run time)
#endif

#if PWM_THRESHOLD_VELOCITY > 0 && TRINAMIC_ENABLE == 2660
#error "TMC2660 does not support PWM_THRESHOLD_VELOCITY"
#endif

#ifndef TMC_STEALTHCHOP
#define TMC_STEALTHCHOP 0 // 0 = CoolStep, 1 = StealthChop
#endif

#if TMC_STEALTHCHOP > 0 && TRINAMIC_ENABLE == 2660
#error "TMC2660 does not support StealthChop mode"
#endif

#if TRINAMIC_ENABLE == 2209
#define TMC_STALLGUARD 4 // Do not change!
#else
Expand Down Expand Up @@ -131,7 +125,19 @@

//

// Sanity checks

#if TRINAMIC_ENABLE == 2660
#if PWM_THRESHOLD_VELOCITY > 0
#error "TMC2660 does not support PWM_THRESHOLD_VELOCITY"
#endif
#if TMC_STEALTHCHOP > 0
#error "TMC2660 does not support StealthChop mode"
#endif
#endif // TRINAMIC_ENABLE == 2660

// General

#if TRINAMIC_MIXED_DRIVERS
#ifndef TMC_X_ENABLE
#define TMC_X_ENABLE 0
Expand Down

0 comments on commit ad0e4c1

Please sign in to comment.