From a073469423cdb2afdd82edb26a76e7d4feb84b07 Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Sat, 23 May 2020 10:24:32 +1000 Subject: [PATCH] AP_BLHeli: use new UARTDriver discard_input method --- libraries/AP_BLHeli/AP_BLHeli.cpp | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/libraries/AP_BLHeli/AP_BLHeli.cpp b/libraries/AP_BLHeli/AP_BLHeli.cpp index 024d44de2d..126fca5f73 100644 --- a/libraries/AP_BLHeli/AP_BLHeli.cpp +++ b/libraries/AP_BLHeli/AP_BLHeli.cpp @@ -1447,9 +1447,7 @@ void AP_BLHeli::update_telemetry(void) if (nbytes > telem_packet_size) { // if we have more than 10 bytes then we don't know which ESC // they are from. Throw them all away - while (nbytes--) { - telem_uart->read(); - } + telem_uart->discard_input(); return; } if (nbytes > 0 && @@ -1464,9 +1462,7 @@ void AP_BLHeli::update_telemetry(void) } if (nbytes > 0 && nbytes < telem_packet_size) { // we've waited long enough, discard bytes if we don't have 10 yet - while (nbytes--) { - telem_uart->read(); - } + telem_uart->discard_input(); return; } if (nbytes == telem_packet_size) {