Skip to content

Commit 6026b4c

Browse files
committed
TMC4671 make ext enc timer ARR a define
1 parent ce15222 commit 6026b4c

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Firmware/FFBoard/UserExtensions/Inc/TMC4671.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,9 @@ extern TIM_HandleTypeDef TIM_TMC;
5353
#ifndef TMC4671_ITUNE_CUTOFF
5454
#define TMC4671_ITUNE_CUTOFF 0.04
5555
#endif
56-
56+
#ifndef TIM_TMC_ARR
57+
#define TIM_TMC_ARR 200
58+
#endif
5759

5860

5961
enum class TMC_ControlState : uint32_t {uninitialized,waitPower,Shutdown,Running,EncoderInit,EncoderFinished,HardError,OverTemp,IndexSearch,FullCalibration,ExternalEncoderInit,Pidautotune};

Firmware/FFBoard/UserExtensions/Src/TMC4671.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3131,7 +3131,7 @@ void TMC4671::setUpExtEncTimer(){
31313131
extEncUpdater = std::make_unique<TMC_ExternalEncoderUpdateThread>(this);
31323132
// Setup timer
31333133
this->externalEncoderTimer = &TIM_TMC;
3134-
this->externalEncoderTimer->Instance->ARR = 200; // 200 = 5khz = 5 tmc cycles, 250 = 4khz, 240 = 6 tmc cycles
3134+
this->externalEncoderTimer->Instance->ARR = TIM_TMC_ARR; // 200 = 5khz = 5 tmc cycles, 250 = 4khz, 240 = 6 tmc cycles
31353135
this->externalEncoderTimer->Instance->PSC = ((TIM_TMC_BCLK)/1000000) +1; // 1µs ticks
31363136
this->externalEncoderTimer->Instance->CR1 = 1;
31373137
HAL_TIM_Base_Start_IT(this->externalEncoderTimer);

0 commit comments

Comments
 (0)