AP_Airspeed: handle INT16_MIN temperature for UAVCAN sensor

This commit is contained in:
Andrew Tridgell 2020-12-08 14:04:39 +11:00
parent 73fda4e6a7
commit 2d75ef4f60
1 changed files with 2 additions and 1 deletions

View File

@ -116,7 +116,8 @@ void AP_Airspeed_UAVCAN::handle_airspeed(AP_UAVCAN* ap_uavcan, uint8_t node_id,
if (driver != nullptr) { if (driver != nullptr) {
WITH_SEMAPHORE(driver->_sem_airspeed); WITH_SEMAPHORE(driver->_sem_airspeed);
driver->_pressure = cb.msg->differential_pressure; driver->_pressure = cb.msg->differential_pressure;
if (!isnan(cb.msg->static_air_temperature)) { if (!isnan(cb.msg->static_air_temperature) &&
cb.msg->static_air_temperature > 0) {
driver->_temperature = cb.msg->static_air_temperature - C_TO_KELVIN; driver->_temperature = cb.msg->static_air_temperature - C_TO_KELVIN;
driver->_have_temperature = true; driver->_have_temperature = true;
} }