diff --git a/libraries/AP_Proximity/AP_Proximity_Cygbot_D1.cpp b/libraries/AP_Proximity/AP_Proximity_Cygbot_D1.cpp index 25a0ed8a81..5a81f3fe4a 100644 --- a/libraries/AP_Proximity/AP_Proximity_Cygbot_D1.cpp +++ b/libraries/AP_Proximity/AP_Proximity_Cygbot_D1.cpp @@ -43,7 +43,7 @@ void AP_Proximity_Cygbot_D1::read_sensor_data() { uint32_t nbytes = _uart->available(); while (nbytes-- > 0) { - uint8_t byte = _uart->read(); + int16_t byte = _uart->read(); if (!parse_byte(byte)) { // reset reset(); diff --git a/libraries/AP_Proximity/AP_Proximity_RPLidarA2.cpp b/libraries/AP_Proximity/AP_Proximity_RPLidarA2.cpp index 63d4c82230..ab3d1ad05a 100644 --- a/libraries/AP_Proximity/AP_Proximity_RPLidarA2.cpp +++ b/libraries/AP_Proximity/AP_Proximity_RPLidarA2.cpp @@ -163,7 +163,7 @@ void AP_Proximity_RPLidarA2::get_readings() while (nbytes-- > 0) { - uint8_t c = _uart->read(); + int16_t c = _uart->read(); Debug(2, "UART READ %x <%c>", c, c); //show HEX values STATE: diff --git a/libraries/AP_Proximity/AP_Proximity_TeraRangerTower.cpp b/libraries/AP_Proximity/AP_Proximity_TeraRangerTower.cpp index 3c7119726a..a5c2027c35 100644 --- a/libraries/AP_Proximity/AP_Proximity_TeraRangerTower.cpp +++ b/libraries/AP_Proximity/AP_Proximity_TeraRangerTower.cpp @@ -62,8 +62,11 @@ bool AP_Proximity_TeraRangerTower::read_sensor_data() int16_t nbytes = _uart->available(); while (nbytes-- > 0) { - char c = _uart->read(); - if (c == 'T' ) { + int16_t c = _uart->read(); + if (c==-1) { + return false; + } + if (char(c) == 'T' ) { buffer_count = 0; } diff --git a/libraries/AP_Proximity/AP_Proximity_TeraRangerTowerEvo.cpp b/libraries/AP_Proximity/AP_Proximity_TeraRangerTowerEvo.cpp index e9aceee786..db527417df 100644 --- a/libraries/AP_Proximity/AP_Proximity_TeraRangerTowerEvo.cpp +++ b/libraries/AP_Proximity/AP_Proximity_TeraRangerTowerEvo.cpp @@ -116,8 +116,11 @@ bool AP_Proximity_TeraRangerTowerEvo::read_sensor_data() } while (nbytes-- > 0) { - char c = _uart->read(); - if (c == 'T' ) { + int16_t c = _uart->read(); + if (c==-1) { + return false; + } + if (char(c) == 'T' ) { buffer_count = 0; } buffer[buffer_count++] = c;