mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 10:46:33 +08:00
batteryCheck: apply supply circuit breaker also to battery checks
This was the case in older versions of PX4.
This commit is contained in:
committed by
Silvan Fuhrer
parent
edcda80cb9
commit
7d79bdfa05
@@ -32,6 +32,7 @@
|
|||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "batteryCheck.hpp"
|
#include "batteryCheck.hpp"
|
||||||
|
#include <lib/circuit_breaker/circuit_breaker.h>
|
||||||
|
|
||||||
#include <px4_platform_common/events.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)
|
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;
|
int battery_required_count = 0;
|
||||||
bool battery_has_fault = false;
|
bool battery_has_fault = false;
|
||||||
// There are possibly multiple batteries, and we can't know which ones serve which purpose. So the safest
|
// There are possibly multiple batteries, and we can't know which ones serve which purpose. So the safest
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ private:
|
|||||||
bool _battery_connected_at_arming[battery_status_s::MAX_INSTANCES] {};
|
bool _battery_connected_at_arming[battery_status_s::MAX_INSTANCES] {};
|
||||||
|
|
||||||
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
|
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
|
||||||
)
|
)
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user