commander: use circuit breaker params directly in arming checks

This commit is contained in:
Beat Küng
2022-08-25 22:02:15 -04:00
committed by Daniel Agar
parent 4230eee24f
commit 13c93db11a
11 changed files with 20 additions and 29 deletions
@@ -32,6 +32,7 @@
****************************************************************************/
#include "airspeedCheck.hpp"
#include <lib/circuit_breaker/circuit_breaker.h>
using namespace time_literals;
@@ -42,7 +43,7 @@ AirspeedChecks::AirspeedChecks()
void AirspeedChecks::checkAndReport(const Context &context, Report &reporter)
{
if (context.status().circuit_breaker_engaged_airspd_check ||
if (circuit_breaker_enabled_by_val(_param_cbrk_airspd_chk.get(), CBRK_AIRSPD_CHK_KEY) ||
(context.status().vehicle_type != vehicle_status_s::VEHICLE_TYPE_FIXED_WING && !context.status().is_vtol)) {
return;
}
@@ -53,6 +53,7 @@ private:
const param_t _param_fw_airspd_trim_handle;
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
(ParamInt<px4::params::CBRK_AIRSPD_CHK>) _param_cbrk_airspd_chk,
(ParamBool<px4::params::COM_ARM_ARSP_EN>) _param_com_arm_arsp_en
)
};
@@ -32,12 +32,13 @@
****************************************************************************/
#include "powerCheck.hpp"
#include <lib/circuit_breaker/circuit_breaker.h>
using namespace time_literals;
void PowerChecks::checkAndReport(const Context &context, Report &reporter)
{
if (context.status().circuit_breaker_engaged_power_check) {
if (circuit_breaker_enabled_by_val(_param_cbrk_supply_chk.get(), CBRK_SUPPLY_CHK_KEY)) {
return;
}
@@ -50,6 +50,7 @@ private:
uORB::Subscription _system_power_sub{ORB_ID(system_power)};
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
(ParamInt<px4::params::CBRK_SUPPLY_CHK>) _param_cbrk_supply_chk,
(ParamInt<px4::params::COM_POWER_COUNT>) _param_com_power_count
)
};
@@ -34,6 +34,7 @@
#include "systemCheck.hpp"
#include "../../Arming/ArmAuthorization/ArmAuthorization.h"
#include <lib/circuit_breaker/circuit_breaker.h>
#include <uORB/topics/vehicle_command_ack.h>
void SystemChecks::checkAndReport(const Context &context, Report &reporter)
@@ -54,7 +55,7 @@ void SystemChecks::checkAndReport(const Context &context, Report &reporter)
}
// USB not connected
if (!context.status().circuit_breaker_engaged_usb_check && context.status().usb_connected) {
if (!circuit_breaker_enabled_by_val(_param_cbrk_usb_chk.get(), CBRK_USB_CHK_KEY) && context.status().usb_connected) {
/* EVENT
* @description
* Flying with USB is not safe. Disconnect it and reboot the FMU.
@@ -206,7 +207,7 @@ void SystemChecks::checkAndReport(const Context &context, Report &reporter)
}
}
if (!context.status().circuit_breaker_vtol_fw_arming_check
if (!circuit_breaker_enabled_by_val(_param_cbrk_vtolarming.get(), CBRK_VTOLARMING_KEY)
&& context.status().vehicle_type != vehicle_status_s::VEHICLE_TYPE_ROTARY_WING) {
/* EVENT
* @description
@@ -50,6 +50,8 @@ private:
uORB::Subscription _actuator_armed_sub{ORB_ID(actuator_armed)};
DEFINE_PARAMETERS_CUSTOM_PARENT(HealthAndArmingCheckBase,
(ParamInt<px4::params::CBRK_VTOLARMING>) _param_cbrk_vtolarming,
(ParamInt<px4::params::CBRK_USB_CHK>) _param_cbrk_usb_chk,
(ParamBool<px4::params::COM_ARM_MIS_REQ>) _param_com_arm_mis_req,
(ParamBool<px4::params::COM_ARM_WO_GPS>) _param_com_arm_wo_gps,
(ParamBool<px4::params::COM_ARM_CHK_ESCS>) _param_com_arm_chk_escs,