2013-01-12 02:21:04 -04:00
|
|
|
/// -*- tab-width: 4; Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil -*-
|
|
|
|
|
2011-11-12 23:29:07 -04:00
|
|
|
/* ************************************************************ */
|
|
|
|
/* Test for DataFlash Log library */
|
|
|
|
/* ************************************************************ */
|
|
|
|
#ifndef DataFlash_h
|
|
|
|
#define DataFlash_h
|
|
|
|
|
2013-04-19 04:49:16 -03:00
|
|
|
#include <AP_Common.h>
|
|
|
|
#include <AP_Param.h>
|
|
|
|
#include <AP_GPS.h>
|
|
|
|
#include <AP_InertialSensor.h>
|
2014-01-27 19:35:18 -04:00
|
|
|
#include <AP_Baro.h>
|
2014-01-03 01:01:08 -04:00
|
|
|
#include <AP_AHRS.h>
|
2011-11-12 23:29:07 -04:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2014-11-20 23:48:44 -04:00
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
2014-11-13 06:38:33 -04:00
|
|
|
#include <uORB/topics/esc_status.h>
|
2014-11-20 23:48:44 -04:00
|
|
|
#endif
|
2014-11-13 06:38:33 -04:00
|
|
|
|
|
|
|
|
2014-08-01 02:57:15 -03:00
|
|
|
#if HAL_CPU_CLASS < HAL_CPU_CLASS_75 && defined(APM_BUILD_DIRECTORY)
|
|
|
|
#if (APM_BUILD_TYPE(APM_BUILD_ArduCopter) || defined(__AVR_ATmega1280__))
|
|
|
|
#define DATAFLASH_NO_CLI
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
|
2011-11-12 23:29:07 -04:00
|
|
|
class DataFlash_Class
|
|
|
|
{
|
2013-02-22 20:17:34 -04:00
|
|
|
public:
|
|
|
|
// initialisation
|
2013-12-16 20:12:42 -04:00
|
|
|
virtual void Init(const struct LogStructure *structure, uint8_t num_types);
|
2013-02-22 20:17:34 -04:00
|
|
|
virtual bool CardInserted(void) = 0;
|
|
|
|
|
|
|
|
// erase handling
|
2013-02-23 03:52:30 -04:00
|
|
|
virtual bool NeedErase(void) = 0;
|
|
|
|
virtual void EraseAll() = 0;
|
2013-02-22 20:17:34 -04:00
|
|
|
|
|
|
|
/* Write a block of data at current offset */
|
2013-02-23 03:52:30 -04:00
|
|
|
virtual void WriteBlock(const void *pBuffer, uint16_t size) = 0;
|
2013-02-22 20:17:34 -04:00
|
|
|
|
|
|
|
// high level interface
|
2013-02-23 03:52:30 -04:00
|
|
|
virtual uint16_t find_last_log(void) = 0;
|
2013-04-17 08:32:53 -03:00
|
|
|
virtual void get_log_boundaries(uint16_t log_num, uint16_t & start_page, uint16_t & end_page) = 0;
|
2013-12-15 03:57:49 -04:00
|
|
|
virtual void get_log_info(uint16_t log_num, uint32_t &size, uint32_t &time_utc) = 0;
|
|
|
|
virtual int16_t get_log_data(uint16_t log_num, uint16_t page, uint32_t offset, uint16_t len, uint8_t *data) = 0;
|
2013-04-17 08:32:53 -03:00
|
|
|
virtual uint16_t get_num_logs(void) = 0;
|
2014-08-01 02:57:15 -03:00
|
|
|
#ifndef DATAFLASH_NO_CLI
|
2013-04-19 04:49:16 -03:00
|
|
|
virtual void LogReadProcess(uint16_t log_num,
|
|
|
|
uint16_t start_page, uint16_t end_page,
|
2013-04-20 02:17:49 -03:00
|
|
|
void (*printMode)(AP_HAL::BetterStream *port, uint8_t mode),
|
2013-04-19 04:49:16 -03:00
|
|
|
AP_HAL::BetterStream *port) = 0;
|
2013-02-23 03:52:30 -04:00
|
|
|
virtual void DumpPageInfo(AP_HAL::BetterStream *port) = 0;
|
|
|
|
virtual void ShowDeviceInfo(AP_HAL::BetterStream *port) = 0;
|
2013-04-17 08:32:53 -03:00
|
|
|
virtual void ListAvailableLogs(AP_HAL::BetterStream *port) = 0;
|
2014-08-01 02:57:15 -03:00
|
|
|
#endif // DATAFLASH_NO_CLI
|
2013-02-22 20:17:34 -04:00
|
|
|
|
2013-04-19 04:49:16 -03:00
|
|
|
/* logging methods common to all vehicles */
|
2013-12-16 20:12:42 -04:00
|
|
|
uint16_t StartNewLog(void);
|
2014-03-23 22:03:31 -03:00
|
|
|
void AddLogFormats(const struct LogStructure *structures, uint8_t num_types);
|
2014-01-07 09:36:47 -04:00
|
|
|
void EnableWrites(bool enable) { _writes_enabled = enable; }
|
2013-04-19 10:19:16 -03:00
|
|
|
void Log_Write_Format(const struct LogStructure *structure);
|
2013-04-19 04:49:16 -03:00
|
|
|
void Log_Write_Parameter(const char *name, float value);
|
2014-04-09 21:29:30 -03:00
|
|
|
void Log_Write_GPS(const AP_GPS &gps, uint8_t instance, int32_t relative_alt);
|
2013-11-03 23:36:14 -04:00
|
|
|
void Log_Write_IMU(const AP_InertialSensor &ins);
|
2013-11-25 17:44:00 -04:00
|
|
|
void Log_Write_RCIN(void);
|
2013-11-27 07:14:17 -04:00
|
|
|
void Log_Write_RCOUT(void);
|
2014-01-27 19:35:18 -04:00
|
|
|
void Log_Write_Baro(AP_Baro &baro);
|
2014-02-13 07:07:32 -04:00
|
|
|
void Log_Write_Power(void);
|
2014-01-03 01:01:08 -04:00
|
|
|
void Log_Write_AHRS2(AP_AHRS &ahrs);
|
2014-01-03 20:51:22 -04:00
|
|
|
#if AP_AHRS_NAVEKF_AVAILABLE
|
|
|
|
void Log_Write_EKF(AP_AHRS_NavEKF &ahrs);
|
|
|
|
#endif
|
2014-03-16 05:40:30 -03:00
|
|
|
void Log_Write_MavCmd(uint16_t cmd_total, const mavlink_mission_item_t& mav_cmd);
|
2014-03-11 14:05:02 -03:00
|
|
|
void Log_Write_Radio(const mavlink_radio_t &packet);
|
2013-05-02 20:18:14 -03:00
|
|
|
void Log_Write_Message(const char *message);
|
|
|
|
void Log_Write_Message_P(const prog_char_t *message);
|
2014-06-10 23:55:04 -03:00
|
|
|
void Log_Write_Camera(const AP_AHRS &ahrs, const AP_GPS &gps, const Location ¤t_loc);
|
2014-11-13 06:38:33 -04:00
|
|
|
void Log_Write_ESC(void);
|
2013-04-19 04:49:16 -03:00
|
|
|
|
2014-01-13 22:51:06 -04:00
|
|
|
bool logging_started(void) const { return log_write_started; }
|
|
|
|
|
2013-02-22 20:17:34 -04:00
|
|
|
/*
|
|
|
|
every logged packet starts with 3 bytes
|
|
|
|
*/
|
|
|
|
struct log_Header {
|
|
|
|
uint8_t head1, head2, msgid;
|
|
|
|
};
|
2013-04-19 04:49:16 -03:00
|
|
|
|
|
|
|
protected:
|
|
|
|
/*
|
|
|
|
read and print a log entry using the format strings from the given structure
|
|
|
|
*/
|
|
|
|
void _print_log_entry(uint8_t msg_type,
|
2013-04-20 02:17:49 -03:00
|
|
|
void (*print_mode)(AP_HAL::BetterStream *port, uint8_t mode),
|
2013-04-19 04:49:16 -03:00
|
|
|
AP_HAL::BetterStream *port);
|
|
|
|
|
2013-12-16 20:12:42 -04:00
|
|
|
void Log_Fill_Format(const struct LogStructure *structure, struct log_Format &pkt);
|
2013-04-19 04:49:16 -03:00
|
|
|
void Log_Write_Parameter(const AP_Param *ap, const AP_Param::ParamToken &token,
|
|
|
|
enum ap_var_type type);
|
|
|
|
void Log_Write_Parameters(void);
|
2013-04-19 21:25:10 -03:00
|
|
|
virtual uint16_t start_new_log(void) = 0;
|
|
|
|
|
2013-12-16 20:12:42 -04:00
|
|
|
const struct LogStructure *_structures;
|
|
|
|
uint8_t _num_types;
|
2014-01-07 09:36:47 -04:00
|
|
|
bool _writes_enabled;
|
2014-01-13 22:51:06 -04:00
|
|
|
bool log_write_started;
|
2013-12-16 20:12:42 -04:00
|
|
|
|
2013-04-19 21:25:10 -03:00
|
|
|
/*
|
|
|
|
read a block
|
|
|
|
*/
|
|
|
|
virtual void ReadBlock(void *pkt, uint16_t size) = 0;
|
|
|
|
|
2011-11-12 23:29:07 -04:00
|
|
|
};
|
|
|
|
|
2013-01-12 07:16:15 -04:00
|
|
|
/*
|
|
|
|
unfortunately these need to be macros because of a limitation of
|
|
|
|
named member structure initialisation in g++
|
|
|
|
*/
|
|
|
|
#define LOG_PACKET_HEADER uint8_t head1, head2, msgid;
|
|
|
|
#define LOG_PACKET_HEADER_INIT(id) head1 : HEAD_BYTE1, head2 : HEAD_BYTE2, msgid : id
|
|
|
|
|
|
|
|
// once the logging code is all converted we will remove these from
|
|
|
|
// this header
|
|
|
|
#define HEAD_BYTE1 0xA3 // Decimal 163
|
|
|
|
#define HEAD_BYTE2 0x95 // Decimal 149
|
|
|
|
|
2013-04-19 04:49:16 -03:00
|
|
|
/*
|
|
|
|
Format characters in the format string for binary log messages
|
|
|
|
b : int8_t
|
|
|
|
B : uint8_t
|
|
|
|
h : int16_t
|
|
|
|
H : uint16_t
|
|
|
|
i : int32_t
|
|
|
|
I : uint32_t
|
|
|
|
f : float
|
2013-04-19 10:19:16 -03:00
|
|
|
n : char[4]
|
2013-04-19 04:49:16 -03:00
|
|
|
N : char[16]
|
2013-04-23 06:46:22 -03:00
|
|
|
Z : char[64]
|
2013-04-19 04:49:16 -03:00
|
|
|
c : int16_t * 100
|
|
|
|
C : uint16_t * 100
|
|
|
|
e : int32_t * 100
|
|
|
|
E : uint32_t * 100
|
2013-04-19 20:50:13 -03:00
|
|
|
L : int32_t latitude/longitude
|
2013-04-20 02:17:49 -03:00
|
|
|
M : uint8_t flight mode
|
2013-04-19 04:49:16 -03:00
|
|
|
*/
|
|
|
|
|
|
|
|
// structure used to define logging format
|
|
|
|
struct LogStructure {
|
|
|
|
uint8_t msg_type;
|
|
|
|
uint8_t msg_len;
|
|
|
|
const char name[5];
|
|
|
|
const char format[16];
|
|
|
|
const char labels[64];
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
log structures common to all vehicle types
|
|
|
|
*/
|
2013-04-19 10:19:16 -03:00
|
|
|
struct PACKED log_Format {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint8_t type;
|
|
|
|
uint8_t length;
|
|
|
|
char name[4];
|
|
|
|
char format[16];
|
2013-04-23 06:46:22 -03:00
|
|
|
char labels[64];
|
2013-04-19 10:19:16 -03:00
|
|
|
};
|
|
|
|
|
2013-04-19 04:49:16 -03:00
|
|
|
struct PACKED log_Parameter {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
char name[16];
|
|
|
|
float value;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct PACKED log_GPS {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint8_t status;
|
2013-10-23 08:14:48 -03:00
|
|
|
uint32_t gps_week_ms;
|
|
|
|
uint16_t gps_week;
|
2013-04-19 04:49:16 -03:00
|
|
|
uint8_t num_sats;
|
2014-04-01 17:49:39 -03:00
|
|
|
uint16_t hdop;
|
2013-04-19 04:49:16 -03:00
|
|
|
int32_t latitude;
|
|
|
|
int32_t longitude;
|
|
|
|
int32_t rel_altitude;
|
|
|
|
int32_t altitude;
|
|
|
|
uint32_t ground_speed;
|
|
|
|
int32_t ground_course;
|
2013-11-04 01:56:55 -04:00
|
|
|
float vel_z;
|
2013-11-04 06:37:10 -04:00
|
|
|
uint32_t apm_time;
|
2013-04-19 04:49:16 -03:00
|
|
|
};
|
|
|
|
|
2013-12-21 07:24:51 -04:00
|
|
|
struct PACKED log_GPS2 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint8_t status;
|
|
|
|
uint32_t gps_week_ms;
|
|
|
|
uint16_t gps_week;
|
|
|
|
uint8_t num_sats;
|
2014-04-01 17:49:39 -03:00
|
|
|
uint16_t hdop;
|
2013-12-21 07:24:51 -04:00
|
|
|
int32_t latitude;
|
|
|
|
int32_t longitude;
|
|
|
|
int32_t altitude;
|
|
|
|
uint32_t ground_speed;
|
|
|
|
int32_t ground_course;
|
|
|
|
float vel_z;
|
|
|
|
uint32_t apm_time;
|
|
|
|
uint8_t dgps_numch;
|
|
|
|
uint32_t dgps_age;
|
|
|
|
};
|
|
|
|
|
2013-05-02 20:18:14 -03:00
|
|
|
struct PACKED log_Message {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
char msg[64];
|
|
|
|
};
|
|
|
|
|
2013-04-19 04:49:16 -03:00
|
|
|
struct PACKED log_IMU {
|
|
|
|
LOG_PACKET_HEADER;
|
2013-11-04 01:56:55 -04:00
|
|
|
uint32_t timestamp;
|
2013-04-19 04:49:16 -03:00
|
|
|
float gyro_x, gyro_y, gyro_z;
|
|
|
|
float accel_x, accel_y, accel_z;
|
|
|
|
};
|
|
|
|
|
2013-11-25 17:44:00 -04:00
|
|
|
struct PACKED log_RCIN {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
uint16_t chan1;
|
|
|
|
uint16_t chan2;
|
|
|
|
uint16_t chan3;
|
|
|
|
uint16_t chan4;
|
|
|
|
uint16_t chan5;
|
|
|
|
uint16_t chan6;
|
|
|
|
uint16_t chan7;
|
|
|
|
uint16_t chan8;
|
2014-03-25 02:39:19 -03:00
|
|
|
uint16_t chan9;
|
|
|
|
uint16_t chan10;
|
|
|
|
uint16_t chan11;
|
|
|
|
uint16_t chan12;
|
|
|
|
uint16_t chan13;
|
|
|
|
uint16_t chan14;
|
2013-11-25 17:44:00 -04:00
|
|
|
};
|
|
|
|
|
2013-11-27 07:14:17 -04:00
|
|
|
struct PACKED log_RCOUT {
|
2013-11-25 17:44:00 -04:00
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
uint16_t chan1;
|
|
|
|
uint16_t chan2;
|
|
|
|
uint16_t chan3;
|
|
|
|
uint16_t chan4;
|
|
|
|
uint16_t chan5;
|
|
|
|
uint16_t chan6;
|
|
|
|
uint16_t chan7;
|
|
|
|
uint16_t chan8;
|
2014-08-12 12:08:17 -03:00
|
|
|
uint16_t chan9;
|
|
|
|
uint16_t chan10;
|
|
|
|
uint16_t chan11;
|
|
|
|
uint16_t chan12;
|
2013-11-25 17:44:00 -04:00
|
|
|
};
|
|
|
|
|
2014-01-27 19:35:18 -04:00
|
|
|
struct PACKED log_BARO {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
float altitude;
|
|
|
|
float pressure;
|
|
|
|
int16_t temperature;
|
2014-10-22 04:29:25 -03:00
|
|
|
float climbrate;
|
2014-01-30 18:33:12 -04:00
|
|
|
};
|
2014-01-03 01:01:08 -04:00
|
|
|
|
|
|
|
struct PACKED log_AHRS {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t roll;
|
|
|
|
int16_t pitch;
|
|
|
|
uint16_t yaw;
|
|
|
|
float alt;
|
|
|
|
int32_t lat;
|
|
|
|
int32_t lng;
|
2014-01-27 19:35:18 -04:00
|
|
|
};
|
|
|
|
|
2014-02-13 07:07:32 -04:00
|
|
|
struct PACKED log_POWR {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
uint16_t Vcc;
|
|
|
|
uint16_t Vservo;
|
|
|
|
uint16_t flags;
|
|
|
|
};
|
|
|
|
|
2014-01-03 20:51:22 -04:00
|
|
|
struct PACKED log_EKF1 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t roll;
|
|
|
|
int16_t pitch;
|
|
|
|
uint16_t yaw;
|
|
|
|
float velN;
|
|
|
|
float velE;
|
|
|
|
float velD;
|
|
|
|
float posN;
|
|
|
|
float posE;
|
|
|
|
float posD;
|
2014-01-30 18:33:12 -04:00
|
|
|
int16_t gyrX;
|
|
|
|
int16_t gyrY;
|
|
|
|
int16_t gyrZ;
|
2014-01-03 20:51:22 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PACKED log_EKF2 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
2014-10-06 06:04:55 -03:00
|
|
|
int8_t Ratio;
|
|
|
|
int8_t AZ1bias;
|
|
|
|
int8_t AZ2bias;
|
2014-01-03 20:51:22 -04:00
|
|
|
int16_t windN;
|
|
|
|
int16_t windE;
|
|
|
|
int16_t magN;
|
|
|
|
int16_t magE;
|
|
|
|
int16_t magD;
|
|
|
|
int16_t magX;
|
|
|
|
int16_t magY;
|
|
|
|
int16_t magZ;
|
|
|
|
};
|
|
|
|
|
2014-01-30 18:33:12 -04:00
|
|
|
struct PACKED log_EKF3 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
int16_t innovVN;
|
|
|
|
int16_t innovVE;
|
|
|
|
int16_t innovVD;
|
|
|
|
int16_t innovPN;
|
|
|
|
int16_t innovPE;
|
|
|
|
int16_t innovPD;
|
|
|
|
int16_t innovMX;
|
|
|
|
int16_t innovMY;
|
|
|
|
int16_t innovMZ;
|
|
|
|
int16_t innovVT;
|
|
|
|
};
|
2014-01-03 20:51:22 -04:00
|
|
|
|
2014-01-30 18:33:12 -04:00
|
|
|
struct PACKED log_EKF4 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
2014-03-31 20:05:07 -03:00
|
|
|
int16_t sqrtvarV;
|
|
|
|
int16_t sqrtvarP;
|
|
|
|
int16_t sqrtvarH;
|
2014-01-30 18:33:12 -04:00
|
|
|
int16_t sqrtvarMX;
|
|
|
|
int16_t sqrtvarMY;
|
|
|
|
int16_t sqrtvarMZ;
|
|
|
|
int16_t sqrtvarVT;
|
2014-03-31 20:05:07 -03:00
|
|
|
int8_t offsetNorth;
|
|
|
|
int8_t offsetEast;
|
2014-05-14 05:18:28 -03:00
|
|
|
uint8_t faults;
|
2014-11-21 22:33:16 -04:00
|
|
|
uint8_t staticmode;
|
2014-11-01 04:04:57 -03:00
|
|
|
uint8_t timeouts;
|
2014-01-30 18:33:12 -04:00
|
|
|
};
|
2014-01-03 20:51:22 -04:00
|
|
|
|
2014-08-06 21:32:12 -03:00
|
|
|
struct PACKED log_EKF5 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
2014-10-31 23:27:52 -03:00
|
|
|
int16_t FIX;
|
|
|
|
int16_t FIY;
|
|
|
|
int16_t AFIX;
|
|
|
|
int16_t AFIY;
|
|
|
|
int16_t gndPos;
|
2014-08-06 21:32:12 -03:00
|
|
|
uint8_t scaler;
|
2014-10-31 23:27:52 -03:00
|
|
|
int16_t RI;
|
2014-10-15 15:56:20 -03:00
|
|
|
uint16_t range;
|
2014-08-06 21:32:12 -03:00
|
|
|
};
|
|
|
|
|
2014-03-12 05:17:13 -03:00
|
|
|
struct PACKED log_Cmd {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
uint16_t command_total;
|
2014-03-16 05:40:30 -03:00
|
|
|
uint16_t sequence;
|
|
|
|
uint16_t command;
|
|
|
|
float param1;
|
|
|
|
float param2;
|
|
|
|
float param3;
|
|
|
|
float param4;
|
|
|
|
float latitude;
|
|
|
|
float longitude;
|
|
|
|
float altitude;
|
2014-03-12 05:17:13 -03:00
|
|
|
};
|
|
|
|
|
2014-03-11 14:05:02 -03:00
|
|
|
struct PACKED log_Radio {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
uint8_t rssi;
|
|
|
|
uint8_t remrssi;
|
|
|
|
uint8_t txbuf;
|
|
|
|
uint8_t noise;
|
|
|
|
uint8_t remnoise;
|
|
|
|
uint16_t rxerrors;
|
|
|
|
uint16_t fixed;
|
|
|
|
};
|
|
|
|
|
2014-06-10 23:55:04 -03:00
|
|
|
struct PACKED log_Camera {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t gps_time;
|
|
|
|
uint16_t gps_week;
|
|
|
|
int32_t latitude;
|
|
|
|
int32_t longitude;
|
|
|
|
int32_t altitude;
|
|
|
|
int32_t altitude_rel;
|
|
|
|
int16_t roll;
|
|
|
|
int16_t pitch;
|
|
|
|
uint16_t yaw;
|
|
|
|
};
|
|
|
|
|
2014-08-05 23:16:07 -03:00
|
|
|
/*
|
|
|
|
terrain log structure
|
|
|
|
*/
|
|
|
|
struct PACKED log_TERRAIN {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
|
|
|
uint8_t status;
|
|
|
|
int32_t lat;
|
|
|
|
int32_t lng;
|
|
|
|
uint16_t spacing;
|
|
|
|
float terrain_height;
|
|
|
|
float current_height;
|
|
|
|
uint16_t pending;
|
|
|
|
uint16_t loaded;
|
|
|
|
};
|
|
|
|
|
2014-08-17 08:45:11 -03:00
|
|
|
/*
|
|
|
|
UBlox logging
|
|
|
|
*/
|
|
|
|
struct PACKED log_Ubx1 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
uint8_t instance;
|
|
|
|
uint16_t noisePerMS;
|
|
|
|
uint8_t jamInd;
|
|
|
|
uint8_t aPower;
|
2014-10-28 16:50:51 -03:00
|
|
|
uint16_t agcCnt;
|
2014-08-17 08:45:11 -03:00
|
|
|
};
|
|
|
|
|
|
|
|
struct PACKED log_Ubx2 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
uint8_t instance;
|
|
|
|
int8_t ofsI;
|
|
|
|
uint8_t magI;
|
|
|
|
int8_t ofsQ;
|
|
|
|
uint8_t magQ;
|
|
|
|
};
|
|
|
|
|
2014-10-29 20:44:14 -03:00
|
|
|
struct PACKED log_Ubx3 {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t timestamp;
|
|
|
|
uint8_t instance;
|
|
|
|
float hAcc;
|
|
|
|
float vAcc;
|
|
|
|
float sAcc;
|
|
|
|
};
|
|
|
|
|
2014-11-13 06:38:33 -04:00
|
|
|
struct PACKED log_Esc {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint32_t time_ms;
|
2014-11-20 06:53:12 -04:00
|
|
|
int16_t rpm;
|
|
|
|
int16_t voltage;
|
|
|
|
int16_t current;
|
|
|
|
int16_t temperature;
|
2014-11-13 06:38:33 -04:00
|
|
|
};
|
|
|
|
|
2014-06-26 21:28:21 -03:00
|
|
|
// messages for all boards
|
|
|
|
#define LOG_BASE_STRUCTURES \
|
2013-04-23 06:46:22 -03:00
|
|
|
{ LOG_FORMAT_MSG, sizeof(log_Format), \
|
2014-01-02 20:58:41 -04:00
|
|
|
"FMT", "BBnNZ", "Type,Length,Name,Format,Columns" }, \
|
2013-04-19 04:49:16 -03:00
|
|
|
{ LOG_PARAMETER_MSG, sizeof(log_Parameter), \
|
|
|
|
"PARM", "Nf", "Name,Value" }, \
|
|
|
|
{ LOG_GPS_MSG, sizeof(log_GPS), \
|
2013-11-04 06:37:10 -04:00
|
|
|
"GPS", "BIHBcLLeeEefI", "Status,TimeMS,Week,NSats,HDop,Lat,Lng,RelAlt,Alt,Spd,GCrs,VZ,T" }, \
|
2013-04-19 04:49:16 -03:00
|
|
|
{ LOG_IMU_MSG, sizeof(log_IMU), \
|
2013-11-04 01:56:55 -04:00
|
|
|
"IMU", "Iffffff", "TimeMS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ" }, \
|
2013-05-02 20:18:14 -03:00
|
|
|
{ LOG_MESSAGE_MSG, sizeof(log_Message), \
|
2013-11-25 17:44:00 -04:00
|
|
|
"MSG", "Z", "Message"}, \
|
|
|
|
{ LOG_RCIN_MSG, sizeof(log_RCIN), \
|
2014-03-25 02:39:19 -03:00
|
|
|
"RCIN", "Ihhhhhhhhhhhhhh", "TimeMS,C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11,C12,C13,C14" }, \
|
2013-11-27 07:14:17 -04:00
|
|
|
{ LOG_RCOUT_MSG, sizeof(log_RCOUT), \
|
2014-08-12 12:08:17 -03:00
|
|
|
"RCOU", "Ihhhhhhhhhhhh", "TimeMS,Ch1,Ch2,Ch3,Ch4,Ch5,Ch6,Ch7,Ch8,Ch9,Ch10,Ch11,Ch12" }, \
|
2014-01-27 19:35:18 -04:00
|
|
|
{ LOG_BARO_MSG, sizeof(log_BARO), \
|
2014-10-22 04:29:25 -03:00
|
|
|
"BARO", "Iffcf", "TimeMS,Alt,Press,Temp,CRt" }, \
|
2014-02-13 07:07:32 -04:00
|
|
|
{ LOG_POWR_MSG, sizeof(log_POWR), \
|
2014-01-30 18:33:12 -04:00
|
|
|
"POWR","ICCH","TimeMS,Vcc,VServo,Flags" }, \
|
2014-06-26 21:28:21 -03:00
|
|
|
{ LOG_CMD_MSG, sizeof(log_Cmd), \
|
|
|
|
"CMD", "IHHHfffffff","TimeMS,CTot,CNum,CId,Prm1,Prm2,Prm3,Prm4,Lat,Lng,Alt" }, \
|
|
|
|
{ LOG_RADIO_MSG, sizeof(log_Radio), \
|
|
|
|
"RAD", "IBBBBBHH", "TimeMS,RSSI,RemRSSI,TxBuf,Noise,RemNoise,RxErrors,Fixed" }, \
|
|
|
|
{ LOG_CAMERA_MSG, sizeof(log_Camera), \
|
|
|
|
"CAM", "IHLLeeccC","GPSTime,GPSWeek,Lat,Lng,Alt,RelAlt,Roll,Pitch,Yaw" }
|
|
|
|
|
|
|
|
// messages for more advanced boards
|
|
|
|
#define LOG_EXTRA_STRUCTURES \
|
|
|
|
{ LOG_GPS2_MSG, sizeof(log_GPS2), \
|
|
|
|
"GPS2", "BIHBcLLeEefIBI", "Status,TimeMS,Week,NSats,HDop,Lat,Lng,Alt,Spd,GCrs,VZ,T,DSc,DAg" }, \
|
|
|
|
{ LOG_IMU2_MSG, sizeof(log_IMU), \
|
|
|
|
"IMU2", "Iffffff", "TimeMS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ" }, \
|
|
|
|
{ LOG_IMU3_MSG, sizeof(log_IMU), \
|
|
|
|
"IMU3", "Iffffff", "TimeMS,GyrX,GyrY,GyrZ,AccX,AccY,AccZ" }, \
|
2014-01-03 01:01:08 -04:00
|
|
|
{ LOG_AHR2_MSG, sizeof(log_AHRS), \
|
|
|
|
"AHR2","IccCfLL","TimeMS,Roll,Pitch,Yaw,Alt,Lat,Lng" }, \
|
|
|
|
{ LOG_SIMSTATE_MSG, sizeof(log_AHRS), \
|
2014-01-03 20:51:22 -04:00
|
|
|
"SIM","IccCfLL","TimeMS,Roll,Pitch,Yaw,Alt,Lat,Lng" }, \
|
|
|
|
{ LOG_EKF1_MSG, sizeof(log_EKF1), \
|
2014-01-30 18:33:12 -04:00
|
|
|
"EKF1","IccCffffffccc","TimeMS,Roll,Pitch,Yaw,VN,VE,VD,PN,PE,PD,GX,GY,GZ" }, \
|
2014-01-03 20:51:22 -04:00
|
|
|
{ LOG_EKF2_MSG, sizeof(log_EKF2), \
|
2014-10-06 06:04:55 -03:00
|
|
|
"EKF2","Ibbbcchhhhhh","TimeMS,Ratio,AZ1bias,AZ2bias,VWN,VWE,MN,ME,MD,MX,MY,MZ" }, \
|
2014-01-30 18:33:12 -04:00
|
|
|
{ LOG_EKF3_MSG, sizeof(log_EKF3), \
|
|
|
|
"EKF3","Icccccchhhc","TimeMS,IVN,IVE,IVD,IPN,IPE,IPD,IMX,IMY,IMZ,IVT" }, \
|
|
|
|
{ LOG_EKF4_MSG, sizeof(log_EKF4), \
|
2014-11-01 04:04:57 -03:00
|
|
|
"EKF4","IcccccccbbBBB","TimeMS,SV,SP,SH,SMX,SMY,SMZ,SVT,OFN,EFE,FS,StaticMode,TS" }, \
|
2014-08-05 23:16:07 -03:00
|
|
|
{ LOG_TERRAIN_MSG, sizeof(log_TERRAIN), \
|
2014-08-17 08:45:11 -03:00
|
|
|
"TERR","IBLLHffHH","TimeMS,Status,Lat,Lng,Spacing,TerrH,CHeight,Pending,Loaded" }, \
|
|
|
|
{ LOG_UBX1_MSG, sizeof(log_Ubx1), \
|
2014-10-28 16:50:51 -03:00
|
|
|
"UBX1", "IBHBBH", "TimeMS,Instance,noisePerMS,jamInd,aPower,agcCnt" }, \
|
2014-08-17 08:45:11 -03:00
|
|
|
{ LOG_UBX2_MSG, sizeof(log_Ubx2), \
|
2014-10-29 20:44:14 -03:00
|
|
|
"UBX2", "IBbBbB", "TimeMS,Instance,ofsI,magI,ofsQ,magQ" }, \
|
|
|
|
{ LOG_UBX3_MSG, sizeof(log_Ubx3), \
|
2014-11-13 06:38:33 -04:00
|
|
|
"UBX3", "IBfff", "TimeMS,Instance,hAcc,vAcc,sAcc" }, \
|
|
|
|
{ LOG_ESC1_MSG, sizeof(log_Esc), \
|
2014-11-20 06:53:12 -04:00
|
|
|
"ESC1", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
2014-11-13 06:38:33 -04:00
|
|
|
{ LOG_ESC2_MSG, sizeof(log_Esc), \
|
2014-11-20 06:53:12 -04:00
|
|
|
"ESC2", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
2014-11-13 06:38:33 -04:00
|
|
|
{ LOG_ESC3_MSG, sizeof(log_Esc), \
|
2014-11-20 06:53:12 -04:00
|
|
|
"ESC3", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
2014-11-13 06:38:33 -04:00
|
|
|
{ LOG_ESC4_MSG, sizeof(log_Esc), \
|
2014-11-20 06:53:12 -04:00
|
|
|
"ESC4", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
|
|
|
{ LOG_ESC5_MSG, sizeof(log_Esc), \
|
|
|
|
"ESC5", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
|
|
|
{ LOG_ESC6_MSG, sizeof(log_Esc), \
|
|
|
|
"ESC6", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
|
|
|
{ LOG_ESC7_MSG, sizeof(log_Esc), \
|
|
|
|
"ESC7", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
|
|
|
{ LOG_ESC8_MSG, sizeof(log_Esc), \
|
2014-08-06 21:32:12 -03:00
|
|
|
"ESC8", "Icccc", "TimeMS,RPM,Volt,Curr,Temp" }, \
|
|
|
|
{ LOG_EKF5_MSG, sizeof(log_EKF5), \
|
2014-10-31 23:27:52 -03:00
|
|
|
"EKF5","IhhhhcBcC","TimeMS,FIX,FIY,AFIX,AFIY,gndPos,fScaler,RI,rng" }
|
2014-06-26 21:28:21 -03:00
|
|
|
|
|
|
|
#if HAL_CPU_CLASS >= HAL_CPU_CLASS_75
|
|
|
|
#define LOG_COMMON_STRUCTURES LOG_BASE_STRUCTURES, LOG_EXTRA_STRUCTURES
|
|
|
|
#else
|
|
|
|
#define LOG_COMMON_STRUCTURES LOG_BASE_STRUCTURES
|
|
|
|
#endif
|
2013-04-19 04:49:16 -03:00
|
|
|
|
2014-03-23 22:03:31 -03:00
|
|
|
// message types 0 to 100 reversed for vehicle specific use
|
|
|
|
|
2013-04-19 04:49:16 -03:00
|
|
|
// message types for common messages
|
2013-04-19 10:19:16 -03:00
|
|
|
#define LOG_FORMAT_MSG 128
|
|
|
|
#define LOG_PARAMETER_MSG 129
|
|
|
|
#define LOG_GPS_MSG 130
|
|
|
|
#define LOG_IMU_MSG 131
|
2013-05-02 20:18:14 -03:00
|
|
|
#define LOG_MESSAGE_MSG 132
|
2013-11-25 17:44:00 -04:00
|
|
|
#define LOG_RCIN_MSG 133
|
2013-11-27 07:14:17 -04:00
|
|
|
#define LOG_RCOUT_MSG 134
|
2013-12-08 05:45:04 -04:00
|
|
|
#define LOG_IMU2_MSG 135
|
2014-01-27 19:35:18 -04:00
|
|
|
#define LOG_BARO_MSG 136
|
2014-02-13 07:07:32 -04:00
|
|
|
#define LOG_POWR_MSG 137
|
2014-01-03 01:01:08 -04:00
|
|
|
#define LOG_AHR2_MSG 138
|
|
|
|
#define LOG_SIMSTATE_MSG 139
|
2014-01-03 20:51:22 -04:00
|
|
|
#define LOG_EKF1_MSG 140
|
|
|
|
#define LOG_EKF2_MSG 141
|
2014-01-30 18:33:12 -04:00
|
|
|
#define LOG_EKF3_MSG 142
|
|
|
|
#define LOG_EKF4_MSG 143
|
2013-12-21 07:24:51 -04:00
|
|
|
#define LOG_GPS2_MSG 144
|
2014-03-11 14:05:02 -03:00
|
|
|
#define LOG_CMD_MSG 145
|
|
|
|
#define LOG_RADIO_MSG 146
|
2014-04-30 08:21:08 -03:00
|
|
|
#define LOG_ATRP_MSG 147
|
2014-06-10 23:55:04 -03:00
|
|
|
#define LOG_CAMERA_MSG 148
|
2014-06-26 01:04:55 -03:00
|
|
|
#define LOG_IMU3_MSG 149
|
2014-08-05 23:16:07 -03:00
|
|
|
#define LOG_TERRAIN_MSG 150
|
2014-08-17 08:45:11 -03:00
|
|
|
#define LOG_UBX1_MSG 151
|
|
|
|
#define LOG_UBX2_MSG 152
|
2014-10-29 20:44:14 -03:00
|
|
|
#define LOG_UBX3_MSG 153
|
2014-11-13 06:38:33 -04:00
|
|
|
#define LOG_ESC1_MSG 154
|
|
|
|
#define LOG_ESC2_MSG 155
|
|
|
|
#define LOG_ESC3_MSG 156
|
|
|
|
#define LOG_ESC4_MSG 157
|
2014-11-20 06:53:12 -04:00
|
|
|
#define LOG_ESC5_MSG 158
|
|
|
|
#define LOG_ESC6_MSG 159
|
|
|
|
#define LOG_ESC7_MSG 160
|
|
|
|
#define LOG_ESC8_MSG 161
|
2014-08-06 21:32:12 -03:00
|
|
|
#define LOG_EKF5_MSG 162
|
2013-04-19 04:49:16 -03:00
|
|
|
|
2014-03-23 22:03:31 -03:00
|
|
|
// message types 200 to 210 reversed for GPS driver use
|
2014-04-12 05:21:31 -03:00
|
|
|
// message types 211 to 220 reversed for autotune use
|
2014-03-23 22:03:31 -03:00
|
|
|
|
2013-02-23 03:52:30 -04:00
|
|
|
#include "DataFlash_Block.h"
|
2013-02-28 16:17:58 -04:00
|
|
|
#include "DataFlash_File.h"
|
2011-11-12 23:29:07 -04:00
|
|
|
|
2011-11-07 07:21:29 -04:00
|
|
|
#endif
|