Skip to content

Commit

Permalink
AP_Battery: include OPTIONS parameter on boards with SUM backend
Browse files Browse the repository at this point in the history
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
  • Loading branch information
AlfieLockrey authored and peterbarker committed Nov 19, 2024
1 parent 19c9964 commit 8a68807
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion libraries/AP_BattMonitor/AP_BattMonitor_Params.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions libraries/AP_BattMonitor/AP_BattMonitor_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 8a68807

Please sign in to comment.