Copter: integrate dataflash Log_Write_MavCmd

This commit is contained in:
Randy Mackay 2014-03-16 17:41:59 +09:00
parent 9ef920b0be
commit 2f8daf2fa9
3 changed files with 11 additions and 2 deletions

View File

@ -422,6 +422,14 @@ static void Log_Write_Performance()
DataFlash.WriteBlock(&pkt, sizeof(pkt));
}
// Write a mission command. Total length : 36 bytes
static void Log_Write_Cmd(const AP_Mission::Mission_Command &cmd)
{
mavlink_mission_item_t mav_cmd = {};
AP_Mission::mission_cmd_to_mavlink(cmd,mav_cmd);
DataFlash.Log_Write_MavCmd(mission.num_commands(),mav_cmd);
}
struct PACKED log_Attitude {
LOG_PACKET_HEADER;
uint32_t time_ms;
@ -770,6 +778,7 @@ static void Log_Write_Optflow() {}
static void Log_Write_Nav_Tuning() {}
static void Log_Write_Control_Tuning() {}
static void Log_Write_Performance() {}
static void Log_Write_Cmd(const AP_Mission::Mission_Command &cmd) {}
static void Log_Write_Camera() {}
static void Log_Write_Error(uint8_t sub_system, uint8_t error_code) {}
static void Log_Write_Baro(void);

View File

@ -24,7 +24,7 @@ static void init_home()
if (g.log_bitmask & MASK_LOG_CMD) {
AP_Mission::Mission_Command temp_cmd;
if (mission.read_cmd_from_storage(0, temp_cmd)) {
DataFlash.Log_Write_Cmd(mission.num_commands(),temp_cmd);
Log_Write_Cmd(temp_cmd);
}
}

View File

@ -21,7 +21,7 @@ static bool start_command(const AP_Mission::Mission_Command& cmd)
{
// To-Do: logging when new commands start/end
if (g.log_bitmask & MASK_LOG_CMD) {
DataFlash.Log_Write_Cmd(mission.num_commands(),cmd);
Log_Write_Cmd(cmd);
}
switch(cmd.id) {