mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-21 15:23:57 -04:00
AP_BattMonitor: AP_BattMonitor_SMBus: fix after conversion to I2CDevice
- Fix bus number - Minor updates to coding style
This commit is contained in:
parent
0cf4353382
commit
64d17702e6
@ -176,7 +176,7 @@ AP_BattMonitor::init()
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_PX4(*this, instance, state[instance]);
|
||||
#else
|
||||
drivers[instance] = new AP_BattMonitor_SMBus_I2C(*this, instance, state[instance],
|
||||
hal.i2c_mgr->get_device(0, BATTMONITOR_SMBUS_I2C_ADDR));
|
||||
hal.i2c_mgr->get_device(BATTMONITOR_SBUS_I2C_BUS, BATTMONITOR_SMBUS_I2C_ADDR));
|
||||
#endif
|
||||
_num_instances++;
|
||||
break;
|
||||
|
@ -29,9 +29,9 @@ extern const AP_HAL::HAL& hal;
|
||||
// Constructor
|
||||
AP_BattMonitor_SMBus_I2C::AP_BattMonitor_SMBus_I2C(AP_BattMonitor &mon, uint8_t instance,
|
||||
AP_BattMonitor::BattMonitor_State &mon_state,
|
||||
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev) :
|
||||
AP_BattMonitor_SMBus(mon, instance, mon_state),
|
||||
_dev(std::move(dev))
|
||||
AP_HAL::OwnPtr<AP_HAL::I2CDevice> dev)
|
||||
: AP_BattMonitor_SMBus(mon, instance, mon_state)
|
||||
, _dev(std::move(dev))
|
||||
{}
|
||||
|
||||
/// Read the battery voltage and current. Should be called at 10hz
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include "AP_BattMonitor_SMBus.h"
|
||||
#include <AP_HAL/I2CDevice.h>
|
||||
|
||||
#define BATTMONITOR_SBUS_I2C_BUS 1
|
||||
#define BATTMONITOR_SMBUS_I2C_ADDR 0x0B // default I2C bus address
|
||||
|
||||
class AP_BattMonitor_SMBus_I2C : public AP_BattMonitor_SMBus
|
||||
|
Loading…
Reference in New Issue
Block a user