diff --git a/src/main/drivers/stm32/serial_uart_hal.c b/src/main/drivers/stm32/serial_uart_hal.c index 136ececcb00..decb35a0878 100644 --- a/src/main/drivers/stm32/serial_uart_hal.c +++ b/src/main/drivers/stm32/serial_uart_hal.c @@ -264,10 +264,9 @@ bool checkUsartTxOutput(uartPort_t *s) void uartTxMonitor(uartPort_t *s) { uartDevice_t *uart = container_of(s, uartDevice_t, port); + IO_t txIO = IOGetByTag(uart->tx.pin); if (uart->txPinState == TX_PIN_ACTIVE) { - IO_t txIO = IOGetByTag(uart->tx.pin); - // Switch TX to an input with pullup so it's state can be monitored uart->txPinState = TX_PIN_MONITOR; IOConfigGPIO(txIO, IOCFG_IPU);