AP_TECS: convert to using Log_Write

preparation for a TEC2 message
This commit is contained in:
Andrew Tridgell 2016-05-13 15:57:53 +10:00
parent 9a6ac77c64
commit bc911d15d1
2 changed files with 18 additions and 8 deletions

View File

@ -1042,10 +1042,22 @@ void AP_TECS::update_pitch_throttle(int32_t hgt_dem_cm,
}
// log the contents of the log_tuning structure to dataflash
void AP_TECS::log_data(DataFlash_Class &dataflash, uint8_t msgid)
void AP_TECS::log_data(DataFlash_Class &dataflash)
{
log_tuning.head1 = HEAD_BYTE1;
log_tuning.head2 = HEAD_BYTE2;
log_tuning.msgid = msgid;
dataflash.WriteBlock(&log_tuning, sizeof(log_tuning));
dataflash.Log_Write("TECS", "TimeUS,h,dh,hdem,dhdem,spdem,sp,dsp,ith,iph,th,ph,dspdem,w,f", "QfffffffffffffB",
AP_HAL::micros64(),
log_tuning.hgt,
log_tuning.dhgt,
log_tuning.hgt_dem,
log_tuning.dhgt_dem,
log_tuning.spd_dem,
log_tuning.spd,
log_tuning.dspd,
log_tuning.ithr,
log_tuning.iptch,
log_tuning.thr,
log_tuning.ptch,
log_tuning.dspd_dem,
log_tuning.speed_weight,
log_tuning.flags);
}

View File

@ -70,7 +70,7 @@ public:
}
// log data on internal state of the controller. Called at 10Hz
void log_data(DataFlash_Class &dataflash, uint8_t msgid);
void log_data(DataFlash_Class &dataflash);
// return current target airspeed
float get_target_airspeed(void) const {
@ -357,5 +357,3 @@ private:
float timeConstant(void) const;
};
#define TECS_LOG_FORMAT(msg) { msg, sizeof(AP_TECS::log_TECS_Tuning), \
"TECS", "QfffffffffffffB", "TimeUS,h,dh,hdem,dhdem,spdem,sp,dsp,ith,iph,th,ph,dspdem,w,f" }