Copter: add Heli Dataflash message

This commit is contained in:
Robert Lefebvre 2015-06-18 17:09:39 -04:00 committed by Randy Mackay
parent 3ad6700c5d
commit 62079226ff
4 changed files with 30 additions and 0 deletions

View File

@ -366,6 +366,9 @@ void Copter::ten_hz_logging_loop()
if (should_log(MASK_LOG_IMU) || should_log(MASK_LOG_IMU_FAST) || should_log(MASK_LOG_IMU_RAW)) {
DataFlash.Log_Write_Vibration(ins);
}
#if FRAME_CONFIG == HELI_FRAME
Log_Write_Heli();
#endif
}
// fifty_hz_logging_loop

View File

@ -601,6 +601,9 @@ private:
void Log_Write_Error(uint8_t sub_system, uint8_t error_code);
void Log_Write_Baro(void);
void Log_Write_Parameter_Tuning(uint8_t param, float tuning_val, int16_t control_in, int16_t tune_low, int16_t tune_high);
#if FRAME_CONFIG == HELI_FRAME
void Log_Write_Heli(void);
#endif
void Log_Read(uint16_t log_num, uint16_t start_page, uint16_t end_page);
void start_logging() ;
void load_parameters(void);

View File

@ -654,6 +654,27 @@ void Copter::Log_Write_Parameter_Tuning(uint8_t param, float tuning_val, int16_t
DataFlash.WriteBlock(&pkt_tune, sizeof(pkt_tune));
}
struct PACKED log_Heli {
LOG_PACKET_HEADER;
uint64_t time_us;
int16_t desired_rotor_speed;
int16_t estimated_rotor_speed;
};
#if FRAME_CONFIG == HELI_FRAME
// Write an helicopter packet
void Copter::Log_Write_Heli()
{
struct log_Heli pkt_heli = {
LOG_PACKET_HEADER_INIT(LOG_HELI_MSG),
time_us : hal.scheduler->micros64(),
desired_rotor_speed : motors.get_desired_rotor_speed(),
estimated_rotor_speed : motors.get_estimated_rotor_speed(),
};
DataFlash.WriteBlock(&pkt_heli, sizeof(pkt_heli));
}
#endif
const struct LogStructure Copter::log_structure[] PROGMEM = {
LOG_COMMON_STRUCTURES,
#if AUTOTUNE_ENABLED == ENABLED
@ -692,6 +713,8 @@ const struct LogStructure Copter::log_structure[] PROGMEM = {
"DFLT", "QBf", "TimeUS,Id,Value" },
{ LOG_ERROR_MSG, sizeof(log_Error),
"ERR", "QBB", "TimeUS,Subsys,ECode" },
{ LOG_HELI_MSG, sizeof(log_Heli),
"HELI", "Qhh", "TimeUS,DRRPM,ERRPM" },
};
#if CLI_ENABLED == ENABLED

View File

@ -239,6 +239,7 @@ enum FlipState {
#define LOG_RATE_MSG 0x1D
#define LOG_MOTBATT_MSG 0x1E
#define LOG_PARAMTUNE_MSG 0x1F
#define LOG_HELI_MSG 0x20
#define MASK_LOG_ATTITUDE_FAST (1<<0)
#define MASK_LOG_ATTITUDE_MED (1<<1)