Add logging for 2nd baro

Conflicts:
	src/modules/sdlog2/sdlog2_messages.h
This commit is contained in:
Lorenz Meier 2014-10-15 21:49:52 +02:00
parent d638cbda83
commit d20ebd7390
2 changed files with 23 additions and 1 deletions

View File

@ -1112,6 +1112,7 @@ int sdlog2_thread_main(int argc, char *argv[])
hrt_abstime magnetometer_timestamp = 0;
hrt_abstime barometer_timestamp = 0;
hrt_abstime differential_pressure_timestamp = 0;
hrt_abstime barometer1_timestamp = 0;
hrt_abstime gyro1_timestamp = 0;
hrt_abstime accelerometer1_timestamp = 0;
hrt_abstime magnetometer1_timestamp = 0;
@ -1257,6 +1258,7 @@ int sdlog2_thread_main(int argc, char *argv[])
bool write_IMU1 = false;
bool write_IMU2 = false;
bool write_SENS = false;
bool write_SENS1 = false;
if (buf.sensor.timestamp != gyro_timestamp) {
gyro_timestamp = buf.sensor.timestamp;
@ -1307,6 +1309,22 @@ int sdlog2_thread_main(int argc, char *argv[])
LOGBUFFER_WRITE_AND_COUNT(SENS);
}
if (buf.sensor.baro1_timestamp != barometer1_timestamp) {
barometer1_timestamp = buf.sensor.baro1_timestamp;
write_SENS1 = true;
}
if (write_SENS1) {
log_msg.msg_type = LOG_AIR1_MSG;
log_msg.body.log_SENS.baro_pres = buf.sensor.baro1_pres_mbar;
log_msg.body.log_SENS.baro_alt = buf.sensor.baro1_alt_meter;
log_msg.body.log_SENS.baro_temp = buf.sensor.baro1_temp_celcius;
log_msg.body.log_SENS.diff_pres = buf.sensor.differential_pressure1_pa;
log_msg.body.log_SENS.diff_pres_filtered = buf.sensor.differential_pressure1_filtered_pa;
// XXX moving to AIR0-AIR2 instead of SENS
LOGBUFFER_WRITE_AND_COUNT(SENS);
}
if (buf.sensor.accelerometer1_timestamp != accelerometer1_timestamp) {
accelerometer1_timestamp = buf.sensor.accelerometer1_timestamp;
write_IMU1 = true;

View File

@ -424,6 +424,9 @@ struct log_ENCD_s {
float vel1;
};
/* --- AIR SPEED SENSORS - DIFF. PRESSURE --- */
#define LOG_AIR1_MSG 40
/********** SYSTEM MESSAGES, ID > 0x80 **********/
/* --- TIME - TIME STAMP --- */
@ -457,7 +460,8 @@ static const struct log_format_s log_formats[] = {
LOG_FORMAT_S(IMU, IMU, "fffffffff", "AccX,AccY,AccZ,GyroX,GyroY,GyroZ,MagX,MagY,MagZ"),
LOG_FORMAT_S(IMU1, IMU, "fffffffff", "AccX,AccY,AccZ,GyroX,GyroY,GyroZ,MagX,MagY,MagZ"),
LOG_FORMAT_S(IMU2, IMU, "fffffffff", "AccX,AccY,AccZ,GyroX,GyroY,GyroZ,MagX,MagY,MagZ"),
LOG_FORMAT(SENS, "fffff", "BaroPres,BaroAlt,BaroTemp,DiffPres,DiffPresFilt"),
LOG_FORMAT_S(SENS, SENS, "fffff", "BaroPres,BaroAlt,BaroTemp,DiffPres,DiffPresFilt"),
LOG_FORMAT_S(AIR1, SENS, "fffff", "BaroPa,BaroAlt,BaroTmp,DiffPres,DiffPresF"),
LOG_FORMAT(LPOS, "ffffffffLLfBBBff", "X,Y,Z,Dist,DistR,VX,VY,VZ,RLat,RLon,RAlt,PFlg,LFlg,GFlg,EPH,EPV"),
LOG_FORMAT(LPSP, "ffff", "X,Y,Z,Yaw"),
LOG_FORMAT(GPS, "QBffLLfffffBHHH", "GPSTime,Fix,EPH,EPV,Lat,Lon,Alt,VelN,VelE,VelD,Cog,nSat,SNR,N,J"),