Browse Source

PX4IO driver - use "curcuit_breaker_enabled" function instead of manually checking its value

sbg
bresch 7 years ago committed by Beat Küng
parent
commit
796631db20
  1. 15
      src/drivers/px4io/px4io.cpp

15
src/drivers/px4io/px4io.cpp

@ -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);

Loading…
Cancel
Save