Use rising edges for encoder checks
This seems to be more robust
This commit is contained in:
parent
b47d71cf42
commit
98f4a1d0ad
|
@ -75,8 +75,8 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
|
||||||
last_state[idx_a] = state_a;
|
last_state[idx_a] = state_a;
|
||||||
last_state[idx_b] = state_b;
|
last_state[idx_b] = state_b;
|
||||||
|
|
||||||
if (state_a == GPIO_PIN_RESET && state_b == GPIO_PIN_RESET) {
|
if (state_a == GPIO_PIN_SET && state_b == GPIO_PIN_SET) {
|
||||||
// Second falling edge, direction depends on which pin changed last
|
// Second rising edge, direction depends on which pin changed last
|
||||||
if (a_changed && b_changed) {
|
if (a_changed && b_changed) {
|
||||||
// This shouldn't happen. Ignore this event.
|
// This shouldn't happen. Ignore this event.
|
||||||
last_change[idx_a] = now;
|
last_change[idx_a] = now;
|
||||||
|
|
Loading…
Reference in New Issue