mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-07-13 06:40:34 +08:00
added circuit_breaker_enabled_by_val()
added and using circuit_breaker_enabled_by_val() where possible instead of circuit_breaker_enabled() which search for cbrk parameters by name, which is extensive process.
This commit is contained in:
@@ -53,3 +53,8 @@ bool circuit_breaker_enabled(const char *breaker, int32_t magic)
|
||||
|
||||
return (PX4_PARAM_GET_BYNAME(breaker, &val) == 0) && (val == magic);
|
||||
}
|
||||
|
||||
bool circuit_breaker_enabled_by_val(int32_t breaker_val, int32_t magic)
|
||||
{
|
||||
return (breaker_val == magic);
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@
|
||||
__BEGIN_DECLS
|
||||
|
||||
extern "C" __EXPORT bool circuit_breaker_enabled(const char *breaker, int32_t magic);
|
||||
extern "C" __EXPORT bool circuit_breaker_enabled_by_val(int32_t breaker_val, int32_t magic);
|
||||
|
||||
__END_DECLS
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ void MixingOutput::updateParams()
|
||||
{
|
||||
ModuleParams::updateParams();
|
||||
|
||||
bool safety_disabled = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY);
|
||||
bool safety_disabled = circuit_breaker_enabled_by_val(_param_cbrk_io_safety.get(), CBRK_IO_SAFETY_KEY);
|
||||
|
||||
if (safety_disabled) {
|
||||
_safety_off = true;
|
||||
|
||||
@@ -234,7 +234,9 @@ private:
|
||||
(ParamInt<px4::params::MC_AIRMODE>) _param_mc_airmode, ///< multicopter air-mode
|
||||
(ParamFloat<px4::params::MOT_SLEW_MAX>) _param_mot_slew_max,
|
||||
(ParamFloat<px4::params::THR_MDL_FAC>) _param_thr_mdl_fac, ///< thrust to pwm modelling factor
|
||||
(ParamInt<px4::params::MOT_ORDERING>) _param_mot_ordering
|
||||
(ParamInt<px4::params::MOT_ORDERING>) _param_mot_ordering,
|
||||
(ParamInt<px4::params::CBRK_IO_SAFETY>) _param_cbrk_io_safety
|
||||
|
||||
)
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user