Plane: added logging of 2nd compass

This commit is contained in:
Andrew Tridgell 2013-12-10 13:35:16 +11:00
parent 5802d7f86b
commit 6ed21c12db
2 changed files with 20 additions and 0 deletions

View File

@ -468,6 +468,23 @@ static void Log_Write_Compass()
offset_z : (int16_t)mag_offsets.z
};
DataFlash.WriteBlock(&pkt, sizeof(pkt));
#if COMPASS_MAX_INSTANCES > 1
if (compass.get_count() > 1) {
const Vector3f &mag2_offsets = compass.get_offsets(1);
const Vector3f &mag2 = compass.get_field(1);
struct log_Compass pkt2 = {
LOG_PACKET_HEADER_INIT(LOG_COMPASS2_MSG),
time_ms : hal.scheduler->millis(),
mag_x : (int16_t)mag2.x,
mag_y : (int16_t)mag2.y,
mag_z : (int16_t)mag2.z,
offset_x : (int16_t)mag2_offsets.x,
offset_y : (int16_t)mag2_offsets.y,
offset_z : (int16_t)mag2_offsets.z
};
DataFlash.WriteBlock(&pkt2, sizeof(pkt2));
}
#endif
}
static void Log_Write_GPS(void)
@ -510,6 +527,8 @@ static const struct LogStructure log_structure[] PROGMEM = {
"CURR", "IhhhHf", "TimeMS,Thr,Volt,Curr,Vcc,CurrTot" },
{ LOG_COMPASS_MSG, sizeof(log_Compass),
"MAG", "Ihhhhhh", "TimeMS,MagX,MagY,MagZ,OfsX,OfsY,OfsZ" },
{ LOG_COMPASS2_MSG, sizeof(log_Compass),
"MAG2", "Ihhhhhh", "TimeMS,MagX,MagY,MagZ,OfsX,OfsY,OfsZ" },
TECS_LOG_FORMAT(LOG_TECS_MSG),
};

View File

@ -164,6 +164,7 @@ enum log_messages {
LOG_TECS_MSG,
LOG_RC_MSG,
LOG_SONAR_MSG,
LOG_COMPASS2_MSG,
MAX_NUM_LOGS // always at the end
};