AP_Battery: include OPTIONS parameter on boards with SUM backend

Enable battx_options for periphs if useful.

Enable the options parameter for the battery monitor on AP_Periph devices if they could be useful - ie, battery summing is enabled and in use on a node with more than one source for battery inputs.

Only define options in a single place

Single definition for non periph builds or if AP_BATTERY_SUM_ENABLED
This commit is contained in:
Alfie Lockrey 2024-11-15 11:54:35 +00:00 committed by Peter Barker
parent 19c9964e55
commit 8a6880711a
2 changed files with 7 additions and 1 deletions

View File

@ -150,14 +150,16 @@ const AP_Param::GroupInfo AP_BattMonitor_Params::var_info[] = {
AP_GROUPINFO("ARM_MAH", 19, AP_BattMonitor_Params, _arming_minimum_capacity, 0),
// 20 was BUS
#endif // HAL_BUILD_AP_PERIPH
#if AP_BATTERY_OPTIONS_PARAM_ENABLED
// @Param: OPTIONS
// @DisplayName: Battery monitor options
// @Description: This sets options to change the behaviour of the battery monitor
// @Bitmask: 0:Ignore DroneCAN SoC, 1:MPPT reports input voltage and current, 2:MPPT Powered off when disarmed, 3:MPPT Powered on when armed, 4:MPPT Powered off at boot, 5:MPPT Powered on at boot, 6:Send resistance compensated voltage to GCS, 7:Allow DroneCAN InfoAux to be from a different CAN node, 9:Sum monitor measures minimum voltage instead of average
// @User: Advanced
AP_GROUPINFO("OPTIONS", 21, AP_BattMonitor_Params, _options, 0),
#endif // HAL_BUILD_AP_PERIPH
#endif // AP_BATTERY_OPTIONS_PARAM_ENABLED
#if AP_BATTERY_ESC_TELEM_OUTBOUND_ENABLED
// @Param: ESC_INDEX

View File

@ -119,3 +119,7 @@
#ifndef AP_BATTERY_SCRIPTING_ENABLED
#define AP_BATTERY_SCRIPTING_ENABLED (AP_SCRIPTING_ENABLED && AP_BATTERY_BACKEND_DEFAULT_ENABLED)
#endif
#ifndef AP_BATTERY_OPTIONS_PARAM_ENABLED
#define AP_BATTERY_OPTIONS_PARAM_ENABLED (!defined(HAL_BUILD_AP_PERIPH) || AP_BATTERY_SUM_ENABLED)
#endif