From 14089d491920d5b132154b17bdafdbf6019b7f2a Mon Sep 17 00:00:00 2001 From: Peter Barker Date: Tue, 21 Feb 2023 20:35:57 +1100 Subject: [PATCH] AP_CANManager: add and use a "bool read(c)" method to AP_HAL this is much less likely to not work vs the int16_t equivalent --- libraries/AP_CANManager/AP_SLCANIface.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/AP_CANManager/AP_SLCANIface.cpp b/libraries/AP_CANManager/AP_SLCANIface.cpp index 62ccd0e44e..0656cece98 100644 --- a/libraries/AP_CANManager/AP_SLCANIface.cpp +++ b/libraries/AP_CANManager/AP_SLCANIface.cpp @@ -721,11 +721,11 @@ int16_t SLCAN::CANIface::receive(AP_HAL::CANFrame& out_frame, uint64_t& rx_time, uint32_t num_bytes = _port->available_locked(_serial_lock_key); // flush bytes from port while (num_bytes--) { - int16_t ret = _port->read_locked(_serial_lock_key); - if (ret < 0) { + uint8_t b; + if (!_port->read_locked(_serial_lock_key, b)) { break; } - addByte(ret); + addByte(b); if (!rx_queue_.space()) { break; }