From b6f3db44d8f7cdb9aaa7cc8420f2c84ac08c4410 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 3 Nov 2017 21:28:20 +1100 Subject: [PATCH] DataFlash: log health and primary for airspeed --- libraries/DataFlash/LogFile.cpp | 4 +++- libraries/DataFlash/LogStructure.h | 13 +++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/libraries/DataFlash/LogFile.cpp b/libraries/DataFlash/LogFile.cpp index f17d831291..75dc3f91c9 100644 --- a/libraries/DataFlash/LogFile.cpp +++ b/libraries/DataFlash/LogFile.cpp @@ -1721,7 +1721,9 @@ void DataFlash_Class::Log_Write_Airspeed(AP_Airspeed &airspeed) temperature : (int16_t)(temperature * 100.0f), rawpressure : airspeed.get_corrected_pressure(i), offset : airspeed.get_offset(i), - use : airspeed.use(i) + use : airspeed.use(i), + healthy : airspeed.healthy(i), + primary : airspeed.get_primary() }; WriteBlock(&pkt, sizeof(pkt)); } diff --git a/libraries/DataFlash/LogStructure.h b/libraries/DataFlash/LogStructure.h index 7996b979c2..0fa6ab19c0 100644 --- a/libraries/DataFlash/LogStructure.h +++ b/libraries/DataFlash/LogStructure.h @@ -828,6 +828,8 @@ struct PACKED log_AIRSPEED { float rawpressure; float offset; bool use; + bool healthy; + uint8_t primary; }; struct PACKED log_ACCEL { @@ -1116,6 +1118,11 @@ struct PACKED log_DSTL { #define CURR_CELL_UNITS "svvvvvvvvvvv" #define CURR_CELL_MULTS "F00000000000" +#define ARSP_LABELS "TimeUS,Airspeed,DiffPress,Temp,RawPress,Offset,U,Health,Primary" +#define ARSP_FMT "QffcffBBB" +#define ARSP_UNITS "snPOPP---" +#define ARSP_MULTS "F00B00---" + /* Format characters in the format string for binary log messages a : int16_t[32] @@ -1186,10 +1193,8 @@ Format characters in the format string for binary log messages "CAM", "QIHLLeeeccC","TimeUS,GPSTime,GPSWeek,Lat,Lng,Alt,RelAlt,GPSAlt,Roll,Pitch,Yaw", "s--DUmmmddd", "F--GGBBBBBB" }, \ { LOG_TRIGGER_MSG, sizeof(log_Camera), \ "TRIG", "QIHLLeeeccC","TimeUS,GPSTime,GPSWeek,Lat,Lng,Alt,RelAlt,GPSAlt,Roll,Pitch,Yaw", "s--DUmmmddd", "F--GGBBBBBB" }, \ - { LOG_ARSP_MSG, sizeof(log_AIRSPEED), \ - "ARSP", "QffcffB", "TimeUS,Airspeed,DiffPress,Temp,RawPress,Offset,U", "snPOPP-", "F00B00-" }, \ - { LOG_ASP2_MSG, sizeof(log_AIRSPEED), \ - "ASP2", "QffcffB", "TimeUS,Airspeed,DiffPress,Temp,RawPress,Offset,U", "snPOPP-", "F00B00-" }, \ + { LOG_ARSP_MSG, sizeof(log_AIRSPEED), "ARSP", ARSP_FMT, ARSP_LABELS, ARSP_UNITS, ARSP_MULTS }, \ + { LOG_ASP2_MSG, sizeof(log_AIRSPEED), "ASP2", ARSP_FMT, ARSP_LABELS, ARSP_UNITS, ARSP_MULTS }, \ { LOG_CURRENT_MSG, sizeof(log_Current), \ "BAT", CURR_FMT,CURR_LABELS,CURR_UNITS,CURR_MULTS }, \ { LOG_CURRENT2_MSG, sizeof(log_Current), \