mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 04:03:59 -04:00
BattMon: Bebop always uses bebop batt monitor
This commit is contained in:
parent
84b6ab0707
commit
9482578c60
@ -133,33 +133,37 @@ AP_BattMonitor::init()
|
||||
return;
|
||||
}
|
||||
|
||||
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
|
||||
// force monitor for bebop
|
||||
_monitoring[0] = BattMonitor_TYPE_BEBOP;
|
||||
#endif
|
||||
|
||||
// create each instance
|
||||
for (uint8_t instance=0; instance<AP_BATT_MONITOR_MAX_INSTANCES; instance++) {
|
||||
uint8_t monitor_type = _monitoring[instance];
|
||||
|
||||
// check for analog instance
|
||||
#if CONFIG_HAL_BOARD_TYPE == CONFIG_HAL_BOARD_TYPE_LINUX && \
|
||||
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
|
||||
if (monitor_type == BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT) {
|
||||
state[instance].instance = instance;
|
||||
drivers[instance] = new AP_BattMonitor_Bebop(*this, instance, state[instance]);
|
||||
_num_instances++;
|
||||
} else
|
||||
#endif
|
||||
if (monitor_type == BattMonitor_TYPE_ANALOG_VOLTAGE_ONLY || monitor_type == BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT) {
|
||||
state[instance].instance = instance;
|
||||
drivers[instance] = new AP_BattMonitor_Analog(*this, instance, state[instance]);
|
||||
_num_instances++;
|
||||
|
||||
// check for SMBus
|
||||
} else if (monitor_type == BattMonitor_TYPE_SMBUS) {
|
||||
state[instance].instance = instance;
|
||||
switch (monitor_type) {
|
||||
case BattMonitor_TYPE_ANALOG_VOLTAGE_ONLY:
|
||||
case BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT:
|
||||
state[instance].instance = instance;
|
||||
drivers[instance] = new AP_BattMonitor_Analog(*this, instance, state[instance]);
|
||||
_num_instances++;
|
||||
break;
|
||||
case BattMonitor_TYPE_SMBUS:
|
||||
state[instance].instance = instance;
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_PX4(*this, instance, state[instance]);
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_PX4(*this, instance, state[instance]);
|
||||
#else
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_I2C(*this, instance, state[instance]);
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_I2C(*this, instance, state[instance]);
|
||||
#endif
|
||||
_num_instances++;
|
||||
_num_instances++;
|
||||
break;
|
||||
case BattMonitor_TYPE_BEBOP:
|
||||
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
|
||||
state[instance].instance = instance;
|
||||
drivers[instance] = new AP_BattMonitor_Bebop(*this, instance, state[instance]);
|
||||
_num_instances++;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
// call init function for each backend
|
||||
|
@ -40,7 +40,8 @@ public:
|
||||
BattMonitor_TYPE_NONE = 0,
|
||||
BattMonitor_TYPE_ANALOG_VOLTAGE_ONLY = 3,
|
||||
BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT = 4,
|
||||
BattMonitor_TYPE_SMBUS = 5
|
||||
BattMonitor_TYPE_SMBUS = 5,
|
||||
BattMonitor_TYPE_BEBOP = 6
|
||||
};
|
||||
|
||||
// The BattMonitor_State structure is filled in by the backend driver
|
||||
|
Loading…
Reference in New Issue
Block a user