AP_BoardConfig: fix handling of AP_FEATURE_SAFETY_BUTTON

Not all PX4-based board have a safety button. Rely on
HAL_HAVE_SAFETY_SWITCH instead of ifdef'ing each of them.

This allows to build for aerofc-v1 without safety button.
This commit is contained in:
Lucas De Marchi 2018-06-26 12:19:39 -07:00 committed by Lucas De Marchi
parent 000ae3cb85
commit 259195a7c7
2 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@
#define AP_FEATURE_BOARD_DETECT 0
#endif
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 || CONFIG_HAL_BOARD == HAL_BOARD_VRBRAIN || defined(HAL_CHIBIOS_ARCH_FMUV3) || defined(HAL_CHIBIOS_ARCH_FMUV4) || defined(HAL_CHIBIOS_ARCH_FMUV5) || defined(HAL_CHIBIOS_ARCH_MINDPXV2) || defined(HAL_GPIO_PIN_SAFETY_IN)
#if HAL_HAVE_SAFETY_SWITCH
#define AP_FEATURE_SAFETY_BUTTON 1
#else
#define AP_FEATURE_SAFETY_BUTTON 0

View File

@ -97,7 +97,7 @@ void AP_BoardConfig::px4_setup_pwm()
*/
void AP_BoardConfig::px4_setup_safety_mask()
{
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4 && HAL_HAVE_SAFETY_SWITCH
// setup channels to ignore the armed state
int px4io_fd = open("/dev/px4io", 0);
if (px4io_fd != -1) {