diff --git a/Tools/AP_Periph/can.cpp b/Tools/AP_Periph/can.cpp index cfc5332526..1122b823bb 100644 --- a/Tools/AP_Periph/can.cpp +++ b/Tools/AP_Periph/can.cpp @@ -2400,8 +2400,6 @@ void AP_Periph_FW::can_airspeed_update(void) } uavcan_equipment_air_data_RawAirData pkt {}; - pkt.differential_pressure = press; - pkt.static_air_temperature = temp; // unfilled elements are NaN pkt.static_pressure = nanf(""); @@ -2409,6 +2407,21 @@ void AP_Periph_FW::can_airspeed_update(void) pkt.differential_pressure_sensor_temperature = nanf(""); pkt.pitot_temperature = nanf(""); + // populate the elements we have + pkt.differential_pressure = press; + pkt.static_air_temperature = temp; + + // if a Pitot tube temperature sensor is available, use it +#if AP_TEMPERATURE_SENSOR_ENABLED + for (uint8_t i=0; i