diff --git a/libraries/AP_BattMonitor/AP_BattMonitor.cpp b/libraries/AP_BattMonitor/AP_BattMonitor.cpp index 284c56b72f..a231c0200c 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor.cpp +++ b/libraries/AP_BattMonitor/AP_BattMonitor.cpp @@ -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; diff --git a/libraries/AP_BattMonitor/AP_BattMonitor.h b/libraries/AP_BattMonitor/AP_BattMonitor.h index af285ac1d2..587bad1302 100644 --- a/libraries/AP_BattMonitor/AP_BattMonitor.h +++ b/libraries/AP_BattMonitor/AP_BattMonitor.h @@ -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;