2021-01-06 20:51:50 -04:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <AP_Logger/LogStructure.h>
|
|
|
|
|
|
|
|
#define LOG_IDS_FROM_BATTMONITOR \
|
|
|
|
LOG_BAT_MSG, \
|
2021-06-08 02:21:10 -03:00
|
|
|
LOG_BCL_MSG
|
2021-01-06 20:51:50 -04:00
|
|
|
|
|
|
|
// @LoggerMessage: BAT
|
|
|
|
// @Description: Gathered battery data
|
|
|
|
// @Field: TimeUS: Time since system startup
|
2023-08-01 18:14:06 -03:00
|
|
|
// @Field: Inst: battery instance number
|
2021-01-06 20:51:50 -04:00
|
|
|
// @Field: Volt: measured voltage
|
|
|
|
// @Field: VoltR: estimated resting voltage
|
|
|
|
// @Field: Curr: measured current
|
2021-06-03 19:57:49 -03:00
|
|
|
// @Field: CurrTot: consumed Ah, current * time
|
|
|
|
// @Field: EnrgTot: consumed Wh, energy this battery has expended
|
2021-01-06 20:51:50 -04:00
|
|
|
// @Field: Temp: measured temperature
|
|
|
|
// @Field: Res: estimated battery resistance
|
2021-06-03 19:57:49 -03:00
|
|
|
// @Field: RemPct: remaining percentage
|
2023-08-01 18:14:06 -03:00
|
|
|
// @Field: H: health
|
2024-01-04 23:09:29 -04:00
|
|
|
// @Field: SH: state of health percentage. 0 if unknown
|
2021-01-06 20:51:50 -04:00
|
|
|
struct PACKED log_BAT {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t instance;
|
|
|
|
float voltage;
|
|
|
|
float voltage_resting;
|
|
|
|
float current_amps;
|
|
|
|
float current_total;
|
|
|
|
float consumed_wh;
|
|
|
|
int16_t temperature; // degrees C * 100
|
|
|
|
float resistance;
|
2021-06-03 19:57:49 -03:00
|
|
|
uint8_t rem_percent;
|
2023-08-01 18:14:06 -03:00
|
|
|
uint8_t health;
|
2024-01-04 23:09:29 -04:00
|
|
|
uint8_t state_of_health_pct;
|
2021-01-06 20:51:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
// @LoggerMessage: BCL
|
|
|
|
// @Description: Battery cell voltage information
|
|
|
|
// @Field: TimeUS: Time since system startup
|
|
|
|
// @Field: Instance: battery instance number
|
|
|
|
// @Field: Volt: battery voltage
|
|
|
|
// @Field: V1: first cell voltage
|
|
|
|
// @Field: V2: second cell voltage
|
|
|
|
// @Field: V3: third cell voltage
|
|
|
|
// @Field: V4: fourth cell voltage
|
|
|
|
// @Field: V5: fifth cell voltage
|
|
|
|
// @Field: V6: sixth cell voltage
|
|
|
|
// @Field: V7: seventh cell voltage
|
|
|
|
// @Field: V8: eighth cell voltage
|
|
|
|
// @Field: V9: ninth cell voltage
|
|
|
|
// @Field: V10: tenth cell voltage
|
|
|
|
// @Field: V11: eleventh cell voltage
|
|
|
|
// @Field: V12: twelfth cell voltage
|
|
|
|
struct PACKED log_BCL {
|
|
|
|
LOG_PACKET_HEADER;
|
|
|
|
uint64_t time_us;
|
|
|
|
uint8_t instance;
|
|
|
|
float voltage;
|
2021-06-08 02:21:10 -03:00
|
|
|
uint16_t cell_voltages[12]; // the format does not support more than 12 cells, the remaining cells are reported in the BCL2 message
|
2021-01-06 20:51:50 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
#define LOG_STRUCTURE_FROM_BATTMONITOR \
|
|
|
|
{ LOG_BAT_MSG, sizeof(log_BAT), \
|
2024-01-04 23:09:29 -04:00
|
|
|
"BAT", "QBfffffcfBBB", "TimeUS,Inst,Volt,VoltR,Curr,CurrTot,EnrgTot,Temp,Res,RemPct,H,SH", "s#vvAaXOw%-%", "F-000C0?0000" , true }, \
|
2021-01-06 20:51:50 -04:00
|
|
|
{ LOG_BCL_MSG, sizeof(log_BCL), \
|
2021-07-27 05:48:09 -03:00
|
|
|
"BCL", "QBfHHHHHHHHHHHH", "TimeUS,Instance,Volt,V1,V2,V3,V4,V5,V6,V7,V8,V9,V10,V11,V12", "s#vvvvvvvvvvvvv", "F-0CCCCCCCCCCCC" , true },
|