mirror of https://github.com/ArduPilot/ardupilot
AP_BattMonitor: support selective enable of SMBUS and fuel battery monitors
This commit is contained in:
parent
d40671b8d8
commit
943e495f34
|
@ -112,6 +112,7 @@ AP_BattMonitor::init()
|
|||
case AP_BattMonitor_Params::BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT:
|
||||
drivers[instance] = new AP_BattMonitor_Analog(*this, state[instance], _params[instance]);
|
||||
break;
|
||||
#if HAL_BATTMON_SMBUS_ENABLE
|
||||
case AP_BattMonitor_Params::BattMonitor_TYPE_SOLO:
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_Solo(*this, state[instance], _params[instance],
|
||||
hal.i2c_mgr->get_device(AP_BATTMONITOR_SMBUS_BUS_INTERNAL, AP_BATTMONITOR_SMBUS_I2C_ADDR,
|
||||
|
@ -122,6 +123,7 @@ AP_BattMonitor::init()
|
|||
hal.i2c_mgr->get_device(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL, AP_BATTMONITOR_SMBUS_I2C_ADDR,
|
||||
100000, true, 20));
|
||||
break;
|
||||
#endif // HAL_BATTMON_SMBUS_ENABLE
|
||||
case AP_BattMonitor_Params::BattMonitor_TYPE_BEBOP:
|
||||
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP || CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_DISCO
|
||||
drivers[instance] = new AP_BattMonitor_Bebop(*this, state[instance], _params[instance]);
|
||||
|
@ -140,12 +142,14 @@ AP_BattMonitor::init()
|
|||
case AP_BattMonitor_Params::BattMonitor_TYPE_Sum:
|
||||
drivers[instance] = new AP_BattMonitor_Sum(*this, state[instance], _params[instance], instance);
|
||||
break;
|
||||
#if HAL_BATTMON_FUEL_ENABLE
|
||||
case AP_BattMonitor_Params::BattMonitor_TYPE_FuelFlow:
|
||||
drivers[instance] = new AP_BattMonitor_FuelFlow(*this, state[instance], _params[instance]);
|
||||
break;
|
||||
case AP_BattMonitor_Params::BattMonitor_TYPE_FuelLevel_PWM:
|
||||
drivers[instance] = new AP_BattMonitor_FuelLevel_PWM(*this, state[instance], _params[instance]);
|
||||
break;
|
||||
#endif // HAL_BATTMON_FUEL_ENABLE
|
||||
case AP_BattMonitor_Params::BattMonitor_TYPE_NONE:
|
||||
default:
|
||||
break;
|
||||
|
|
|
@ -19,6 +19,14 @@
|
|||
#define AP_BATT_MONITOR_RES_EST_TC_1 0.5f
|
||||
#define AP_BATT_MONITOR_RES_EST_TC_2 0.1f
|
||||
|
||||
#ifndef HAL_BATTMON_SMBUS_ENABLE
|
||||
#define HAL_BATTMON_SMBUS_ENABLE 1
|
||||
#endif
|
||||
|
||||
#ifndef HAL_BATTMON_FUEL_ENABLE
|
||||
#define HAL_BATTMON_FUEL_ENABLE 1
|
||||
#endif
|
||||
|
||||
// declare backend class
|
||||
class AP_BattMonitor_Backend;
|
||||
class AP_BattMonitor_Analog;
|
||||
|
|
Loading…
Reference in New Issue