5
0
mirror of https://github.com/ArduPilot/ardupilot synced 2025-01-05 23:48:31 -04:00

AP_BattMonitor: add health logging

This commit is contained in:
Iampete1 2023-08-01 22:14:06 +01:00 committed by Andrew Tridgell
parent 935fad54ad
commit 5c09a16a80
2 changed files with 5 additions and 2 deletions

View File

@ -22,6 +22,7 @@ void AP_BattMonitor_Backend::Log_Write_BAT(const uint8_t instance, const uint64_
temperature : (int16_t) ( has_temperature() ? _state.temperature * 100 : 0),
resistance : _state.resistance,
rem_percent : percent,
health : _state.healthy
};
AP::logger().WriteBlock(&pkt, sizeof(pkt));
}

View File

@ -9,7 +9,7 @@
// @LoggerMessage: BAT
// @Description: Gathered battery data
// @Field: TimeUS: Time since system startup
// @Field: Instance: battery instance number
// @Field: Inst: battery instance number
// @Field: Volt: measured voltage
// @Field: VoltR: estimated resting voltage
// @Field: Curr: measured current
@ -18,6 +18,7 @@
// @Field: Temp: measured temperature
// @Field: Res: estimated battery resistance
// @Field: RemPct: remaining percentage
// @Field: H: health
struct PACKED log_BAT {
LOG_PACKET_HEADER;
uint64_t time_us;
@ -30,6 +31,7 @@ struct PACKED log_BAT {
int16_t temperature; // degrees C * 100
float resistance;
uint8_t rem_percent;
uint8_t health;
};
// @LoggerMessage: BCL
@ -59,6 +61,6 @@ struct PACKED log_BCL {
#define LOG_STRUCTURE_FROM_BATTMONITOR \
{ LOG_BAT_MSG, sizeof(log_BAT), \
"BAT", "QBfffffcfB", "TimeUS,Instance,Volt,VoltR,Curr,CurrTot,EnrgTot,Temp,Res,RemPct", "s#vvAaXOw%", "F-000C0?00" , true }, \
"BAT", "QBfffffcfBB", "TimeUS,Inst,Volt,VoltR,Curr,CurrTot,EnrgTot,Temp,Res,RemPct,H", "s#vvAaXOw%-", "F-000C0?000" , true }, \
{ LOG_BCL_MSG, sizeof(log_BCL), \
"BCL", "QBfHHHHHHHHHHHH", "TimeUS,Instance,Volt,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12", "s#vvvvvvvvvvvvv", "F-0CCCCCCCCCCCC" , true },