mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-10 18:08:30 -04:00
AP_BattMoniter: log in Ah and Wh, add percentage to log
This commit is contained in:
parent
c5dba34e4c
commit
712e3afd21
@ -18,7 +18,8 @@ void AP_BattMonitor_Backend::Log_Write_BAT(const uint8_t instance, const uint64_
|
||||
current_total : has_curr ? _state.consumed_mah : AP::logger().quiet_nanf(),
|
||||
consumed_wh : has_curr ? _state.consumed_wh : AP::logger().quiet_nanf(),
|
||||
temperature : (int16_t) ( has_temperature() ? _state.temperature * 100 : 0),
|
||||
resistance : _state.resistance
|
||||
resistance : _state.resistance,
|
||||
rem_percent : capacity_remaining_pct(),
|
||||
};
|
||||
AP::logger().WriteBlock(&pkt, sizeof(pkt));
|
||||
}
|
||||
|
@ -13,10 +13,11 @@
|
||||
// @Field: Volt: measured voltage
|
||||
// @Field: VoltR: estimated resting voltage
|
||||
// @Field: Curr: measured current
|
||||
// @Field: CurrTot: current * time
|
||||
// @Field: EnrgTot: energy this battery has produced
|
||||
// @Field: CurrTot: consumed Ah, current * time
|
||||
// @Field: EnrgTot: consumed Wh, energy this battery has expended
|
||||
// @Field: Temp: measured temperature
|
||||
// @Field: Res: estimated battery resistance
|
||||
// @Field: RemPct: remaining percentage
|
||||
struct PACKED log_BAT {
|
||||
LOG_PACKET_HEADER;
|
||||
uint64_t time_us;
|
||||
@ -28,6 +29,7 @@ struct PACKED log_BAT {
|
||||
float consumed_wh;
|
||||
int16_t temperature; // degrees C * 100
|
||||
float resistance;
|
||||
uint8_t rem_percent;
|
||||
};
|
||||
|
||||
// @LoggerMessage: BCL
|
||||
@ -57,6 +59,6 @@ struct PACKED log_BCL {
|
||||
|
||||
#define LOG_STRUCTURE_FROM_BATTMONITOR \
|
||||
{ LOG_BAT_MSG, sizeof(log_BAT), \
|
||||
"BAT", "QBfffffcf", "TimeUS,Instance,Volt,VoltR,Curr,CurrTot,EnrgTot,Temp,Res", "s#vvAiJOw", "F-000!/?0" }, \
|
||||
"BAT", "QBfffffcfB", "TimeUS,Instance,Volt,VoltR,Curr,CurrTot,EnrgTot,Temp,Res,RemPct", "s#vvAaXOw%", "F-000C0?00" }, \
|
||||
{ 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" },
|
||||
|
Loading…
Reference in New Issue
Block a user