diff --git a/src/drivers/px4fmu/fmu.cpp b/src/drivers/px4fmu/fmu.cpp index abb3a36898..5f5ea7e0a2 100644 --- a/src/drivers/px4fmu/fmu.cpp +++ b/src/drivers/px4fmu/fmu.cpp @@ -405,13 +405,15 @@ PX4FMU::init() return ret; } - /* try to claim the generic PWM output device node as well - it's OK if we fail at this */ - _class_instance = register_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH); + if (_mode != MODE_NONE) { + /* try to claim the generic PWM output device node as well - it's OK if we fail at this */ + _class_instance = register_class_devname(PWM_OUTPUT_BASE_DEVICE_PATH); - if (_class_instance == CLASS_DEVICE_PRIMARY) { - /* lets not be too verbose */ - } else if (_class_instance < 0) { - warnx("FAILED registering class device"); + if (_class_instance == CLASS_DEVICE_PRIMARY) { + /* lets not be too verbose */ + } else if (_class_instance < 0) { + warnx("FAILED registering class device"); + } } _safety_disabled = circuit_breaker_enabled("CBRK_IO_SAFETY", CBRK_IO_SAFETY_KEY); @@ -422,7 +424,7 @@ PX4FMU::init() } void -PX4FMU:: safety_check_button(void) +PX4FMU::safety_check_button(void) { #ifdef GPIO_BTN_SAFETY static int counter = 0; @@ -859,10 +861,12 @@ void PX4FMU::rc_io_invert(bool invert) { INVERT_RC_INPUT(invert); +#ifdef GPIO_RC_OUT if (!invert) { // set FMU_RC_OUTPUT high to pull RC_INPUT up px4_arch_gpiowrite(GPIO_RC_OUT, 1); } +#endif } #endif @@ -907,8 +911,10 @@ PX4FMU::cycle() _rcs_fd = dsm_init(RC_SERIAL_PORT); // assume SBUS input sbus_config(_rcs_fd, false); +#ifdef GPIO_PPM_IN // disable CPPM input by mapping it away from the timer capture input px4_arch_unconfiggpio(GPIO_PPM_IN); +#endif #endif _initialized = true; @@ -2017,7 +2023,7 @@ PX4FMU::pwm_ioctl(file *filp, int cmd, unsigned long arg) break; } -#ifdef RC_SERIAL_PORT +#ifdef GPIO_SPEKTRUM_PWR_EN case DSM_BIND_START: /* only allow DSM2, DSM-X and DSM-X with more than 7 channels */ @@ -2960,6 +2966,9 @@ fmu_main(int argc, char *argv[]) if (!strcmp(verb, "mode_gpio")) { new_mode = PORT_FULL_GPIO; + } else if (!strcmp(verb, "mode_rcin")) { + exit(0); + } else if (!strcmp(verb, "mode_pwm")) { new_mode = PORT_FULL_PWM; @@ -3050,12 +3059,16 @@ fmu_main(int argc, char *argv[]) exit(0); } - fprintf(stderr, "FMU: unrecognised command %s, try:\n", verb); + fprintf(stderr, "FMU: unrecognized command %s, try:\n", verb); +#if defined(RC_SERIAL_PORT) + fprintf(stderr, " mode_rcin"); +#endif #if defined(BOARD_HAS_MULTI_PURPOSE_GPIO) fprintf(stderr, - " mode_gpio, mode_serial, mode_pwm, mode_gpio_serial, mode_pwm_serial, mode_pwm_gpio, test, fake, sensor_reset, id\n"); + " , mode_gpio, mode_serial, mode_pwm, mode_gpio_serial, mode_pwm_serial, mode_pwm_gpio, test, fake, sensor_reset, id\n"); #elif defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6 - fprintf(stderr, " mode_gpio, mode_pwm, mode_pwm4, test, sensor_reset [milliseconds], i2c \n"); + fprintf(stderr, " mode_gpio, mode_pwm, mode_pwm4, test, sensor_reset [milliseconds], i2c \n"); #endif + fprintf(stderr, "\n"); exit(1); }