Skip to content

Commit 5210600

Browse files
committed
AP_BattMonitor: support 18 cell voltages
1 parent f04add8 commit 5210600

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

libraries/AP_BattMonitor/AP_BattMonitor.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define AP_BATT_MONITOR_RES_EST_TC_2 0.1f
2323

2424
#if HAL_PROGRAM_SIZE_LIMIT_KB > 1024
25-
#define AP_BATT_MONITOR_CELLS_MAX 14
25+
#define AP_BATT_MONITOR_CELLS_MAX 18
2626
#else
2727
#define AP_BATT_MONITOR_CELLS_MAX 12
2828
#endif

libraries/AP_BattMonitor/AP_BattMonitor_Logging.cpp

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,24 @@ void AP_BattMonitor_Backend::Log_Write_BCL(const uint8_t instance, const uint64_
7474
// @Field: Instance: battery instance number
7575
// @Field: V13: thirteenth cell voltage
7676
// @Field: V14: fourteenth cell voltage
77+
// @Field: V15: fifteenth cell voltage
78+
// @Field: V16: sixteenth cell voltage
79+
// @Field: V17: seventeenth cell voltage
80+
// @Field: V18: eighteenth cell voltage
7781
AP::logger().WriteStreaming(
7882
"BCL2",
79-
"TimeUS,Instance,V13,V14",
80-
"s#vv",
81-
"F-CC",
82-
"QBHH",
83+
"TimeUS,Instance,V13,V14,V15,V16,V17,V18",
84+
"s#vvvvvv",
85+
"F-CCCCCC",
86+
"QBHHHHHH",
8387
time_us,
8488
instance,
8589
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+0] + 1, // add 1mv
86-
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+1] + 1 // add 1mv
90+
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+1] + 1, // add 1mv
91+
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+2] + 1, // add 1mv
92+
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+3] + 1, // add 1mv
93+
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+4] + 1, // add 1mv
94+
_state.cell_voltages.cells[ARRAY_SIZE(cell_pkt.cell_voltages)+5] + 1 // add 1mv
8795
);
8896
}
8997
#endif

0 commit comments

Comments
 (0)