Use rising edges for encoder checks

This seems to be more robust
This commit is contained in:
Jasper Blanckenburg 2023-03-17 14:30:56 +01:00
parent b47d71cf42
commit 98f4a1d0ad
1 changed files with 2 additions and 2 deletions

View File

@ -75,8 +75,8 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin) {
last_state[idx_a] = state_a;
last_state[idx_b] = state_b;
if (state_a == GPIO_PIN_RESET && state_b == GPIO_PIN_RESET) {
// Second falling edge, direction depends on which pin changed last
if (state_a == GPIO_PIN_SET && state_b == GPIO_PIN_SET) {
// Second rising edge, direction depends on which pin changed last
if (a_changed && b_changed) {
// This shouldn't happen. Ignore this event.
last_change[idx_a] = now;