mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-24 02:53:33 +08:00
PX4IO driver - use "curcuit_breaker_enabled" function instead of manually checking its value
This commit is contained in:
@@ -1023,18 +1023,11 @@ PX4IO::task_main()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Check if the IO safety circuit breaker has been updated */
|
||||||
int32_t safety_param_val;
|
int32_t safety_param_val;
|
||||||
param_t safety_param = param_find("CBRK_IO_SAFETY");
|
safety_param_val = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY);
|
||||||
|
/* Bypass IO safety switch logic by setting FORCE_SAFETY_OFF */
|
||||||
if (safety_param != PARAM_INVALID) {
|
(void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FORCE_SAFETY_OFF, safety_param_val);
|
||||||
|
|
||||||
param_get(safety_param, &safety_param_val);
|
|
||||||
|
|
||||||
if (safety_param_val == PX4IO_FORCE_SAFETY_MAGIC) {
|
|
||||||
/* disable IO safety if circuit breaker asked for it */
|
|
||||||
(void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_FORCE_SAFETY_OFF, safety_param_val);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if the flight termination circuit breaker has been updated */
|
/* Check if the flight termination circuit breaker has been updated */
|
||||||
_cb_flighttermination = circuit_breaker_enabled("CBRK_FLIGHTTERM", CBRK_FLIGHTTERM_KEY);
|
_cb_flighttermination = circuit_breaker_enabled("CBRK_FLIGHTTERM", CBRK_FLIGHTTERM_KEY);
|
||||||
|
|||||||
Reference in New Issue
Block a user