Browse Source

电池压差添加电芯数目参数

master
yaozb 5 years ago
parent
commit
9d77fe9e90
  1. 5
      libraries/AP_BattMonitor/AP_BattMonitor_Backend.cpp
  2. 2
      libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp
  3. 1
      libraries/AP_BattMonitor/AP_BattMonitor_Params.h

5
libraries/AP_BattMonitor/AP_BattMonitor_Backend.cpp

@ -268,9 +268,10 @@ bool AP_BattMonitor_Backend::cells_dropout_voltage_checks(uint8_t &cell_min_inde
{ {
uint16_t cell_min = 65535; uint16_t cell_min = 65535;
uint16_t cell_max = 0; uint16_t cell_max = 0;
for (int k = 0; k < MAVLINK_MSG_BATTERY_STATUS_FIELD_VOLTAGES_LEN; k++)
for (int k = 0; k <_params._batt_cells_amount ; k++)//MAVLINK_MSG_BATTERY_STATUS_FIELD_VOLTAGES_LEN
{ {
if ((_state.cell_voltages.cells[k]!=65535)) //TODO if valid cell valtage =0 if (_state.cell_voltages.cells[k]!=65535) //TODO if valid cell valtage =0
{ {
if (_state.cell_voltages.cells[k] < cell_min) if (_state.cell_voltages.cells[k] < cell_min)
{ {

2
libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp

@ -169,6 +169,8 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = {
// @Increment: 0.01 // @Increment: 0.01
// @User: Standard // @User: Standard
AP_GROUPINFO("DROPOUT_V", 20, AP_BattMonitor_Params, _arming_dropout_voltage, 0), AP_GROUPINFO("DROPOUT_V", 20, AP_BattMonitor_Params, _arming_dropout_voltage, 0),
AP_GROUPINFO("CELL_TOTAL", 21, AP_BattMonitor_Params, _batt_cells_amount, 0),
AP_GROUPEND AP_GROUPEND

1
libraries/AP_BattMonitor/AP_BattMonitor_Params.h

@ -57,4 +57,5 @@ public:
AP_Int32 _arming_minimum_capacity; /// capacity level required to arm AP_Int32 _arming_minimum_capacity; /// capacity level required to arm
AP_Float _arming_minimum_voltage; /// voltage level required to arm AP_Float _arming_minimum_voltage; /// voltage level required to arm
AP_Float _arming_dropout_voltage; /// voltage level required to arm AP_Float _arming_dropout_voltage; /// voltage level required to arm
AP_Int8 _batt_cells_amount; /// voltage level required to arm
}; };

Loading…
Cancel
Save