diff --git a/libraries/AP_BattMonitor/AP_BattMonitor.cpp b/libraries/AP_BattMonitor/AP_BattMonitor.cpp index 22b7d6aeec..39aa0f0813 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor.cpp @@ -115,12 +115,12 @@ AP_BattMonitor::init() #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, + hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR, 100000, true, 20)); break; case AP_BattMonitor_Params::BattMonitor_TYPE_MAXELL: drivers[instance] = new AP_BattMonitor_SMBus_Maxell(*this, state[instance], _params[instance], - hal.i2c_mgr->get_device(AP_BATTMONITOR_SMBUS_BUS_EXTERNAL, AP_BATTMONITOR_SMBUS_I2C_ADDR, + hal.i2c_mgr->get_device(_params[instance]._i2c_bus, AP_BATTMONITOR_SMBUS_I2C_ADDR, 100000, true, 20)); break; #endif // HAL_BATTMON_SMBUS_ENABLE diff --git a/libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp b/libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp index a2384f4381..721e0235cc 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp @@ -162,6 +162,13 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = { // @User: Advanced AP_GROUPINFO("ARM_MAH", 19, AP_BattMonitor_Params, _arming_minimum_capacity, 0), + // @Param: BUS + // @DisplayName: Battery monitor I2C bus number + // @Description: Battery monitor I2C bus number + // @Range: 0 3 + // @User: Standard + AP_GROUPINFO("BUS", 20, AP_BattMonitor_Params, _i2c_bus, 0), + AP_GROUPEND }; diff --git a/libraries/AP_BattMonitor/AP_BattMonitor_Params.h b/libraries/AP_BattMonitor/AP_BattMonitor_Params.h index 072ecfca7c..20247d30a7 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor_Params.h +++ b/libraries/AP_BattMonitor/AP_BattMonitor_Params.h @@ -55,5 +55,5 @@ public: AP_Int8 _failsafe_critical_action; /// action to preform on a critical battery failsafe AP_Int32 _arming_minimum_capacity; /// capacity level required to arm AP_Float _arming_minimum_voltage; /// voltage level required to arm - + AP_Int8 _i2c_bus; /// I2C bus number };