mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-03-03 12:14:10 -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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
|
||||||
|
// force monitor for bebop
|
||||||
|
_monitoring[0] = BattMonitor_TYPE_BEBOP;
|
||||||
|
#endif
|
||||||
|
|
||||||
// create each instance
|
// create each instance
|
||||||
for (uint8_t instance=0; instance<AP_BATT_MONITOR_MAX_INSTANCES; instance++) {
|
for (uint8_t instance=0; instance<AP_BATT_MONITOR_MAX_INSTANCES; instance++) {
|
||||||
uint8_t monitor_type = _monitoring[instance];
|
uint8_t monitor_type = _monitoring[instance];
|
||||||
|
switch (monitor_type) {
|
||||||
// check for analog instance
|
case BattMonitor_TYPE_ANALOG_VOLTAGE_ONLY:
|
||||||
#if CONFIG_HAL_BOARD_TYPE == CONFIG_HAL_BOARD_TYPE_LINUX && \
|
case BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT:
|
||||||
CONFIG_HAL_BOARD_SUBTYPE == HAL_BOARD_SUBTYPE_LINUX_BEBOP
|
state[instance].instance = instance;
|
||||||
if (monitor_type == BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT) {
|
drivers[instance] = new AP_BattMonitor_Analog(*this, instance, state[instance]);
|
||||||
state[instance].instance = instance;
|
_num_instances++;
|
||||||
drivers[instance] = new AP_BattMonitor_Bebop(*this, instance, state[instance]);
|
break;
|
||||||
_num_instances++;
|
case BattMonitor_TYPE_SMBUS:
|
||||||
} else
|
state[instance].instance = instance;
|
||||||
#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;
|
|
||||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
#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
|
#else
|
||||||
drivers[instance] = new AP_BattMonitor_SMBus_I2C(*this, instance, state[instance]);
|
drivers[instance] = new AP_BattMonitor_SMBus_I2C(*this, instance, state[instance]);
|
||||||
#endif
|
#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
|
// call init function for each backend
|
||||||
|
@ -40,7 +40,8 @@ public:
|
|||||||
BattMonitor_TYPE_NONE = 0,
|
BattMonitor_TYPE_NONE = 0,
|
||||||
BattMonitor_TYPE_ANALOG_VOLTAGE_ONLY = 3,
|
BattMonitor_TYPE_ANALOG_VOLTAGE_ONLY = 3,
|
||||||
BattMonitor_TYPE_ANALOG_VOLTAGE_AND_CURRENT = 4,
|
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
|
// The BattMonitor_State structure is filled in by the backend driver
|
||||||
|
Loading…
Reference in New Issue
Block a user