2016-01-14 15:30:56 -04:00
|
|
|
#include "Sub.h"
|
2015-12-30 18:57:56 -04:00
|
|
|
|
|
|
|
#if LOGGING_ENABLED == ENABLED
|
|
|
|
|
|
|
|
// Code to Write and Read packets from DataFlash log memory
|
|
|
|
// Code to interact with the user to dump or erase logs
|
|
|
|
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::do_erase_logs(void)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
2017-07-08 22:51:41 -03:00
|
|
|
gcs().send_text(MAV_SEVERITY_INFO, "Erasing logs");
|
2015-12-30 18:57:56 -04:00
|
|
|
DataFlash.EraseAll();
|
2017-07-08 22:51:41 -03:00
|
|
|
gcs().send_text(MAV_SEVERITY_INFO, "Log erase complete");
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Optflow {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t surface_quality;
|
|
|
|
float flow_x;
|
|
|
|
float flow_y;
|
|
|
|
float body_x;
|
|
|
|
float body_y;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write an optical flow packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Optflow()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
2017-02-03 17:33:27 -04:00
|
|
|
#if OPTFLOW == ENABLED
|
2015-12-30 18:57:56 -04:00
|
|
|
// exit immediately if not enabled
|
|
|
|
if (!optflow.enabled()) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
const Vector2f &flowRate = optflow.flowRate();
|
|
|
|
const Vector2f &bodyRate = optflow.bodyRate();
|
|
|
|
struct log_Optflow pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_OPTFLOW_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
surface_quality : optflow.quality(),
|
|
|
|
flow_x : flowRate.x,
|
|
|
|
flow_y : flowRate.y,
|
|
|
|
body_x : bodyRate.x,
|
|
|
|
body_y : bodyRate.y
|
|
|
|
};
|
|
|
|
DataFlash.WriteBlock(&pkt, sizeof(pkt));
|
2017-02-03 17:33:27 -04:00
|
|
|
#endif // OPTFLOW == ENABLED
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Control_Tuning {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
2016-04-05 00:17:39 -03:00
|
|
|
float throttle_in;
|
|
|
|
float angle_boost;
|
2015-12-30 18:57:56 -04:00
|
|
|
float throttle_out;
|
2016-07-05 21:18:58 -03:00
|
|
|
float throttle_hover;
|
2015-12-30 18:57:56 -04:00
|
|
|
float desired_alt;
|
|
|
|
float inav_alt;
|
2017-04-15 13:33:24 -03:00
|
|
|
float baro_alt;
|
2016-05-22 21:50:44 -03:00
|
|
|
int16_t desired_rangefinder_alt;
|
|
|
|
int16_t rangefinder_alt;
|
2016-05-03 01:45:37 -03:00
|
|
|
float terr_alt;
|
2016-07-05 21:18:58 -03:00
|
|
|
int16_t target_climb_rate;
|
2015-12-30 18:57:56 -04:00
|
|
|
int16_t climb_rate;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write a control tuning packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Control_Tuning()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
2017-02-03 17:33:27 -04:00
|
|
|
// get terrain altitude
|
|
|
|
float terr_alt = 0.0f;
|
2016-05-03 01:45:37 -03:00
|
|
|
#if AP_TERRAIN_AVAILABLE && AC_TERRAIN
|
2017-02-03 17:33:27 -04:00
|
|
|
terrain.height_above_terrain(terr_alt, true);
|
2016-05-03 01:45:37 -03:00
|
|
|
#endif
|
|
|
|
|
2015-12-30 18:57:56 -04:00
|
|
|
struct log_Control_Tuning pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_CONTROL_TUNING_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
2016-04-05 00:17:39 -03:00
|
|
|
throttle_in : attitude_control.get_throttle_in(),
|
2015-12-30 18:57:56 -04:00
|
|
|
angle_boost : attitude_control.angle_boost(),
|
|
|
|
throttle_out : motors.get_throttle(),
|
2017-02-03 17:33:27 -04:00
|
|
|
throttle_hover : motors.get_throttle_hover(),
|
2015-12-30 18:57:56 -04:00
|
|
|
desired_alt : pos_control.get_alt_target() / 100.0f,
|
|
|
|
inav_alt : inertial_nav.get_altitude() / 100.0f,
|
2017-04-15 13:33:24 -03:00
|
|
|
baro_alt : barometer.get_altitude(),
|
2016-05-22 21:50:44 -03:00
|
|
|
desired_rangefinder_alt : (int16_t)target_rangefinder_alt,
|
|
|
|
rangefinder_alt : rangefinder_state.alt_cm,
|
2017-02-03 17:33:27 -04:00
|
|
|
terr_alt : terr_alt,
|
2016-07-05 21:18:58 -03:00
|
|
|
target_climb_rate : (int16_t)pos_control.get_vel_target_z(),
|
2015-12-30 18:57:56 -04:00
|
|
|
climb_rate : climb_rate
|
|
|
|
};
|
|
|
|
DataFlash.WriteBlock(&pkt, sizeof(pkt));
|
|
|
|
}
|
|
|
|
|
|
|
|
// Write an attitude packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Attitude()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
Vector3f targets = attitude_control.get_att_target_euler_cd();
|
2017-02-03 00:18:27 -04:00
|
|
|
targets.z = wrap_360_cd(targets.z);
|
2015-12-30 18:57:56 -04:00
|
|
|
DataFlash.Log_Write_Attitude(ahrs, targets);
|
|
|
|
|
2017-08-22 00:14:48 -03:00
|
|
|
DataFlash.Log_Write_EKF(ahrs);
|
2015-12-30 18:57:56 -04:00
|
|
|
DataFlash.Log_Write_AHRS2(ahrs);
|
|
|
|
#if CONFIG_HAL_BOARD == HAL_BOARD_SITL
|
|
|
|
sitl.Log_Write_SIMSTATE(&DataFlash);
|
|
|
|
#endif
|
|
|
|
DataFlash.Log_Write_POS(ahrs);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_MotBatt {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
float lift_max;
|
|
|
|
float bat_volt;
|
|
|
|
float bat_res;
|
|
|
|
float th_limit;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write an rate packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_MotBatt()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
struct log_MotBatt pkt_mot = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_MOTBATT_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
lift_max : (float)(motors.get_lift_max()),
|
|
|
|
bat_volt : (float)(motors.get_batt_voltage_filt()),
|
2018-03-01 14:44:02 -04:00
|
|
|
bat_res : (float)(battery.get_resistance()),
|
2015-12-30 18:57:56 -04:00
|
|
|
th_limit : (float)(motors.get_throttle_limit())
|
|
|
|
};
|
|
|
|
DataFlash.WriteBlock(&pkt_mot, sizeof(pkt_mot));
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Event {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t id;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Wrote an event packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Event(uint8_t id)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
if (should_log(MASK_LOG_ANY)) {
|
|
|
|
struct log_Event pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_EVENT_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
id : id
|
|
|
|
};
|
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Data_Int16t {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t id;
|
|
|
|
int16_t data_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write an int16_t data packet
|
|
|
|
UNUSED_FUNCTION
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Data(uint8_t id, int16_t value)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
if (should_log(MASK_LOG_ANY)) {
|
|
|
|
struct log_Data_Int16t pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_DATA_INT16_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
id : id,
|
|
|
|
data_value : value
|
|
|
|
};
|
2016-04-21 20:06:15 -03:00
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Data_UInt16t {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t id;
|
|
|
|
uint16_t data_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write an uint16_t data packet
|
2017-02-03 17:33:27 -04:00
|
|
|
UNUSED_FUNCTION
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Data(uint8_t id, uint16_t value)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
if (should_log(MASK_LOG_ANY)) {
|
|
|
|
struct log_Data_UInt16t pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_DATA_UINT16_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
id : id,
|
|
|
|
data_value : value
|
|
|
|
};
|
2016-04-21 20:06:15 -03:00
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Data_Int32t {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t id;
|
|
|
|
int32_t data_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write an int32_t data packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Data(uint8_t id, int32_t value)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
if (should_log(MASK_LOG_ANY)) {
|
|
|
|
struct log_Data_Int32t pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_DATA_INT32_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
id : id,
|
|
|
|
data_value : value
|
|
|
|
};
|
2016-04-21 20:06:15 -03:00
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Data_UInt32t {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t id;
|
|
|
|
uint32_t data_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write a uint32_t data packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Data(uint8_t id, uint32_t value)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
if (should_log(MASK_LOG_ANY)) {
|
|
|
|
struct log_Data_UInt32t pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_DATA_UINT32_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
id : id,
|
|
|
|
data_value : value
|
|
|
|
};
|
2016-04-21 20:06:15 -03:00
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Data_Float {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t id;
|
|
|
|
float data_value;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write a float data packet
|
|
|
|
UNUSED_FUNCTION
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Data(uint8_t id, float value)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
if (should_log(MASK_LOG_ANY)) {
|
|
|
|
struct log_Data_Float pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_DATA_FLOAT_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
id : id,
|
|
|
|
data_value : value
|
|
|
|
};
|
2016-04-21 20:06:15 -03:00
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct PACKED log_Error {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t sub_system;
|
|
|
|
uint8_t error_code;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write an error packet
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Error(uint8_t sub_system, uint8_t error_code)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
struct log_Error pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_ERROR_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
sub_system : sub_system,
|
|
|
|
error_code : error_code,
|
|
|
|
};
|
2016-04-21 20:06:15 -03:00
|
|
|
DataFlash.WriteCriticalBlock(&pkt, sizeof(pkt));
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// log EKF origin and ahrs home to dataflash
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Home_And_Origin()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
// log ekf origin if set
|
|
|
|
Location ekf_orig;
|
2016-03-13 15:39:00 -03:00
|
|
|
if (ahrs.get_origin(ekf_orig)) {
|
2015-12-30 18:57:56 -04:00
|
|
|
DataFlash.Log_Write_Origin(LogOriginType::ekf_origin, ekf_orig);
|
|
|
|
}
|
|
|
|
|
|
|
|
// log ahrs home if set
|
2018-03-15 23:12:42 -03:00
|
|
|
if (ahrs.home_is_set()) {
|
2015-12-30 18:57:56 -04:00
|
|
|
DataFlash.Log_Write_Origin(LogOriginType::ahrs_home, ahrs.get_home());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// logs when baro or compass becomes unhealthy
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Sensor_Health()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
// check baro
|
|
|
|
if (sensor_health.baro != barometer.healthy()) {
|
|
|
|
sensor_health.baro = barometer.healthy();
|
|
|
|
Log_Write_Error(ERROR_SUBSYSTEM_BARO, (sensor_health.baro ? ERROR_CODE_ERROR_RESOLVED : ERROR_CODE_UNHEALTHY));
|
|
|
|
}
|
|
|
|
|
|
|
|
// check compass
|
|
|
|
if (sensor_health.compass != compass.healthy()) {
|
|
|
|
sensor_health.compass = compass.healthy();
|
|
|
|
Log_Write_Error(ERROR_SUBSYSTEM_COMPASS, (sensor_health.compass ? ERROR_CODE_ERROR_RESOLVED : ERROR_CODE_UNHEALTHY));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-05-03 01:45:37 -03:00
|
|
|
struct PACKED log_GuidedTarget {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t type;
|
|
|
|
float pos_target_x;
|
|
|
|
float pos_target_y;
|
|
|
|
float pos_target_z;
|
|
|
|
float vel_target_x;
|
|
|
|
float vel_target_y;
|
|
|
|
float vel_target_z;
|
|
|
|
};
|
|
|
|
|
|
|
|
// Write a Guided mode target
|
|
|
|
void Sub::Log_Write_GuidedTarget(uint8_t target_type, const Vector3f& pos_target, const Vector3f& vel_target)
|
|
|
|
{
|
|
|
|
struct log_GuidedTarget pkt = {
|
|
|
|
LOG_PACKET_HEADER_INIT(LOG_GUIDEDTARGET_MSG),
|
|
|
|
time_us : AP_HAL::micros64(),
|
|
|
|
type : target_type,
|
|
|
|
pos_target_x : pos_target.x,
|
|
|
|
pos_target_y : pos_target.y,
|
|
|
|
pos_target_z : pos_target.z,
|
|
|
|
vel_target_x : vel_target.x,
|
|
|
|
vel_target_y : vel_target.y,
|
|
|
|
vel_target_z : vel_target.z
|
|
|
|
};
|
|
|
|
DataFlash.WriteBlock(&pkt, sizeof(pkt));
|
|
|
|
}
|
|
|
|
|
2017-09-05 22:02:59 -03:00
|
|
|
// type and unit information can be found in
|
|
|
|
// libraries/DataFlash/Logstructure.h; search for "log_Units" for
|
|
|
|
// units and "Format characters" for field type information
|
2016-01-14 15:30:56 -04:00
|
|
|
const struct LogStructure Sub::log_structure[] = {
|
2015-12-30 18:57:56 -04:00
|
|
|
LOG_COMMON_STRUCTURES,
|
|
|
|
{ LOG_OPTFLOW_MSG, sizeof(log_Optflow),
|
2017-09-05 22:02:59 -03:00
|
|
|
"OF", "QBffff", "TimeUS,Qual,flowX,flowY,bodyX,bodyY", "s-EEEE", "F-0000" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_CONTROL_TUNING_MSG, sizeof(log_Control_Tuning),
|
2017-09-05 22:02:59 -03:00
|
|
|
"CTUN", "Qfffffffccfhh", "TimeUS,ThI,ABst,ThO,ThH,DAlt,Alt,BAlt,DSAlt,SAlt,TAlt,DCRt,CRt", "s----mmmmmmnn", "F----00BBBBBB" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_MOTBATT_MSG, sizeof(log_MotBatt),
|
2017-09-05 22:02:59 -03:00
|
|
|
"MOTB", "Qffff", "TimeUS,LiftMax,BatVolt,BatRes,ThLimit", "s-vw-", "F-00-" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_EVENT_MSG, sizeof(log_Event),
|
2017-09-05 22:02:59 -03:00
|
|
|
"EV", "QB", "TimeUS,Id", "s-", "F-" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_DATA_INT16_MSG, sizeof(log_Data_Int16t),
|
2017-09-05 22:02:59 -03:00
|
|
|
"D16", "QBh", "TimeUS,Id,Value", "s--", "F--" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_DATA_UINT16_MSG, sizeof(log_Data_UInt16t),
|
2017-09-05 22:02:59 -03:00
|
|
|
"DU16", "QBH", "TimeUS,Id,Value", "s--", "F--" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_DATA_INT32_MSG, sizeof(log_Data_Int32t),
|
2017-09-05 22:02:59 -03:00
|
|
|
"D32", "QBi", "TimeUS,Id,Value", "s--", "F--" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_DATA_UINT32_MSG, sizeof(log_Data_UInt32t),
|
2017-09-05 22:02:59 -03:00
|
|
|
"DU32", "QBI", "TimeUS,Id,Value", "s--", "F--" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_DATA_FLOAT_MSG, sizeof(log_Data_Float),
|
2017-09-05 22:02:59 -03:00
|
|
|
"DFLT", "QBf", "TimeUS,Id,Value", "s--", "F--" },
|
2015-12-30 18:57:56 -04:00
|
|
|
{ LOG_ERROR_MSG, sizeof(log_Error),
|
2017-09-05 22:02:59 -03:00
|
|
|
"ERR", "QBB", "TimeUS,Subsys,ECode", "s--", "F--" },
|
2017-02-03 17:33:27 -04:00
|
|
|
{ LOG_GUIDEDTARGET_MSG, sizeof(log_GuidedTarget),
|
2017-09-05 22:02:59 -03:00
|
|
|
"GUID", "QBffffff", "TimeUS,Type,pX,pY,pZ,vX,vY,vZ", "s-mmmnnn", "F-000000" },
|
2015-12-30 18:57:56 -04:00
|
|
|
};
|
|
|
|
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Vehicle_Startup_Messages()
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
// only 200(?) bytes are guaranteed by DataFlash
|
2016-04-18 01:38:21 -03:00
|
|
|
DataFlash.Log_Write_Mode(control_mode, control_mode_reason);
|
2017-03-13 19:43:16 -03:00
|
|
|
Log_Write_Home_And_Origin();
|
2017-03-15 21:20:01 -03:00
|
|
|
gps.Write_DataFlash_Log_Startup_messages();
|
2015-12-30 18:57:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::log_init(void)
|
2015-12-30 18:57:56 -04:00
|
|
|
{
|
|
|
|
DataFlash.Init(log_structure, ARRAY_SIZE(log_structure));
|
|
|
|
}
|
|
|
|
|
|
|
|
#else // LOGGING_ENABLED
|
|
|
|
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::do_erase_logs(void) {}
|
|
|
|
void Sub::Log_Write_Control_Tuning() {}
|
|
|
|
void Sub::Log_Write_Performance() {}
|
|
|
|
void Sub::Log_Write_Attitude(void) {}
|
|
|
|
void Sub::Log_Write_MotBatt() {}
|
|
|
|
void Sub::Log_Write_Startup() {}
|
|
|
|
void Sub::Log_Write_Event(uint8_t id) {}
|
|
|
|
void Sub::Log_Write_Data(uint8_t id, int32_t value) {}
|
|
|
|
void Sub::Log_Write_Data(uint8_t id, uint32_t value) {}
|
|
|
|
void Sub::Log_Write_Data(uint8_t id, int16_t value) {}
|
|
|
|
void Sub::Log_Write_Data(uint8_t id, uint16_t value) {}
|
|
|
|
void Sub::Log_Write_Data(uint8_t id, float value) {}
|
|
|
|
void Sub::Log_Write_Error(uint8_t sub_system, uint8_t error_code) {}
|
|
|
|
void Sub::Log_Write_Home_And_Origin() {}
|
|
|
|
void Sub::Log_Sensor_Health() {}
|
2016-07-05 21:18:58 -03:00
|
|
|
void Sub::Log_Write_GuidedTarget(uint8_t target_type, const Vector3f& pos_target, const Vector3f& vel_target) {}
|
2015-12-30 18:57:56 -04:00
|
|
|
|
|
|
|
#if OPTFLOW == ENABLED
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::Log_Write_Optflow() {}
|
2015-12-30 18:57:56 -04:00
|
|
|
#endif
|
|
|
|
|
2016-01-14 15:30:56 -04:00
|
|
|
void Sub::log_init(void) {}
|
2015-12-30 18:57:56 -04:00
|
|
|
|
|
|
|
#endif // LOGGING_ENABLED
|