AP_ADSB: correct bad 16bit port read in ADSB drivers

This commit is contained in:
Tom Pittenger 2023-07-11 12:30:23 -07:00 committed by Andrew Tridgell
parent fbc66132e3
commit 0b13fa2c0f
3 changed files with 7 additions and 8 deletions

View File

@ -73,7 +73,7 @@ void AP_ADSB_Sagetech::update()
if (!_port->read(data)) {
break;
}
if (parse_byte_XP((uint8_t)data)) {
if (parse_byte_XP(data)) {
handle_packet_XP(message_in.packet);
}
} // while nbytes

View File

@ -78,11 +78,11 @@ void AP_ADSB_Sagetech_MXS::update()
// -----------------------------
uint32_t nbytes = MIN(_port->available(), 10 * PAYLOAD_MXS_MAX_SIZE);
while (nbytes-- > 0) {
const int16_t data = _port->read();
if (data < 0) {
uint8_t data;
if (!_port->read(data)) {
break;
}
parse_byte((uint8_t)data);
parse_byte(data);
}
const uint32_t now_ms = AP_HAL::millis();

View File

@ -76,12 +76,11 @@ void AP_ADSB_uAvionix_UCP::update()
// -----------------------------
uint32_t nbytes = MIN(_port->available(), 10UL * GDL90_RX_MAX_PACKET_LENGTH);
while (nbytes-- > 0) {
const int16_t data = (uint8_t)_port->read();
if (data < 0) {
uint8_t data;
if (!_port->read(data)) {
break;
}
if (parseByte((uint8_t)data, rx.msg, rx.status)) {
if (parseByte(data, rx.msg, rx.status)) {
rx.last_msg_ms = now_ms;
handle_msg(rx.msg);
}