AP_BattMonitor: Add macros for Fuel options

Adds macros for FuelFlow, FuelLevel_PWM, and FuelLevel_Analog. The features are enabled on all 2MB boards.
This commit is contained in:
TunaLobster 2022-06-28 11:59:39 -05:00 committed by Andrew Tridgell
parent 6733f75542
commit aa2c6b8d17
2 changed files with 16 additions and 4 deletions

View File

@ -286,17 +286,21 @@ AP_BattMonitor::init()
case Type::Sum:
drivers[instance] = new AP_BattMonitor_Sum(*this, state[instance], _params[instance], instance);
break;
#if AP_BATTMON_FUEL_ENABLE
#if AP_BATTMON_FUELFLOW_ENABLE
case Type::FuelFlow:
drivers[instance] = new AP_BattMonitor_FuelFlow(*this, state[instance], _params[instance]);
break;
#endif // AP_BATTMON_FUELFLOW_ENABLE
#if AP_BATTMON_FUELLEVEL_PWM_ENABLE
case Type::FuelLevel_PWM:
drivers[instance] = new AP_BattMonitor_FuelLevel_PWM(*this, state[instance], _params[instance]);
break;
#endif // AP_BATTMON_FUELLEVEL_PWM_ENABLE
#if AP_BATTMON_FUELLEVEL_ANALOG_ENABLE
case Type::FuelLevel_Analog:
drivers[instance] = new AP_BattMonitor_FuelLevel_Analog(*this, state[instance], _params[instance]);
break;
#endif // AP_BATTMON_FUEL_ENABLE
#endif // AP_BATTMON_FUELLEVEL_ANALOG_ENABLE
#if HAL_GENERATOR_ENABLED
case Type::GENERATOR_ELEC:
drivers[instance] = new AP_BattMonitor_Generator_Elec(*this, state[instance], _params[instance]);

View File

@ -31,8 +31,16 @@
#define AP_BATTMON_SMBUS_ENABLE 1
#endif
#ifndef AP_BATTMON_FUEL_ENABLE
#define AP_BATTMON_FUEL_ENABLE 1
#ifndef AP_BATTMON_FUELFLOW_ENABLE
#define AP_BATTMON_FUELFLOW_ENABLE (BOARD_FLASH_SIZE > 1024)
#endif
#ifndef AP_BATTMON_FUELLEVEL_PWM_ENABLE
#define AP_BATTMON_FUELLEVEL_PWM_ENABLE (BOARD_FLASH_SIZE > 1024)
#endif
#ifndef AP_BATTMON_FUELLEVEL_ANALOG_ENABLE
#define AP_BATTMON_FUELLEVEL_ANALOG_ENABLE (BOARD_FLASH_SIZE > 1024)
#endif
// declare backend class