DataFlash: log both airspeed sensors

This commit is contained in:
Andrew Tridgell 2017-11-03 17:37:40 +11:00
parent 8de2cebd78
commit b36911c47d
2 changed files with 23 additions and 14 deletions

View File

@ -1766,21 +1766,27 @@ void DataFlash_Class::Log_Write_ESC(void)
// Write a AIRSPEED packet
void DataFlash_Class::Log_Write_Airspeed(AP_Airspeed &airspeed)
{
float temperature;
if (!airspeed.get_temperature(temperature)) {
temperature = 0;
uint64_t now = AP_HAL::micros64();
for (uint8_t i=0; i<AIRSPEED_MAX_SENSORS; i++) {
if (!airspeed.enabled(i)) {
continue;
}
float temperature;
if (!airspeed.get_temperature(i, temperature)) {
temperature = 0;
}
struct log_AIRSPEED pkt = {
LOG_PACKET_HEADER_INIT(i==0?LOG_ARSP_MSG:LOG_ASP2_MSG),
time_us : now,
airspeed : airspeed.get_raw_airspeed(i),
diffpressure : airspeed.get_differential_pressure(i),
temperature : (int16_t)(temperature * 100.0f),
rawpressure : airspeed.get_corrected_pressure(i),
offset : airspeed.get_offset(i),
use : airspeed.use(i)
};
WriteBlock(&pkt, sizeof(pkt));
}
struct log_AIRSPEED pkt = {
LOG_PACKET_HEADER_INIT(LOG_ARSP_MSG),
time_us : AP_HAL::micros64(),
airspeed : airspeed.get_raw_airspeed(),
diffpressure : airspeed.get_differential_pressure(),
temperature : (int16_t)(temperature * 100.0f),
rawpressure : airspeed.get_corrected_pressure(),
offset : airspeed.get_offset(),
use : airspeed.use()
};
WriteBlock(&pkt, sizeof(pkt));
}
// Write a Yaw PID packet

View File

@ -981,6 +981,8 @@ Format characters in the format string for binary log messages
"TRIG", "QIHLLeeeccC","TimeUS,GPSTime,GPSWeek,Lat,Lng,Alt,RelAlt,GPSAlt,Roll,Pitch,Yaw" }, \
{ LOG_ARSP_MSG, sizeof(log_AIRSPEED), \
"ARSP", "QffcffB", "TimeUS,Airspeed,DiffPress,Temp,RawPress,Offset,U" }, \
{ LOG_ASP2_MSG, sizeof(log_AIRSPEED), \
"ASP2", "QffcffB", "TimeUS,Airspeed,DiffPress,Temp,RawPress,Offset,U" }, \
{ LOG_CURRENT_MSG, sizeof(log_Current), \
"BAT", CURR_FMT,CURR_LABELS }, \
{ LOG_CURRENT2_MSG, sizeof(log_Current), \
@ -1295,6 +1297,7 @@ enum LogMessages {
LOG_AOA_SSA_MSG,
LOG_BEACON_MSG,
LOG_PROXIMITY_MSG,
LOG_ASP2_MSG,
};
enum LogOriginType {