Skip to content

Commit aef01bf

Browse files
committed
fix issue #6, stm32hwencoder is off by 1
1 parent aa8b5e3 commit aef01bf

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/encoders/stm32hwencoder/STM32HWEncoder.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ void STM32HWEncoder::init() {
124124
HAL_GPIO_Init(digitalPinToPort(_pinB), &gpio);
125125

126126
// set up timer for encoder
127-
encoder_handle.Init.Period = ticks_per_overflow;
127+
encoder_handle.Init.Period = ticks_per_overflow - 1;
128128
encoder_handle.Init.Prescaler = 0;
129129
encoder_handle.Init.ClockDivision = 0;
130130
encoder_handle.Init.CounterMode = TIM_COUNTERMODE_UP;

0 commit comments

Comments
 (0)