Plane: added DF logging of 2nd battery voltage

This commit is contained in:
Andrew Tridgell 2014-10-30 21:17:17 +11:00
parent 34a43b2d99
commit 96a87b6990

View File

@ -382,6 +382,7 @@ struct PACKED log_Current {
int16_t current_amps;
uint16_t board_voltage;
float current_total;
int16_t battery2_voltage;
};
struct PACKED log_Arm_Disarm {
@ -393,6 +394,8 @@ struct PACKED log_Arm_Disarm {
static void Log_Write_Current()
{
float voltage2 = 0.0;
battery.voltage2(voltage2);
struct log_Current pkt = {
LOG_PACKET_HEADER_INIT(LOG_CURRENT_MSG),
time_ms : hal.scheduler->millis(),
@ -400,7 +403,8 @@ static void Log_Write_Current()
battery_voltage : (int16_t)(battery.voltage() * 100.0f),
current_amps : (int16_t)(battery.current_amps() * 100.0f),
board_voltage : (uint16_t)(hal.analogin->board_voltage()*1000),
current_total : battery.current_total_mah()
current_total : battery.current_total_mah(),
battery2_voltage : (int16_t)(voltage2 * 100.0f)
};
DataFlash.WriteBlock(&pkt, sizeof(pkt));
@ -544,7 +548,7 @@ static const struct LogStructure log_structure[] PROGMEM = {
{ LOG_MODE_MSG, sizeof(log_Mode),
"MODE", "IMB", "TimeMS,Mode,ModeNum" },
{ LOG_CURRENT_MSG, sizeof(log_Current),
"CURR", "IhhhHf", "TimeMS,Thr,Volt,Curr,Vcc,CurrTot" },
"CURR", "IhhhHfh", "TimeMS,Thr,Volt,Curr,Vcc,CurrTot,Volt2" },
{ LOG_COMPASS_MSG, sizeof(log_Compass),
"MAG", "Ihhhhhh", "TimeMS,MagX,MagY,MagZ,OfsX,OfsY,OfsZ" },
{ LOG_COMPASS2_MSG, sizeof(log_Compass),