diff --git a/libraries/AP_WheelEncoder/WheelEncoder_Quadrature.cpp b/libraries/AP_WheelEncoder/WheelEncoder_Quadrature.cpp index 20ed2576ce..4b03289fc1 100644 --- a/libraries/AP_WheelEncoder/WheelEncoder_Quadrature.cpp +++ b/libraries/AP_WheelEncoder/WheelEncoder_Quadrature.cpp @@ -48,6 +48,7 @@ void AP_WheelEncoder_Quadrature::update_pin(uint8_t &pin, // install interrupt handler on rising or falling edge of gpio for pin a if (new_pin != (uint8_t)-1) { + hal.gpio->pinMode(pin, HAL_GPIO_INPUT); if (!hal.gpio->attach_interrupt( pin, FUNCTOR_BIND_MEMBER(&AP_WheelEncoder_Quadrature::irq_handler,