Browse Source

AP_BattMonitor: Add macros for Fuel options

Adds macros for FuelFlow, FuelLevel_PWM, and FuelLevel_Analog. The features are enabled on all 2MB boards.
master
TunaLobster 3 years ago committed by Andrew Tridgell
parent
commit
aa2c6b8d17
  1. 8
      libraries/AP_BattMonitor/AP_BattMonitor.cpp
  2. 12
      libraries/AP_BattMonitor/AP_BattMonitor.h

8
libraries/AP_BattMonitor/AP_BattMonitor.cpp

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

12
libraries/AP_BattMonitor/AP_BattMonitor.h

@ -31,8 +31,16 @@
#define AP_BATTMON_SMBUS_ENABLE 1 #define AP_BATTMON_SMBUS_ENABLE 1
#endif #endif
#ifndef AP_BATTMON_FUEL_ENABLE #ifndef AP_BATTMON_FUELFLOW_ENABLE
#define AP_BATTMON_FUEL_ENABLE 1 #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 #endif
// declare backend class // declare backend class

Loading…
Cancel
Save