batteryCheck: apply supply circuit breaker also to battery checks

This was the case in older versions of PX4.
This commit is contained in:
Matthias Grob 2024-03-20 18:41:28 +01:00
parent 62b8db153b
commit a9f6b609bd
2 changed files with 7 additions and 1 deletions

View File

@ -32,6 +32,7 @@
****************************************************************************/
#include "batteryCheck.hpp"
#include <lib/circuit_breaker/circuit_breaker.h>
#include <px4_platform_common/events.h>
@ -89,6 +90,10 @@ static constexpr const char *battery_mode_str(battery_mode_t battery_mode)
void BatteryChecks::checkAndReport(const Context &context, Report &reporter)
{
if (circuit_breaker_enabled_by_val(_param_cbrk_supply_chk.get(), CBRK_SUPPLY_CHK_KEY)) {
return;
}
int battery_required_count = 0;
bool battery_has_fault = false;
// There are possibly multiple batteries, and we can't know which ones serve which purpose. So the safest

View File

@ -57,6 +57,7 @@ private:
bool _battery_connected_at_arming[battery_status_s::MAX_INSTANCES] {};
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
(ParamFloat<px4::params::COM_ARM_BAT_MIN>) _param_arm_battery_level_min
(ParamFloat<px4::params::COM_ARM_BAT_MIN>) _param_arm_battery_level_min,
(ParamInt<px4::params::CBRK_SUPPLY_CHK>) _param_cbrk_supply_chk
)
};