From 318c7e83b33713e2080db27391636cff5ba51a24 Mon Sep 17 00:00:00 2001 From: Daniel Agar Date: Thu, 21 Jan 2021 20:18:29 -0500 Subject: [PATCH] support up to PWM 14 - generate PWM_MAIN 1-14 - generate PWM_AUX 1-8 - generate PWM_EXTRA 1-8 - px4io and pwm_out directly read configuration parameters - only available and active physical outputs are actually shown for configuration - overall saves flash despite adding many new parameters --- .../init.d/airframes/4080_zmr250 | 2 - ROMFS/px4fmu_common/init.d/rc.interface | 205 ----- ROMFS/px4fmu_common/init.d/rcS | 5 - Tools/px4airframes/rcout.py | 1 - boards/cuav/nora/init/rc.board_defaults | 4 +- boards/cuav/nora/src/board_config.h | 3 +- boards/cuav/nora/src/spi.cpp | 1 - boards/cuav/nora/src/timer_config.cpp | 20 +- boards/cuav/x7pro/init/rc.board_defaults | 4 +- boards/cuav/x7pro/src/board_config.h | 3 +- boards/cuav/x7pro/src/spi.cpp | 1 - boards/cuav/x7pro/src/timer_config.cpp | 20 +- .../cubeorange/init/rc.board_defaults | 4 +- .../durandal-v1/init/rc.board_defaults | 4 +- boards/mro/pixracerpro/init/rc.board_defaults | 4 +- boards/px4/fmu-v2/init/rc.board_defaults | 4 +- boards/px4/fmu-v3/init/rc.board_defaults | 4 +- src/drivers/dshot/DShot.h | 1 + src/drivers/pwm_out/CMakeLists.txt | 4 + src/drivers/pwm_out/PWMOut.cpp | 322 ++++--- src/drivers/pwm_out/PWMOut.hpp | 5 +- src/drivers/pwm_out/pwm_aux_params.yaml | 147 ++++ src/drivers/pwm_out/pwm_extra_params.yaml | 147 ++++ src/drivers/pwm_out/pwm_main_params.yaml | 147 ++++ src/drivers/px4io/px4io.cpp | 213 ++++- src/modules/sensors/pwm_params_aux.c | 801 ----------------- src/modules/sensors/pwm_params_extra.c | 801 ----------------- src/modules/sensors/pwm_params_main.c | 804 ------------------ 28 files changed, 869 insertions(+), 2812 deletions(-) create mode 100644 src/drivers/pwm_out/pwm_aux_params.yaml create mode 100644 src/drivers/pwm_out/pwm_extra_params.yaml create mode 100644 src/drivers/pwm_out/pwm_main_params.yaml delete mode 100644 src/modules/sensors/pwm_params_aux.c delete mode 100644 src/modules/sensors/pwm_params_extra.c delete mode 100644 src/modules/sensors/pwm_params_main.c diff --git a/ROMFS/px4fmu_common/init.d/airframes/4080_zmr250 b/ROMFS/px4fmu_common/init.d/airframes/4080_zmr250 index e057971cc3..71f15a6154 100644 --- a/ROMFS/px4fmu_common/init.d/airframes/4080_zmr250 +++ b/ROMFS/px4fmu_common/init.d/airframes/4080_zmr250 @@ -21,8 +21,6 @@ if [ $AUTOCNF = yes ] then param set CBRK_IO_SAFETY 22027 - param set FAILSAFE 100 - param set MC_ROLL_P 2.2 param set MC_ROLLRATE_P 0.06 param set MC_ROLLRATE_I 0.2 diff --git a/ROMFS/px4fmu_common/init.d/rc.interface b/ROMFS/px4fmu_common/init.d/rc.interface index 4568e19c38..7e597fdb31 100644 --- a/ROMFS/px4fmu_common/init.d/rc.interface +++ b/ROMFS/px4fmu_common/init.d/rc.interface @@ -226,13 +226,11 @@ then fi else set PWM_AUX_OUT none - set FAILSAFE_AUX none fi else echo "ERROR: Could not start: pwm_out mode_pwm" tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR set PWM_AUX_OUT none - set FAILSAFE_AUX none fi # for DShot do not configure pwm values @@ -246,74 +244,7 @@ then then pwm rate -c ${PWM_AUX_OUT} -r ${PWM_AUX_RATE} -d ${OUTPUT_AUX_DEV} fi - - # Set disarmed, min and max PWM_AUX values. - if [ $PWM_AUX_DISARMED != none ] - then - pwm disarmed -c ${PWM_AUX_OUT} -p ${PWM_AUX_DISARMED} -d ${OUTPUT_AUX_DEV} - fi - if [ $PWM_AUX_MIN != none ] - then - pwm min -c ${PWM_AUX_OUT} -p ${PWM_AUX_MIN} -d ${OUTPUT_AUX_DEV} - fi - if [ $PWM_AUX_MAX != none ] - then - pwm max -c ${PWM_AUX_OUT} -p ${PWM_AUX_MAX} -d ${OUTPUT_AUX_DEV} - fi fi - - # - # Per channel disarmed settings. - # - pwm disarmed -c 1 -p p:PWM_AUX_DIS1 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 2 -p p:PWM_AUX_DIS2 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 3 -p p:PWM_AUX_DIS3 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 4 -p p:PWM_AUX_DIS4 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 5 -p p:PWM_AUX_DIS5 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 6 -p p:PWM_AUX_DIS6 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 7 -p p:PWM_AUX_DIS7 -d ${OUTPUT_AUX_DEV} - pwm disarmed -c 8 -p p:PWM_AUX_DIS8 -d ${OUTPUT_AUX_DEV} - - # - # Per channel min settings. - # - pwm min -c 1 -p p:PWM_AUX_MIN1 -d ${OUTPUT_AUX_DEV} - pwm min -c 2 -p p:PWM_AUX_MIN2 -d ${OUTPUT_AUX_DEV} - pwm min -c 3 -p p:PWM_AUX_MIN3 -d ${OUTPUT_AUX_DEV} - pwm min -c 4 -p p:PWM_AUX_MIN4 -d ${OUTPUT_AUX_DEV} - pwm min -c 5 -p p:PWM_AUX_MIN5 -d ${OUTPUT_AUX_DEV} - pwm min -c 6 -p p:PWM_AUX_MIN6 -d ${OUTPUT_AUX_DEV} - pwm min -c 7 -p p:PWM_AUX_MIN7 -d ${OUTPUT_AUX_DEV} - pwm min -c 8 -p p:PWM_AUX_MIN8 -d ${OUTPUT_AUX_DEV} - - # - # Per channel max settings. - # - pwm max -c 1 -p p:PWM_AUX_MAX1 -d ${OUTPUT_AUX_DEV} - pwm max -c 2 -p p:PWM_AUX_MAX2 -d ${OUTPUT_AUX_DEV} - pwm max -c 3 -p p:PWM_AUX_MAX3 -d ${OUTPUT_AUX_DEV} - pwm max -c 4 -p p:PWM_AUX_MAX4 -d ${OUTPUT_AUX_DEV} - pwm max -c 5 -p p:PWM_AUX_MAX5 -d ${OUTPUT_AUX_DEV} - pwm max -c 6 -p p:PWM_AUX_MAX6 -d ${OUTPUT_AUX_DEV} - pwm max -c 7 -p p:PWM_AUX_MAX7 -d ${OUTPUT_AUX_DEV} - pwm max -c 8 -p p:PWM_AUX_MAX8 -d ${OUTPUT_AUX_DEV} - - if [ $FAILSAFE_AUX != none ] - then - pwm failsafe -c ${PWM_AUX_OUT} -p ${FAILSAFE} -d ${OUTPUT_AUX_DEV} - fi - - # - # Per channel failsafe settings. - # - pwm failsafe -c 1 -p p:PWM_AUX_FAIL1 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 2 -p p:PWM_AUX_FAIL2 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 3 -p p:PWM_AUX_FAIL3 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 4 -p p:PWM_AUX_FAIL4 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 5 -p p:PWM_AUX_FAIL5 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 6 -p p:PWM_AUX_FAIL6 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 7 -p p:PWM_AUX_FAIL7 -d ${OUTPUT_AUX_DEV} - pwm failsafe -c 8 -p p:PWM_AUX_FAIL8 -d ${OUTPUT_AUX_DEV} fi fi fi @@ -327,74 +258,7 @@ then then pwm rate -c ${PWM_OUT} -r ${PWM_RATE} fi - - # Set disarmed, min and max PWM values. - if [ $PWM_DISARMED != none ] - then - pwm disarmed -c ${PWM_OUT} -p ${PWM_DISARMED} - fi - if [ $PWM_MIN != none ] - then - pwm min -c ${PWM_OUT} -p ${PWM_MIN} - fi - if [ $PWM_MAX != none ] - then - pwm max -c ${PWM_OUT} -p ${PWM_MAX} - fi fi - - # - # Per channel disarmed settings. - # - pwm disarmed -c 1 -p p:PWM_MAIN_DIS1 - pwm disarmed -c 2 -p p:PWM_MAIN_DIS2 - pwm disarmed -c 3 -p p:PWM_MAIN_DIS3 - pwm disarmed -c 4 -p p:PWM_MAIN_DIS4 - pwm disarmed -c 5 -p p:PWM_MAIN_DIS5 - pwm disarmed -c 6 -p p:PWM_MAIN_DIS6 - pwm disarmed -c 7 -p p:PWM_MAIN_DIS7 - pwm disarmed -c 8 -p p:PWM_MAIN_DIS8 - - # - # Per channel min settings. - # - pwm min -c 1 -p p:PWM_MAIN_MIN1 - pwm min -c 2 -p p:PWM_MAIN_MIN2 - pwm min -c 3 -p p:PWM_MAIN_MIN3 - pwm min -c 4 -p p:PWM_MAIN_MIN4 - pwm min -c 5 -p p:PWM_MAIN_MIN5 - pwm min -c 6 -p p:PWM_MAIN_MIN6 - pwm min -c 7 -p p:PWM_MAIN_MIN7 - pwm min -c 8 -p p:PWM_MAIN_MIN8 - - # - # Per channel max settings. - # - pwm max -c 1 -p p:PWM_MAIN_MAX1 - pwm max -c 2 -p p:PWM_MAIN_MAX2 - pwm max -c 3 -p p:PWM_MAIN_MAX3 - pwm max -c 4 -p p:PWM_MAIN_MAX4 - pwm max -c 5 -p p:PWM_MAIN_MAX5 - pwm max -c 6 -p p:PWM_MAIN_MAX6 - pwm max -c 7 -p p:PWM_MAIN_MAX7 - pwm max -c 8 -p p:PWM_MAIN_MAX8 - - if [ $FAILSAFE != none ] - then - pwm failsafe -c ${PWM_OUT} -p ${FAILSAFE} -d ${OUTPUT_DEV} - fi - - # - # Per channel failsafe settings. - # - pwm failsafe -c 1 -p p:PWM_MAIN_FAIL1 - pwm failsafe -c 2 -p p:PWM_MAIN_FAIL2 - pwm failsafe -c 3 -p p:PWM_MAIN_FAIL3 - pwm failsafe -c 4 -p p:PWM_MAIN_FAIL4 - pwm failsafe -c 5 -p p:PWM_MAIN_FAIL5 - pwm failsafe -c 6 -p p:PWM_MAIN_FAIL6 - pwm failsafe -c 7 -p p:PWM_MAIN_FAIL7 - pwm failsafe -c 8 -p p:PWM_MAIN_FAIL8 fi if [ $EXTRA_MIXER_MODE != none ] @@ -420,7 +284,6 @@ then echo "INFO [init] Mixer: ${MIXER_EXTRA_FILE} on ${OUTPUT_EXTRA_DEV}" else echo "ERROR [init] Failed loading mixer: ${MIXER_EXTRA_FILE}" - echo "ERROR [init] Failed loading mixer: ${MIXER_EXTRA_FILE}" >> $LOG_FILE tune_control play -t 20 fi @@ -431,75 +294,7 @@ then then pwm rate -c ${PWM_EXTRA_OUT} -r ${PWM_EXTRA_RATE} fi - - # Set disarmed, min and max PWM values. - if [ $PWM_EXTRA_DISARM != none ] - then - pwm disarmed -c ${PWM_EXTRA_OUT} -p ${PWM_EXTRA_DISARM} - fi - if [ $PWM_EXTRA_MIN != none ] - then - pwm min -c ${PWM_EXTRA_OUT} -p ${PWM_EXTRA_MIN} - fi - if [ $PWM_EXTRA_MAX != none ] - then - pwm max -c ${PWM_EXTRA_OUT} -p ${PWM_EXTRA_MAX} - fi fi - - # - # Per channel disarmed settings. - # - pwm disarmed -c 1 -p p:PWM_EXTRA_DIS1 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 2 -p p:PWM_EXTRA_DIS2 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 3 -p p:PWM_EXTRA_DIS3 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 4 -p p:PWM_EXTRA_DIS3 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 5 -p p:PWM_EXTRA_DIS5 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 6 -p p:PWM_EXTRA_DIS3 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 7 -p p:PWM_EXTRA_DIS7 -d ${OUTPUT_EXTRA_DEV} - pwm disarmed -c 8 -p p:PWM_EXTRA_DIS8 -d ${OUTPUT_EXTRA_DEV} - - # - # Per channel min settings. - # - pwm min -c 1 -p p:PWM_EXTRA_MIN1 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 2 -p p:PWM_EXTRA_MIN2 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 3 -p p:PWM_EXTRA_MIN3 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 4 -p p:PWM_EXTRA_MIN4 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 5 -p p:PWM_EXTRA_MIN5 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 6 -p p:PWM_EXTRA_MIN6 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 7 -p p:PWM_EXTRA_MIN7 -d ${OUTPUT_EXTRA_DEV} - pwm min -c 8 -p p:PWM_EXTRA_MIN8 -d ${OUTPUT_EXTRA_DEV} - - # - # Per channel max settings. - # - pwm max -c 1 -p p:PWM_EXTRA_MAX1 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 2 -p p:PWM_EXTRA_MAX2 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 3 -p p:PWM_EXTRA_MAX3 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 4 -p p:PWM_EXTRA_MAX4 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 5 -p p:PWM_EXTRA_MAX5 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 6 -p p:PWM_EXTRA_MAX6 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 7 -p p:PWM_EXTRA_MAX7 -d ${OUTPUT_EXTRA_DEV} - pwm max -c 8 -p p:PWM_EXTRA_MAX8 -d ${OUTPUT_EXTRA_DEV} - - if [ $FAILSAFE_EXTRA != none ] - then - pwm failsafe -c ${PWM_EXTRA_OUT} -p ${FAILSAFE} -d ${OUTPUT_EXTRA_DEV} - fi - - # - # Per channel failsafe settings. - # - pwm failsafe -c 1 -p p:PWM_EXTRA_FAIL1 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 2 -p p:PWM_EXTRA_FAIL2 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 3 -p p:PWM_EXTRA_FAIL3 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 4 -p p:PWM_EXTRA_FAIL4 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 5 -p p:PWM_EXTRA_FAIL5 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 6 -p p:PWM_EXTRA_FAIL6 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 7 -p p:PWM_EXTRA_FAIL7 -d ${OUTPUT_EXTRA_DEV} - pwm failsafe -c 8 -p p:PWM_EXTRA_FAIL8 -d ${OUTPUT_EXTRA_DEV} - fi unset OUTPUT_CMD diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index ae5f6e5ab2..28dc20c02c 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -24,9 +24,6 @@ set R / set AUTOCNF no set AUX_MODE pwm set DATAMAN_OPT "" -set FAILSAFE none -set FAILSAFE_AUX none -set FAILSAFE_EXTRA none set FCONFIG /fs/microsd/etc/config.txt set FEXTRAS /fs/microsd/etc/extras.txt set FMU_MODE pwm @@ -580,8 +577,6 @@ unset R unset AUTOCNF unset AUX_MODE unset DATAMAN_OPT -unset FAILSAFE -unset FAILSAFE_AUX unset FCONFIG unset FEXTRAS unset FMU_MODE diff --git a/Tools/px4airframes/rcout.py b/Tools/px4airframes/rcout.py index 7060bd075c..330c0793ab 100644 --- a/Tools/px4airframes/rcout.py +++ b/Tools/px4airframes/rcout.py @@ -78,7 +78,6 @@ class RCOutput(): if not post_start: result += "else\n" result += "\techo \"ERROR [init] No file matches SYS_AUTOSTART value found in : /etc/init.d/airframes\"\n" - result += "\techo \"ERROR [init] No file matches SYS_AUTOSTART value found in : /etc/init.d/airframes\" >> $LOG_FILE\n" # Reset the configuration result += "\tparam set SYS_AUTOSTART 0\n" result += "\ttone_alarm ${TUNE_ERR}\n" diff --git a/boards/cuav/nora/init/rc.board_defaults b/boards/cuav/nora/init/rc.board_defaults index 96ff8a2b4e..fd4216c0ba 100644 --- a/boards/cuav/nora/init/rc.board_defaults +++ b/boards/cuav/nora/init/rc.board_defaults @@ -13,9 +13,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/boards/cuav/nora/src/board_config.h b/boards/cuav/nora/src/board_config.h index 01baa4bf3d..fcb2cbd465 100644 --- a/boards/cuav/nora/src/board_config.h +++ b/boards/cuav/nora/src/board_config.h @@ -107,7 +107,8 @@ #define GPIO_HEATER_OUTPUT /* PA8 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN8) /* PWM */ -#define DIRECT_PWM_OUTPUT_CHANNELS 8 +#define DIRECT_PWM_OUTPUT_CHANNELS 14 +#define BOARD_NUM_IO_TIMERS 4 /* Power supply control and monitoring GPIOs */ #define BOARD_NUMBER_BRICKS 2 diff --git a/boards/cuav/nora/src/spi.cpp b/boards/cuav/nora/src/spi.cpp index 9a4d6d30ff..02dd0213db 100644 --- a/boards/cuav/nora/src/spi.cpp +++ b/boards/cuav/nora/src/spi.cpp @@ -55,7 +55,6 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = { }), initSPIBus(SPI::Bus::SPI6, { initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortI, GPIO::Pin12}, SPI::DRDY{GPIO::PortH, GPIO::Pin5}), - //initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortI, GPIO::Pin12}), initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortI, GPIO::Pin8}), }), }; diff --git a/boards/cuav/nora/src/timer_config.cpp b/boards/cuav/nora/src/timer_config.cpp index 47d5c11a34..0885466267 100644 --- a/boards/cuav/nora/src/timer_config.cpp +++ b/boards/cuav/nora/src/timer_config.cpp @@ -36,12 +36,11 @@ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { initIOTimer(Timer::Timer5, DMA{DMA::Index1}), initIOTimer(Timer::Timer4, DMA{DMA::Index1}), - // initIOTimer(Timer::Timer1, DMA{DMA::Index1}), - // initIOTimer(Timer::Timer12, DMA{DMA::Index1}), + initIOTimer(Timer::Timer1, DMA{DMA::Index1}), + initIOTimer(Timer::Timer12), }; constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { - // MAIN initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortH, GPIO::Pin10}), initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel2}, {GPIO::PortH, GPIO::Pin11}), initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel3}, {GPIO::PortH, GPIO::Pin12}), @@ -50,14 +49,12 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}), initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}), initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel4}, {GPIO::PortD, GPIO::Pin15}), - - // AUX - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}), - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortA, GPIO::Pin10}), - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), - // initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel1}, {GPIO::PortH, GPIO::Pin6}), - // initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel2}, {GPIO::PortH, GPIO::Pin9}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortA, GPIO::Pin10}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), + initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel1}, {GPIO::PortH, GPIO::Pin6}), + initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel2}, {GPIO::PortH, GPIO::Pin9}), }; constexpr io_timers_channel_mapping_t io_timers_channel_mapping = @@ -81,7 +78,6 @@ static inline constexpr timer_io_channels_t initIOTimerChannelLED(const io_timer } constexpr timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = { - initIOTimerChannelLED(led_pwm_timers, {Timer::Timer8, Timer::Channel1}, {GPIO::PortI, GPIO::Pin5}, 1), initIOTimerChannelLED(led_pwm_timers, {Timer::Timer8, Timer::Channel2}, {GPIO::PortI, GPIO::Pin6}, 2), initIOTimerChannelLED(led_pwm_timers, {Timer::Timer8, Timer::Channel3}, {GPIO::PortI, GPIO::Pin7}, 3), diff --git a/boards/cuav/x7pro/init/rc.board_defaults b/boards/cuav/x7pro/init/rc.board_defaults index 22938969b8..eb343ee1bb 100644 --- a/boards/cuav/x7pro/init/rc.board_defaults +++ b/boards/cuav/x7pro/init/rc.board_defaults @@ -13,9 +13,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/boards/cuav/x7pro/src/board_config.h b/boards/cuav/x7pro/src/board_config.h index 199d0b97fd..351fb09548 100644 --- a/boards/cuav/x7pro/src/board_config.h +++ b/boards/cuav/x7pro/src/board_config.h @@ -107,7 +107,8 @@ #define GPIO_HEATER_OUTPUT /* PA8 */ (GPIO_OUTPUT|GPIO_PUSHPULL|GPIO_SPEED_2MHz|GPIO_OUTPUT_CLEAR|GPIO_PORTA|GPIO_PIN8) /* PWM */ -#define DIRECT_PWM_OUTPUT_CHANNELS 8 +#define DIRECT_PWM_OUTPUT_CHANNELS 14 +#define BOARD_NUM_IO_TIMERS 4 /* Power supply control and monitoring GPIOs */ #define BOARD_NUMBER_BRICKS 2 diff --git a/boards/cuav/x7pro/src/spi.cpp b/boards/cuav/x7pro/src/spi.cpp index 66bef692c6..ef4ad00832 100644 --- a/boards/cuav/x7pro/src/spi.cpp +++ b/boards/cuav/x7pro/src/spi.cpp @@ -56,7 +56,6 @@ constexpr px4_spi_bus_t px4_spi_buses[SPI_BUS_MAX_BUS_ITEMS] = { }), initSPIBus(SPI::Bus::SPI6, { initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortI, GPIO::Pin12}, SPI::DRDY{GPIO::PortH, GPIO::Pin5}), - //initSPIDevice(DRV_IMU_DEVTYPE_ICM20649, SPI::CS{GPIO::PortI, GPIO::Pin12}), initSPIDevice(DRV_BARO_DEVTYPE_MS5611, SPI::CS{GPIO::PortI, GPIO::Pin8}), }), }; diff --git a/boards/cuav/x7pro/src/timer_config.cpp b/boards/cuav/x7pro/src/timer_config.cpp index 47d5c11a34..0885466267 100644 --- a/boards/cuav/x7pro/src/timer_config.cpp +++ b/boards/cuav/x7pro/src/timer_config.cpp @@ -36,12 +36,11 @@ constexpr io_timers_t io_timers[MAX_IO_TIMERS] = { initIOTimer(Timer::Timer5, DMA{DMA::Index1}), initIOTimer(Timer::Timer4, DMA{DMA::Index1}), - // initIOTimer(Timer::Timer1, DMA{DMA::Index1}), - // initIOTimer(Timer::Timer12, DMA{DMA::Index1}), + initIOTimer(Timer::Timer1, DMA{DMA::Index1}), + initIOTimer(Timer::Timer12), }; constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { - // MAIN initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel1}, {GPIO::PortH, GPIO::Pin10}), initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel2}, {GPIO::PortH, GPIO::Pin11}), initIOTimerChannel(io_timers, {Timer::Timer5, Timer::Channel3}, {GPIO::PortH, GPIO::Pin12}), @@ -50,14 +49,12 @@ constexpr timer_io_channels_t timer_io_channels[MAX_TIMER_IO_CHANNELS] = { initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel2}, {GPIO::PortD, GPIO::Pin13}), initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel3}, {GPIO::PortD, GPIO::Pin14}), initIOTimerChannel(io_timers, {Timer::Timer4, Timer::Channel4}, {GPIO::PortD, GPIO::Pin15}), - - // AUX - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}), - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortA, GPIO::Pin10}), - // initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), - // initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel1}, {GPIO::PortH, GPIO::Pin6}), - // initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel2}, {GPIO::PortH, GPIO::Pin9}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel1}, {GPIO::PortE, GPIO::Pin9}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel2}, {GPIO::PortE, GPIO::Pin11}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel3}, {GPIO::PortA, GPIO::Pin10}), + initIOTimerChannel(io_timers, {Timer::Timer1, Timer::Channel4}, {GPIO::PortE, GPIO::Pin14}), + initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel1}, {GPIO::PortH, GPIO::Pin6}), + initIOTimerChannel(io_timers, {Timer::Timer12, Timer::Channel2}, {GPIO::PortH, GPIO::Pin9}), }; constexpr io_timers_channel_mapping_t io_timers_channel_mapping = @@ -81,7 +78,6 @@ static inline constexpr timer_io_channels_t initIOTimerChannelLED(const io_timer } constexpr timer_io_channels_t led_pwm_channels[MAX_TIMER_LED_CHANNELS] = { - initIOTimerChannelLED(led_pwm_timers, {Timer::Timer8, Timer::Channel1}, {GPIO::PortI, GPIO::Pin5}, 1), initIOTimerChannelLED(led_pwm_timers, {Timer::Timer8, Timer::Channel2}, {GPIO::PortI, GPIO::Pin6}, 2), initIOTimerChannelLED(led_pwm_timers, {Timer::Timer8, Timer::Channel3}, {GPIO::PortI, GPIO::Pin7}, 3), diff --git a/boards/cubepilot/cubeorange/init/rc.board_defaults b/boards/cubepilot/cubeorange/init/rc.board_defaults index 174c75be77..c11a0a4ba6 100644 --- a/boards/cubepilot/cubeorange/init/rc.board_defaults +++ b/boards/cubepilot/cubeorange/init/rc.board_defaults @@ -13,9 +13,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/boards/holybro/durandal-v1/init/rc.board_defaults b/boards/holybro/durandal-v1/init/rc.board_defaults index 70c672815a..3ab7262970 100644 --- a/boards/holybro/durandal-v1/init/rc.board_defaults +++ b/boards/holybro/durandal-v1/init/rc.board_defaults @@ -14,9 +14,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/boards/mro/pixracerpro/init/rc.board_defaults b/boards/mro/pixracerpro/init/rc.board_defaults index f19ec43192..1c9f030d78 100644 --- a/boards/mro/pixracerpro/init/rc.board_defaults +++ b/boards/mro/pixracerpro/init/rc.board_defaults @@ -13,9 +13,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/boards/px4/fmu-v2/init/rc.board_defaults b/boards/px4/fmu-v2/init/rc.board_defaults index 76ee1950b1..ea5530a5cd 100644 --- a/boards/px4/fmu-v2/init/rc.board_defaults +++ b/boards/px4/fmu-v2/init/rc.board_defaults @@ -14,9 +14,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/boards/px4/fmu-v3/init/rc.board_defaults b/boards/px4/fmu-v3/init/rc.board_defaults index 98ac408a7e..afea2e2bb7 100644 --- a/boards/px4/fmu-v3/init/rc.board_defaults +++ b/boards/px4/fmu-v3/init/rc.board_defaults @@ -14,9 +14,9 @@ then then param set SYS_BL_UPDATE 0 param save - echo "BL update..." >> $LOG_FILE + echo "BL update..." bl_update $BL_FILE - echo "BL update done" >> $LOG_FILE + echo "BL update done" reboot fi fi diff --git a/src/drivers/dshot/DShot.h b/src/drivers/dshot/DShot.h index b0519a247d..332dfd3615 100644 --- a/src/drivers/dshot/DShot.h +++ b/src/drivers/dshot/DShot.h @@ -89,6 +89,7 @@ public: PORT_MODE_UNSET = 0, PORT_FULL_GPIO, PORT_FULL_PWM, + PORT_PWM14, PORT_PWM8, PORT_PWM6, PORT_PWM5, diff --git a/src/drivers/pwm_out/CMakeLists.txt b/src/drivers/pwm_out/CMakeLists.txt index 017865fdb4..b377447045 100644 --- a/src/drivers/pwm_out/CMakeLists.txt +++ b/src/drivers/pwm_out/CMakeLists.txt @@ -37,6 +37,10 @@ px4_add_module( SRCS PWMOut.cpp PWMOut.hpp + MODULE_CONFIG + pwm_main_params.yaml + pwm_aux_params.yaml + pwm_extra_params.yaml DEPENDS arch_io_pins mixer diff --git a/src/drivers/pwm_out/PWMOut.cpp b/src/drivers/pwm_out/PWMOut.cpp index 9b3f0b9117..e9241c751b 100644 --- a/src/drivers/pwm_out/PWMOut.cpp +++ b/src/drivers/pwm_out/PWMOut.cpp @@ -109,6 +109,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x1; _pwm_initialized = false; _num_outputs = 1; + update_params(); break; #if defined(BOARD_HAS_CAPTURE) @@ -131,6 +132,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x3; _pwm_initialized = false; _num_outputs = 2; + update_params(); break; @@ -153,6 +155,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x7; _pwm_initialized = false; _num_outputs = 3; + update_params(); break; @@ -175,6 +178,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0xf; _pwm_initialized = false; _num_outputs = 4; + update_params(); break; @@ -191,6 +195,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x0f; _pwm_initialized = false; _num_outputs = 4; + update_params(); break; #endif @@ -214,6 +219,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x1f; _pwm_initialized = false; _num_outputs = 5; + update_params(); break; @@ -229,13 +235,14 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x3f; _pwm_initialized = false; _num_outputs = 6; + update_params(); break; #endif #if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8 - case MODE_8PWM: // AeroCore PWMs as 8 PWM outs + case MODE_8PWM: PX4_DEBUG("MODE_8PWM"); /* default output rates */ _pwm_default_rate = 50; @@ -244,6 +251,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0xff; _pwm_initialized = false; _num_outputs = 8; + update_params(); break; #endif @@ -259,6 +267,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x3fff; _pwm_initialized = false; _num_outputs = 14; + update_params(); break; #endif @@ -272,6 +281,7 @@ int PWMOut::set_mode(Mode mode) _pwm_mask = 0x0; _pwm_initialized = false; _num_outputs = 0; + update_params(); if (old_mask != _pwm_mask) { /* disable servo outputs - no need to set rates */ @@ -426,82 +436,6 @@ void PWMOut::update_current_rate() _mixing_output.setMaxTopicUpdateRate(update_interval_in_us); } -void PWMOut::update_pwm_rev_mask() -{ - uint16_t &reverse_pwm_mask = _mixing_output.reverseOutputMask(); - reverse_pwm_mask = 0; - - const char *pname_format; - - if (_class_instance == CLASS_DEVICE_PRIMARY) { - pname_format = "PWM_MAIN_REV%d"; - - } else if (_class_instance == CLASS_DEVICE_SECONDARY) { - pname_format = "PWM_AUX_REV%d"; - - } else { - PX4_ERR("PWM REV only for MAIN and AUX"); - return; - } - - for (unsigned i = 0; i < FMU_MAX_ACTUATORS; i++) { - char pname[16]; - - /* fill the channel reverse mask from parameters */ - sprintf(pname, pname_format, i + 1); - param_t param_h = param_find(pname); - - if (param_h != PARAM_INVALID) { - int32_t ival = 0; - param_get(param_h, &ival); - reverse_pwm_mask |= ((int16_t)(ival != 0)) << i; - } - } -} - -void PWMOut::update_pwm_trims() -{ - PX4_DEBUG("update_pwm_trims"); - - if (!_mixing_output.mixers()) { - return; - } - - int16_t values[FMU_MAX_ACTUATORS] = {}; - - const char *pname_format; - - if (_class_instance == CLASS_DEVICE_PRIMARY) { - pname_format = "PWM_MAIN_TRIM%d"; - - } else if (_class_instance == CLASS_DEVICE_SECONDARY) { - pname_format = "PWM_AUX_TRIM%d"; - - } else { - PX4_ERR("PWM TRIM only for MAIN and AUX"); - return; - } - - for (unsigned i = 0; i < FMU_MAX_ACTUATORS; i++) { - char pname[16]; - - /* fill the struct from parameters */ - sprintf(pname, pname_format, i + 1); - param_t param_h = param_find(pname); - - if (param_h != PARAM_INVALID) { - float pval = 0.0f; - param_get(param_h, &pval); - values[i] = (int16_t)(10000 * pval); - PX4_DEBUG("%s: %d", pname, values[i]); - } - } - - /* copy the trim values to the mixer offsets */ - unsigned n_out = _mixing_output.mixers()->set_trims(values, FMU_MAX_ACTUATORS); - PX4_DEBUG("set %d trims", n_out); -} - int PWMOut::task_spawn(int argc, char *argv[]) { PWMOut *instance = new PWMOut(); @@ -621,10 +555,171 @@ void PWMOut::Run() void PWMOut::update_params() { - update_pwm_rev_mask(); - update_pwm_trims(); - updateParams(); + + // skip update when armed + if (_mixing_output.armed().armed) { + return; + } + + int32_t pwm_min_default = PWM_DEFAULT_MIN; + int32_t pwm_max_default = PWM_DEFAULT_MAX; + int32_t pwm_disarmed_default = 0; + int32_t pwm_rate_default = 50; + + const char *prefix; + + if (_class_instance == CLASS_DEVICE_PRIMARY) { + prefix = "PWM_MAIN"; + + param_get(param_find("PWM_MIN"), &pwm_min_default); + param_get(param_find("PWM_MAX"), &pwm_max_default); + param_get(param_find("PWM_DISARMED"), &pwm_disarmed_default); + param_get(param_find("PWM_RATE"), &pwm_rate_default); + + } else if (_class_instance == CLASS_DEVICE_SECONDARY) { + prefix = "PWM_AUX"; + + param_get(param_find("PWM_AUX_MIN"), &pwm_min_default); + param_get(param_find("PWM_AUX_MAX"), &pwm_max_default); + param_get(param_find("PWM_AUX_DISARMED"), &pwm_disarmed_default); + param_get(param_find("PWM_AUX_RATE"), &pwm_rate_default); + + } else if (_class_instance == CLASS_DEVICE_TERTIARY) { + prefix = "PWM_EXTRA"; + + param_get(param_find("PWM_EXTRA_MIN"), &pwm_min_default); + param_get(param_find("PWM_EXTRA_MAX"), &pwm_max_default); + param_get(param_find("PWM_EXTRA_DISARM"), &pwm_disarmed_default); + param_get(param_find("PWM_EXTRA_RATE"), &pwm_rate_default); + + } else { + PX4_ERR("invalid class instance %d", _class_instance); + return; + } + + // update the counter + // this is needed to decide if disarmed PWM output should be turned on or not + int num_disarmed_set = 0; + + char str[17]; + + for (unsigned i = 0; i < _num_outputs; i++) { + // PWM_MAIN_MINx + { + sprintf(str, "%s_MIN%u", prefix, i + 1); + int32_t pwm_min = -1; + + if (param_get(param_find(str), &pwm_min) == PX4_OK) { + if (pwm_min >= 0) { + _mixing_output.minValue(i) = math::constrain(pwm_min, PWM_LOWEST_MIN, PWM_HIGHEST_MIN); + + if (pwm_min != _mixing_output.minValue(i)) { + int32_t pwm_min_new = _mixing_output.minValue(i); + param_set(param_find(str), &pwm_min_new); + } + + } else { + _mixing_output.minValue(i) = pwm_min_default; + } + } + } + + // PWM_MAIN_MAXx + { + sprintf(str, "%s_MAX%u", prefix, i + 1); + int32_t pwm_max = -1; + + if (param_get(param_find(str), &pwm_max) == PX4_OK) { + if (pwm_max >= 0) { + _mixing_output.maxValue(i) = math::constrain(pwm_max, PWM_LOWEST_MAX, PWM_HIGHEST_MAX); + + if (pwm_max != _mixing_output.maxValue(i)) { + int32_t pwm_max_new = _mixing_output.maxValue(i); + param_set(param_find(str), &pwm_max_new); + } + + } else { + _mixing_output.maxValue(i) = pwm_max_default; + } + } + } + + // PWM_MAIN_FAILx + { + sprintf(str, "%s_FAIL%u", prefix, i + 1); + int32_t pwm_failsafe = -1; + + if (param_get(param_find(str), &pwm_failsafe) == PX4_OK) { + if (pwm_failsafe >= 0) { + _mixing_output.failsafeValue(i) = math::constrain(pwm_failsafe, 0, PWM_HIGHEST_MAX); + + if (pwm_failsafe != _mixing_output.failsafeValue(i)) { + int32_t pwm_fail_new = _mixing_output.failsafeValue(i); + param_set(param_find(str), &pwm_fail_new); + } + } + } + } + + // PWM_MAIN_DISx + { + sprintf(str, "%s_DIS%u", prefix, i + 1); + int32_t pwm_dis = -1; + + if (param_get(param_find(str), &pwm_dis) == PX4_OK) { + if (pwm_dis >= 0) { + _mixing_output.disarmedValue(i) = math::constrain(pwm_dis, 0, PWM_HIGHEST_MAX); + + if (pwm_dis != _mixing_output.disarmedValue(i)) { + int32_t pwm_dis_new = _mixing_output.disarmedValue(i); + param_set(param_find(str), &pwm_dis_new); + } + + } else { + _mixing_output.disarmedValue(i) = pwm_disarmed_default; + } + } + + if (_mixing_output.disarmedValue(i) > 0) { + num_disarmed_set++; + } + } + + // PWM_MAIN_REVx + { + sprintf(str, "%s_REV%u", prefix, i + 1); + int32_t pwm_rev = 0; + + if (param_get(param_find(str), &pwm_rev) == PX4_OK) { + uint16_t &reverse_pwm_mask = _mixing_output.reverseOutputMask(); + + if (pwm_rev >= 1) { + reverse_pwm_mask = reverse_pwm_mask | (2 << i); + + } else { + reverse_pwm_mask = reverse_pwm_mask & ~(2 << i); + } + } + } + } + + if (_mixing_output.mixers()) { + int16_t values[FMU_MAX_ACTUATORS] {}; + + for (unsigned i = 0; i < _num_outputs; i++) { + sprintf(str, "%s_TRIM%u", prefix, i + 1); + + float pval = 0.0f; + param_get(param_find(str), &pval); + values[i] = roundf(10000 * pval); + } + + // copy the trim values to the mixer offsets + _mixing_output.mixers()->set_trims(values, _num_outputs); + } + + _num_disarmed_set = num_disarmed_set; } int PWMOut::ioctl(file *filp, int cmd, unsigned long arg) @@ -903,8 +998,8 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) pwm->channel_count = FMU_MAX_ACTUATORS; arg = (unsigned long)&pwm; - break; } + break; case PWM_SERVO_GET_TRIM_PWM: { struct pwm_output_values *pwm = (struct pwm_output_values *)arg; @@ -917,9 +1012,8 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) pwm->channel_count = _mixing_output.mixers()->get_trims((int16_t *)pwm->values); } - - break; } + break; #if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 14 @@ -937,6 +1031,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) #endif #if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8 + /* FALLTHROUGH */ case PWM_SERVO_SET(7): /* FALLTHROUGH */ @@ -1197,6 +1292,10 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) ret = set_mode(MODE_8PWM); break; + case PWM_SERVO_MODE_14PWM: + ret = set_mode(MODE_14PWM); + break; + case PWM_SERVO_MODE_4CAP: ret = set_mode(MODE_4CAP); break; @@ -1233,7 +1332,7 @@ int PWMOut::pwm_ioctl(file *filp, int cmd, unsigned long arg) const char *buf = (const char *)arg; unsigned buflen = strlen(buf); ret = _mixing_output.loadMixerThreadSafe(buf, buflen); - update_pwm_trims(); + update_params(); break; } @@ -1457,6 +1556,13 @@ int PWMOut::fmu_new_mode(PortMode new_mode) servo_mode = PWMOut::MODE_1PWM; break; +#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 14 + + case PORT_PWM14: + /* select 14-pin PWM mode */ + servo_mode = PWMOut::MODE_14PWM; + break; +#endif #if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8 case PORT_PWM8: @@ -1880,13 +1986,18 @@ int PWMOut::custom_command(int argc, char *argv[]) #if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8 } else if (!strcmp(verb, "mode_pwm8")) { - new_mode = PORT_PWM8; + new_mode = PORT_PWM14; #endif +#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 14 + + } else if (!strcmp(verb, "mode_pwm14")) { + new_mode = PORT_PWM14; +#endif + } /* was a new mode set? */ if (new_mode != PORT_MODE_UNSET) { - /* switch modes */ return PWMOut::fmu_new_mode(new_mode); } @@ -1931,6 +2042,8 @@ int PWMOut::print_status() case MODE_8PWM: mode_str = "pwm8"; break; + case MODE_14PWM: mode_str = "pwm14"; break; + case MODE_4CAP: mode_str = "cap4"; break; case MODE_5CAP: mode_str = "cap5"; break; @@ -1995,24 +2108,27 @@ mixer files. PRINT_MODULE_USAGE_PARAM_COMMENT("All of the mode_* commands will start pwm_out if not running already"); PRINT_MODULE_USAGE_COMMAND("mode_gpio"); - PRINT_MODULE_USAGE_COMMAND_DESCR("mode_pwm", "Select all available pins as PWM"); -#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 8 - PRINT_MODULE_USAGE_COMMAND("mode_pwm8"); -#endif -#if defined(BOARD_HAS_PWM) && BOARD_HAS_PWM >= 6 - PRINT_MODULE_USAGE_COMMAND("mode_pwm6"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm5"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm5cap1"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm4"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm4cap1"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm4cap2"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm3"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm3cap1"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm2"); - PRINT_MODULE_USAGE_COMMAND("mode_pwm2cap2"); -#endif #if defined(BOARD_HAS_PWM) - PRINT_MODULE_USAGE_COMMAND("mode_pwm1"); + PRINT_MODULE_USAGE_COMMAND_DESCR("mode_pwm", "Select all available pins as PWM"); +# if BOARD_HAS_PWM >= 14 + PRINT_MODULE_USAGE_COMMAND("mode_pwm14"); +# endif +# if BOARD_HAS_PWM >= 8 + PRINT_MODULE_USAGE_COMMAND("mode_pwm8"); +# endif +# if BOARD_HAS_PWM >= 6 + PRINT_MODULE_USAGE_COMMAND("mode_pwm6"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm5"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm5cap1"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm4"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm4cap1"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm4cap2"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm3"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm3cap1"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm2"); + PRINT_MODULE_USAGE_COMMAND("mode_pwm2cap2"); +# endif + PRINT_MODULE_USAGE_COMMAND("mode_pwm1"); #endif PRINT_MODULE_USAGE_COMMAND_DESCR("sensor_reset", "Do a sensor reset (SPI bus)"); diff --git a/src/drivers/pwm_out/PWMOut.hpp b/src/drivers/pwm_out/PWMOut.hpp index 768d592cb1..bb12fbee44 100644 --- a/src/drivers/pwm_out/PWMOut.hpp +++ b/src/drivers/pwm_out/PWMOut.hpp @@ -69,6 +69,7 @@ enum PortMode { PORT_MODE_UNSET = 0, PORT_FULL_GPIO, PORT_FULL_PWM, + PORT_PWM14, PORT_PWM8, PORT_PWM6, PORT_PWM5, @@ -148,8 +149,6 @@ public: hrt_abstime edge_time, uint32_t edge_state, uint32_t overflow); - void update_pwm_trims(); - bool updateOutputs(bool stop_motors, uint16_t outputs[MAX_ACTUATORS], unsigned num_outputs, unsigned num_control_groups_updated) override; @@ -189,7 +188,7 @@ private: void update_current_rate(); int set_pwm_rate(unsigned rate_map, unsigned default_rate, unsigned alt_rate); int pwm_ioctl(file *filp, int cmd, unsigned long arg); - void update_pwm_rev_mask(); + void update_pwm_out_state(bool on); void update_params(); diff --git a/src/drivers/pwm_out/pwm_aux_params.yaml b/src/drivers/pwm_out/pwm_aux_params.yaml new file mode 100644 index 0000000000..32e8cefe28 --- /dev/null +++ b/src/drivers/pwm_out/pwm_aux_params.yaml @@ -0,0 +1,147 @@ +__max_num_config_instances: &max_num_config_instances 8 + +module_name: pwm_out + +parameters: + - group: PWM Outputs + definitions: + + PWM_AUX_RATE: + description: + short: PWM aux output frequency + long: | + Set to 400 for industry default or 1000 for high frequency ESCs. + Set to 0 for Oneshot125. + type: int32 + unit: Hz + min: -1 + max: 2000 + default: 50 + + PWM_AUX_MIN: + description: + short: PWM aux minimum value + long: | + Set to 1000 for industry default or 900 to increase servo travel. + type: int32 + unit: us + min: 800 + max: 1400 + default: 1000 + + PWM_AUX_MAX: + description: + short: PWM aux maximum value + long: | + Set to 2000 for industry default or 2100 to increase servo travel. + type: int32 + unit: us + min: 1600 + max: 2200 + default: 2000 + + PWM_AUX_DISARMED: + description: + short: PWM aux disarmed value + long: | + This is the PWM pulse the autopilot is outputting if not armed. + The main use of this parameter is to silence ESCs when they are disarmed. + type: int32 + unit: us + min: 0 + max: 2200 + default: 1500 + + PWM_AUX_MIN${i}: + description: + short: PWM aux ${i} minimum value + long: | + This is the minimum PWM pulse the autopilot is allowed to output. + When set to -1 the value for PWM_AUX_MIN will be used + type: int32 + unit: us + min: -1 + max: 1600 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_AUX_MAX${i}: + description: + short: PWM aux ${i} maximum value + long: | + This is the maximum PWM pulse the autopilot is allowed to output. + When set to -1 the value for PWM_AUX_MAX will be used + type: int32 + unit: us + min: -1 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_AUX_FAIL${i}: + description: + short: PWM aux ${i} failsafe value + long: | + This is the PWM pulse the autopilot is outputting if in failsafe mode. + When set to -1 the value is set automatically depending if the actuator + is a motor (900us) or a servo (1500us) + type: int32 + unit: us + min: 0 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_AUX_DIS${i}: + description: + short: PWM aux ${i} disarmed value + long: | + This is the PWM pulse the autopilot is outputting if not armed. + When set to -1 the value for PWM_AUX_DISARMED will be used + type: int32 + unit: us + min: -1 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_AUX_TRIM${i}: + description: + short: PWM aux ${i} trim value + long: | + Set to normalized offset + type: float + min: -0.2 + max: 0.2 + decimal: 2 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_AUX_REV${i}: + description: + short: PWM aux ${i} reverse value + long: | + Enable to invert the channel. + Warning: Use this parameter when connected to a servo only. + For a brushless motor, invert manually two phases to reverse the direction. + type: boolean + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_AUX_RATE${i}: + description: + short: PWM aux ${i} rate + long: | + Set the default PWM output frequency for the aux outputs + type: int32 + unit: Hz + min: 0 + max: 400 + instance_start: 1 + default: 50 diff --git a/src/drivers/pwm_out/pwm_extra_params.yaml b/src/drivers/pwm_out/pwm_extra_params.yaml new file mode 100644 index 0000000000..fcacc754ce --- /dev/null +++ b/src/drivers/pwm_out/pwm_extra_params.yaml @@ -0,0 +1,147 @@ +__max_num_config_instances: &max_num_config_instances 8 + +module_name: pwm_out + +parameters: + - group: PWM Outputs + definitions: + + PWM_EXTRA_RATE: + description: + short: PWM extra output frequency + long: | + Set to 400 for industry default or 1000 for high frequency ESCs. + Set to 0 for Oneshot125. + type: int32 + unit: Hz + min: -1 + max: 2000 + default: 50 + + PWM_EXTRA_MIN: + description: + short: PWM extra minimum value + long: | + Set to 1000 for industry default or 900 to increase servo travel. + type: int32 + unit: us + min: 800 + max: 1400 + default: 1000 + + PWM_EXTRA_MAX: + description: + short: PWM extra maximum value + long: | + Set to 2000 for industry default or 2100 to increase servo travel. + type: int32 + unit: us + min: 1600 + max: 2200 + default: 2000 + + PWM_EXTRA_DISARM: + description: + short: PWM extra disarmed value + long: | + This is the PWM pulse the autopilot is outputting if not armed. + The main use of this parameter is to silence ESCs when they are disarmed. + type: int32 + unit: us + min: 0 + max: 2200 + default: 1500 + + PWM_EXTRA_MIN${i}: + description: + short: PWM extra ${i} minimum value + long: | + This is the minimum PWM pulse the autopilot is allowed to output. + When set to -1 the value for PWM_EXTRA_MIN will be used + type: int32 + unit: us + min: -1 + max: 1600 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_EXTRA_MAX${i}: + description: + short: PWM extra ${i} maximum value + long: | + This is the maximum PWM pulse the autopilot is allowed to output. + When set to -1 the value for PWM_EXTRA_MAX will be used + type: int32 + unit: us + min: -1 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_EXTRA_FAIL${i}: + description: + short: PWM extra ${i} failsafe value + long: | + This is the PWM pulse the autopilot is outputting if in failsafe mode. + When set to -1 the value is set automatically depending if the actuator + is a motor (900us) or a servo (1500us) + type: int32 + unit: us + min: 0 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_EXTRA_DIS${i}: + description: + short: PWM extra ${i} disarmed value + long: | + This is the PWM pulse the autopilot is outputting if not armed. + When set to -1 the value for PWM_EXTRA_DISARM will be used + type: int32 + unit: us + min: -1 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_EXTRA_TRIM${i}: + description: + short: PWM extra ${i} trim value + long: | + Set to normalized offset + type: float + min: -0.2 + max: 0.2 + decimal: 2 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_EXTRA_REV${i}: + description: + short: PWM extra ${i} reverse value + long: | + Enable to invert the channel. + Warning: Use this parameter when connected to a servo only. + For a brushless motor, invert manually two phases to reverse the direction. + type: boolean + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_EXTRA_RATE${i}: + description: + short: PWM extra ${i} rate + long: | + Set the default PWM output frequency for the main outputs + type: int32 + unit: Hz + min: 0 + max: 400 + instance_start: 1 + default: 50 diff --git a/src/drivers/pwm_out/pwm_main_params.yaml b/src/drivers/pwm_out/pwm_main_params.yaml new file mode 100644 index 0000000000..28f5414dc0 --- /dev/null +++ b/src/drivers/pwm_out/pwm_main_params.yaml @@ -0,0 +1,147 @@ +__max_num_config_instances: &max_num_config_instances 14 + +module_name: pwm_out + +parameters: + - group: PWM Outputs + definitions: + + PWM_RATE: + description: + short: PWM main output frequency + long: | + Set to 400 for industry default or 1000 for high frequency ESCs. + Set to 0 for Oneshot125. + type: int32 + unit: Hz + min: -1 + max: 2000 + default: 400 + + PWM_MAIN_MIN: + description: + short: PWM main minimum value + long: | + Set to 1000 for industry default or 900 to increase servo travel. + type: int32 + unit: us + min: 800 + max: 1400 + default: 1000 + + PWM_MAIN_MAX: + description: + short: PWM main maximum value + long: | + Set to 2000 for industry default or 2100 to increase servo travel. + type: int32 + unit: us + min: 1600 + max: 2200 + default: 2000 + + PWM_DISARMED: + description: + short: PWM main disarmed value + long: | + This is the PWM pulse the autopilot is outputting if not armed. + The main use of this parameter is to silence ESCs when they are disarmed. + type: int32 + unit: us + min: 0 + max: 2200 + default: 900 + + PWM_MAIN_MIN${i}: + description: + short: PWM main ${i} minimum value + long: | + This is the minimum PWM pulse the autopilot is allowed to output. + When set to -1 the value for PWM_MIN will be used + type: int32 + unit: us + min: -1 + max: 1600 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_MAIN_MAX${i}: + description: + short: PWM main ${i} maximum value + long: | + This is the maximum PWM pulse the autopilot is allowed to output. + When set to -1 the value for PWM_MAX will be used + type: int32 + unit: us + min: -1 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_MAIN_FAIL${i}: + description: + short: PWM main ${i} failsafe value + long: | + This is the PWM pulse the autopilot is outputting if in failsafe mode. + When set to -1 the value is set automatically depending if the actuator + is a motor (900us) or a servo (1500us) + type: int32 + unit: us + min: 0 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_MAIN_DIS${i}: + description: + short: PWM main ${i} disarmed value + long: | + This is the PWM pulse the autopilot is outputting if not armed. + When set to -1 the value for PWM_DISARMED will be used + type: int32 + unit: us + min: -1 + max: 2150 + num_instances: *max_num_config_instances + instance_start: 1 + default: -1 + + PWM_MAIN_TRIM${i}: + description: + short: PWM main ${i} trim value + long: | + Set to normalized offset + type: float + min: -0.2 + max: 0.2 + decimal: 2 + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_MAIN_REV${i}: + description: + short: PWM main ${i} reverse value + long: | + Enable to invert the channel. + Warning: Use this parameter when connected to a servo only. + For a brushless motor, invert manually two phases to reverse the direction. + type: boolean + num_instances: *max_num_config_instances + instance_start: 1 + default: 0 + + PWM_MAIN_RATE${i}: + description: + short: PWM main ${i} rate + long: | + Set the default PWM output frequency for the main outputs + type: int32 + unit: Hz + min: 0 + max: 400 + instance_start: 1 + default: 50 diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 19970fc178..9b8f837beb 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -425,6 +425,8 @@ private: */ void answer_command(const vehicle_command_s &cmd, uint8_t result); + void update_params(); + /** * check and handle test_motor topic updates */ @@ -1075,51 +1077,6 @@ PX4IO::task_main() } } - /* - * Set invert mask for PWM outputs (does not apply to S.Bus) - */ - int16_t pwm_invert_mask = 0; - - for (unsigned i = 0; i < _max_actuators; i++) { - char pname[16]; - int32_t ival; - - /* fill the channel reverse mask from parameters */ - sprintf(pname, "PWM_MAIN_REV%u", i + 1); - param_t param_h = param_find(pname); - - if (param_h != PARAM_INVALID) { - param_get(param_h, &ival); - pwm_invert_mask |= ((int16_t)(ival != 0)) << i; - } - } - - (void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_REVERSE, pwm_invert_mask); - - // update trim values - struct pwm_output_values pwm_values; - -// memset(&pwm_values, 0, sizeof(pwm_values)); -// ret = io_reg_get(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, (uint16_t *)pwm_values.values, _max_actuators); - - for (unsigned i = 0; i < _max_actuators; i++) { - char pname[16]; - float pval; - - /* fetch the trim values from parameters */ - sprintf(pname, "PWM_MAIN_TRIM%u", i + 1); - param_t param_h = param_find(pname); - - if (param_h != PARAM_INVALID) { - - param_get(param_h, &pval); - pwm_values.values[i] = (int16_t)(10000 * pval); - } - } - - /* copy values to registers in IO */ - ret = io_reg_set(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, pwm_values.values, _max_actuators); - float param_val; param_t parm_handle; @@ -1211,6 +1168,8 @@ PX4IO::task_main() param_get(parm_handle, ¶m_val_int); (void)io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_AIRMODE, SIGNED_TO_REG(param_val_int)); } + + update_params(); } } @@ -1233,6 +1192,170 @@ out: _exit(0); } +void PX4IO::update_params() +{ + // skip update when armed + if (_armed) { + return; + } + + int32_t pwm_min_default = PWM_DEFAULT_MIN; + int32_t pwm_max_default = PWM_DEFAULT_MAX; + int32_t pwm_disarmed_default = 0; + int32_t pwm_rate_default = 50; + + const char *prefix = "PWM_MAIN"; + + param_get(param_find("PWM_MIN"), &pwm_min_default); + param_get(param_find("PWM_MAX"), &pwm_max_default); + param_get(param_find("PWM_DISARMED"), &pwm_disarmed_default); + param_get(param_find("PWM_RATE"), &pwm_rate_default); + + char str[17]; + + + // PWM_MAIN_MINx + { + pwm_output_values pwm{}; + pwm.channel_count = _max_actuators; + + for (unsigned i = 0; i < _max_actuators; i++) { + sprintf(str, "%s_MIN%u", prefix, i + 1); + int32_t pwm_min = -1; + + if (param_get(param_find(str), &pwm_min) == PX4_OK) { + if (pwm_min >= 0) { + pwm.values[i] = math::constrain(pwm_min, PWM_LOWEST_MIN, PWM_HIGHEST_MIN); + + if (pwm_min != pwm.values[i]) { + int32_t pwm_min_new = pwm.values[i]; + param_set(param_find(str), &pwm_min_new); + } + + } else { + pwm.values[i] = pwm_min_default; + } + } + } + + io_reg_set(PX4IO_PAGE_CONTROL_MIN_PWM, 0, pwm.values, pwm.channel_count); + } + + // PWM_MAIN_MAXx + { + pwm_output_values pwm{}; + pwm.channel_count = _max_actuators; + + for (unsigned i = 0; i < _max_actuators; i++) { + sprintf(str, "%s_MAX%u", prefix, i + 1); + int32_t pwm_max = -1; + + if (param_get(param_find(str), &pwm_max) == PX4_OK) { + if (pwm_max >= 0) { + pwm.values[i] = math::constrain(pwm_max, PWM_LOWEST_MAX, PWM_HIGHEST_MAX); + + if (pwm_max != pwm.values[i]) { + int32_t pwm_max_new = pwm.values[i]; + param_set(param_find(str), &pwm_max_new); + } + + } else { + pwm.values[i] = pwm_max_default; + } + } + } + + io_reg_set(PX4IO_PAGE_CONTROL_MAX_PWM, 0, pwm.values, pwm.channel_count); + } + + // PWM_MAIN_FAILx + { + pwm_output_values pwm{}; + pwm.channel_count = _max_actuators; + + for (unsigned i = 0; i < _max_actuators; i++) { + sprintf(str, "%s_FAIL%u", prefix, i + 1); + int32_t pwm_fail = -1; + + if (param_get(param_find(str), &pwm_fail) == PX4_OK) { + if (pwm_fail >= 0) { + pwm.values[i] = math::constrain(pwm_fail, 0, PWM_HIGHEST_MAX); + + if (pwm_fail != pwm.values[i]) { + int32_t pwm_fail_new = pwm.values[i]; + param_set(param_find(str), &pwm_fail_new); + } + } + } + } + + io_reg_set(PX4IO_PAGE_FAILSAFE_PWM, 0, pwm.values, pwm.channel_count); + } + + // PWM_MAIN_DISx + { + pwm_output_values pwm{}; + pwm.channel_count = _max_actuators; + + for (unsigned i = 0; i < _max_actuators; i++) { + sprintf(str, "%s_DIS%u", prefix, i + 1); + int32_t pwm_dis = -1; + + if (param_get(param_find(str), &pwm_dis) == PX4_OK) { + if (pwm_dis >= 0) { + pwm.values[i] = math::constrain(pwm_dis, 0, PWM_HIGHEST_MAX); + + if (pwm_dis != pwm.values[i]) { + int32_t pwm_dis_new = pwm.values[i]; + param_set(param_find(str), &pwm_dis_new); + } + + } else { + pwm.values[i] = pwm_disarmed_default; + } + } + } + + io_reg_set(PX4IO_PAGE_DISARMED_PWM, 0, pwm.values, pwm.channel_count); + } + + // PWM_MAIN_REVx + { + int16_t reverse_pwm_mask = 0; + + for (unsigned i = 0; i < _max_actuators; i++) { + sprintf(str, "%s_REV%u", prefix, i + 1); + int32_t pwm_rev = -1; + + if (param_get(param_find(str), &pwm_rev) == PX4_OK) { + if (pwm_rev >= 1) { + reverse_pwm_mask |= (2 << i); + } + + } + } + + io_reg_set(PX4IO_PAGE_SETUP, PX4IO_P_SETUP_PWM_REVERSE, reverse_pwm_mask); + } + + // PWM_MAIN_TRIMx + { + uint16_t values[8] {}; + + for (unsigned i = 0; i < _max_actuators; i++) { + sprintf(str, "%s_TRIM%u", prefix, i + 1); + float pwm_trim = 0.f; + + if (param_get(param_find(str), &pwm_trim) == PX4_OK) { + values[i] = (int16_t)(10000 * pwm_trim); + } + } + + // copy the trim values to the mixer offsets + io_reg_set(PX4IO_PAGE_CONTROL_TRIM_PWM, 0, values, _max_actuators); + } +} + int PX4IO::io_set_control_groups() { diff --git a/src/modules/sensors/pwm_params_aux.c b/src/modules/sensors/pwm_params_aux.c deleted file mode 100644 index 6dfe5dd39f..0000000000 --- a/src/modules/sensors/pwm_params_aux.c +++ /dev/null @@ -1,801 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file pwm_params_aux.c - * - * Parameters defined for PWM output. - * - */ - -/****************************************************************************** -* PWM_AUX_RATE * -******************************************************************************/ - -/** - * Set the PWM output frequency for the auxiliary outputs - * - * Set to 400 for industry default or 1000 for high frequency ESCs. - * - * Set to 0 for Oneshot125. - * - * @reboot_required true - * - * @min -1 - * @max 2000 - * @unit Hz - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_RATE, 50); - -/** - * Set the minimum PWM for the auxiliary outputs - * - * Set to 1000 for industry default or 900 to increase servo travel. - * - * @reboot_required true - * - * @min 800 - * @max 1400 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN, 1000); - -/** - * Set the maximum PWM for the auxiliary outputs - * - * Set to 2000 for industry default or 2100 to increase servo travel. - * - * @reboot_required true - * - * @min 1600 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX, 2000); - -/** - * Set the disarmed PWM for auxiliary outputs - * - * This is the PWM pulse the autopilot is outputting if not armed. - * The main use of this parameter is to silence ESCs when they are disarmed. - * - * @reboot_required true - * - * @min 0 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DISARMED, 1500); - -/****************************************************************************** -* PWM_AUX_MIN * -******************************************************************************/ -/** - * Set the min PWM value for the auxiliary 1 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN1, -1); - -/** - * Set the min PWM value for the auxiliary 2 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN2, -1); - -/** - * Set the min PWM value for the auxiliary 3 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN3, -1); - -/** - * Set the min PWM value for the auxiliary 4 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN4, -1); - -/** - * Set the min PWM value for the auxiliary 5 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN5, -1); - -/** - * Set the min PWM value for the auxiliary 6 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN6, -1); - -/** - * Set the min PWM value for the auxiliary 7 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN7, -1); - -/** - * Set the min PWM value for the auxiliary 8 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MIN8, -1); - -/****************************************************************************** -* PWM_AUX_MAX * -******************************************************************************/ -/** - * Set the max PWM value for the auxiliary 1 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX1, -1); - -/** - * Set the max PWM value for the auxiliary 2 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX2, -1); - -/** - * Set the max PWM value for the auxiliary 3 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX3, -1); - -/** - * Set the max PWM value for the auxiliary 4 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX4, -1); - -/** - * Set the max PWM value for the auxiliary 5 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX5, -1); - -/** - * Set the max PWM value for the auxiliary 6 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX6, -1); - -/** - * Set the max PWM value for the auxiliary 7 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX7, -1); - -/** - * Set the max PWM value for the auxiliary 8 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_AUX_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_MAX8, -1); - -/****************************************************************************** -* PWM_AUX_FAIL * -******************************************************************************/ -/** - * Set the failsafe PWM for the auxiliary 1 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL1, -1); - -/** - * Set the failsafe PWM for the auxiliary 2 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL2, -1); - -/** - * Set the failsafe PWM for the auxiliary 3 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL3, -1); - -/** - * Set the failsafe PWM for the auxiliary 4 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL4, -1); - -/** - * Set the failsafe PWM for the auxiliary 5 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL5, -1); - -/** - * Set the failsafe PWM for the auxiliary 6 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL6, -1); - -/** - * Set the failsafe PWM for the auxiliary 7 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL7, -1); - -/** - * Set the failsafe PWM for the auxiliary 8 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_FAIL8, -1); - -/****************************************************************************** -* PWM_AUX_DIS * -******************************************************************************/ -/** - * Set the disarmed PWM for the auxiliary 1 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS1, -1); - -/** - * Set the disarmed PWM for the auxiliary 2 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS2, -1); - -/** - * Set the disarmed PWM for the auxiliary 3 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS3, -1); - -/** - * Set the disarmed PWM for the auxiliary 4 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS4, -1); - -/** - * Set the disarmed PWM for the auxiliary 5 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS5, -1); - -/** - * Set the disarmed PWM for the auxiliary 6 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS6, -1); - -/** - * Set the disarmed PWM for the auxiliary 7 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS7, -1); - -/** - * Set the disarmed PWM for the auxiliary 8 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_AUX_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_DIS8, -1); - -/****************************************************************************** -* PWM_AUX_REV * -******************************************************************************/ -/** - * Invert direction of auxiliary output channel 1 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV1, 0); - -/** - * Invert direction of auxiliary output channel 2 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV2, 0); - -/** - * Invert direction of auxiliary output channel 3 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV3, 0); - -/** - * Invert direction of auxiliary output channel 4 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV4, 0); - -/** - * Invert direction of auxiliary output channel 5 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV5, 0); - -/** - * Invert direction of auxiliary output channel 6 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV6, 0); - -/** - * Invert direction of auxiliary output channel 7 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV7, 0); - -/** - * Invert direction of auxiliary output channel 8 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_AUX_REV8, 0); - -/****************************************************************************** -* PWM_AUX_TRIM * -******************************************************************************/ - -/** - * Trim value for auxiliary output channel 1 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM1, 0); - -/** - * Trim value for auxiliary output channel 2 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM2, 0); - -/** - * Trim value for auxiliary output channel 3 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM3, 0); - -/** - * Trim value for auxiliary output channel 4 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM4, 0); - -/** - * Trim value for auxiliary output channel 5 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM5, 0); - -/** - * Trim value for auxiliary output channel 6 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM6, 0); - -/** - * Trim value for auxiliary output channel 7 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM7, 0); - -/** - * Trim value for auxiliary output channel 8 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_AUX_TRIM8, 0); diff --git a/src/modules/sensors/pwm_params_extra.c b/src/modules/sensors/pwm_params_extra.c deleted file mode 100644 index b62cab207c..0000000000 --- a/src/modules/sensors/pwm_params_extra.c +++ /dev/null @@ -1,801 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file pwm_params_extra.c - * - * Parameters defined for PWM output. - * - */ - -/****************************************************************************** -* PWM_EXTRA_RATE * -******************************************************************************/ - -/** - * Set the PWM output frequency for the extra outputs - * - * Set to 400 for industry default or 1000 for high frequency ESCs. - * - * Set to 0 for Oneshot125. - * - * @reboot_required true - * - * @min -1 - * @max 2000 - * @unit Hz - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_RATE, 50); - -/** - * Set the minimum PWM for the extra outputs - * - * Set to 1000 for industry default or 900 to increase servo travel. - * - * @reboot_required true - * - * @min 800 - * @max 1400 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN, 1000); - -/** - * Set the maximum PWM for the extra outputs - * - * Set to 2000 for industry default or 2100 to increase servo travel. - * - * @reboot_required true - * - * @min 1600 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX, 2000); - -/** - * Set the disarmed PWM for extra outputs - * - * This is the PWM pulse the autopilot is outputting if not armed. - * The main use of this parameter is to silence ESCs when they are disarmed. - * - * @reboot_required true - * - * @min 0 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DISARM, 1500); - -/****************************************************************************** -* PWM_EXTRA_MIN * -******************************************************************************/ -/** - * Set the min PWM value for the extra 1 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN1, -1); - -/** - * Set the min PWM value for the extra 2 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN2, -1); - -/** - * Set the min PWM value for the extra 3 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN3, -1); - -/** - * Set the min PWM value for the extra 4 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN4, -1); - -/** - * Set the min PWM value for the extra 5 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN5, -1); - -/** - * Set the min PWM value for the extra 6 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN6, -1); - -/** - * Set the min PWM value for the extra 7 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN7, -1); - -/** - * Set the min PWM value for the extra 8 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MIN8, -1); - -/****************************************************************************** -* PWM_EXTRA_MAX * -******************************************************************************/ -/** - * Set the max PWM value for the extra 1 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX1, -1); - -/** - * Set the max PWM value for the extra 2 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX2, -1); - -/** - * Set the max PWM value for the extra 3 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX3, -1); - -/** - * Set the max PWM value for the extra 4 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX4, -1); - -/** - * Set the max PWM value for the extra 5 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX5, -1); - -/** - * Set the max PWM value for the extra 6 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX6, -1); - -/** - * Set the max PWM value for the extra 7 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX7, -1); - -/** - * Set the max PWM value for the extra 8 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_EXTRA_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_MAX8, -1); - -/****************************************************************************** -* PWM_EXTRA_FAIL * -******************************************************************************/ -/** - * Set the failsafe PWM for the extra 1 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL1, -1); - -/** - * Set the failsafe PWM for the extra 2 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL2, -1); - -/** - * Set the failsafe PWM for the extra 3 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL3, -1); - -/** - * Set the failsafe PWM for the extra 4 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL4, -1); - -/** - * Set the failsafe PWM for the extra 5 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL5, -1); - -/** - * Set the failsafe PWM for the extra 6 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL6, -1); - -/** - * Set the failsafe PWM for the extra 7 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL7, -1); - -/** - * Set the failsafe PWM for the extra 8 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_FAIL8, -1); - -/****************************************************************************** -* PWM_EXTRA_DIS * -******************************************************************************/ -/** - * Set the disarmed PWM for the extra 1 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS1, -1); - -/** - * Set the disarmed PWM for the extra 2 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS2, -1); - -/** - * Set the disarmed PWM for the extra 3 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS3, -1); - -/** - * Set the disarmed PWM for the extra 4 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS4, -1); - -/** - * Set the disarmed PWM for the extra 5 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS5, -1); - -/** - * Set the disarmed PWM for the extra 6 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS6, -1); - -/** - * Set the disarmed PWM for the extra 7 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS7, -1); - -/** - * Set the disarmed PWM for the extra 8 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_EXTRA_DISARM will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_DIS8, -1); - -/****************************************************************************** -* PWM_EXTRA_REV * -******************************************************************************/ -/** - * Invert direction of extra output channel 1 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV1, 0); - -/** - * Invert direction of extra output channel 2 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV2, 0); - -/** - * Invert direction of extra output channel 3 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV3, 0); - -/** - * Invert direction of extra output channel 4 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV4, 0); - -/** - * Invert direction of extra output channel 5 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV5, 0); - -/** - * Invert direction of extra output channel 6 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV6, 0); - -/** - * Invert direction of extra output channel 7 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV7, 0); - -/** - * Invert direction of extra output channel 8 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_EXTRA_REV8, 0); - -/****************************************************************************** -* PWM_EXTRA_TRIM * -******************************************************************************/ - -/** - * Trim value for extra output channel 1 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM1, 0); - -/** - * Trim value for extra output channel 2 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM2, 0); - -/** - * Trim value for extra output channel 3 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM3, 0); - -/** - * Trim value for extra output channel 4 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM4, 0); - -/** - * Trim value for extra output channel 5 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM5, 0); - -/** - * Trim value for extra output channel 6 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM6, 0); - -/** - * Trim value for extra output channel 7 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM7, 0); - -/** - * Trim value for extra output channel 8 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_EXTRA_TRIM8, 0); diff --git a/src/modules/sensors/pwm_params_main.c b/src/modules/sensors/pwm_params_main.c deleted file mode 100644 index a81b614c5a..0000000000 --- a/src/modules/sensors/pwm_params_main.c +++ /dev/null @@ -1,804 +0,0 @@ -/**************************************************************************** - * - * Copyright (c) 2012-2016 PX4 Development Team. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name PX4 nor the names of its contributors may be - * used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS - * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN - * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - * - ****************************************************************************/ - -/** - * @file pwm_params_main.c - * - * Parameters defined for PWM output. - * - */ - -/****************************************************************************** -* PWM_RATE * -******************************************************************************/ - -/** - * Set the PWM output frequency for the main outputs - * - * Set to 400 for industry default or 1000 for high frequency ESCs. - * - * Set to 0 for Oneshot125. - * - * @reboot_required true - * - * @min -1 - * @max 2000 - * @unit Hz - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_RATE, 400); - -/** - * Set the minimum PWM for the main outputs - * - * Set to 1000 for industry default or 900 to increase servo travel. - * - * @reboot_required true - * - * @min 800 - * @max 1400 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MIN, 1000); - -/** - * Set the maximum PWM for the main outputs - * - * Set to 2000 for industry default or 2100 to increase servo travel. - * - * @reboot_required true - * - * @min 1600 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAX, 2000); - -/** - * Set the disarmed PWM for the main outputs - * - * This is the PWM pulse the autopilot is outputting if not armed. - * The main use of this parameter is to silence ESCs when they are disarmed. - * - * @reboot_required true - * - * @min 0 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_DISARMED, 900); - -/****************************************************************************** -* PWM_MAIN_MIN * -******************************************************************************/ -/** - * Set the min PWM value for the main 1 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN1, -1); - -/** - * Set the min PWM value for the main 2 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN2, -1); - -/** - * Set the min PWM value for the main 3 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN3, -1); - -/** - * Set the min PWM value for the main 4 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN4, -1); - -/** - * Set the min PWM value for the main 5 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN5, -1); - -/** - * Set the min PWM value for the main 6 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN6, -1); - -/** - * Set the min PWM value for the main 7 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN7, -1); - -/** - * Set the min PWM value for the main 8 output - * - * This is the minimum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MIN will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MIN8, -1); - -/****************************************************************************** -* PWM_MAIN_MAX * -******************************************************************************/ -/** - * Set the max PWM value for the main 1 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX1, -1); - -/** - * Set the max PWM value for the main 2 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX2, -1); - -/** - * Set the max PWM value for the main 3 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX3, -1); - -/** - * Set the max PWM value for the main 4 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX4, -1); - -/** - * Set the max PWM value for the main 5 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX5, -1); - -/** - * Set the max PWM value for the main 6 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX6, -1); - -/** - * Set the max PWM value for the main 7 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX7, -1); - -/** - * Set the max PWM value for the main 8 output - * - * This is the maximum PWM pulse the autopilot is allowed to output. - * When set to -1 the value for PWM_MAX will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_MAX8, -1); - -/****************************************************************************** -* PWM_MAIN_FAIL * -******************************************************************************/ - -/** - * Set the failsafe PWM for the main 1 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL1, -1); - -/** - * Set the failsafe PWM for the main 2 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL2, -1); - -/** - * Set the failsafe PWM for the main 3 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL3, -1); - -/** - * Set the failsafe PWM for the main 4 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL4, -1); - -/** - * Set the failsafe PWM for the main 5 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL5, -1); - -/** - * Set the failsafe PWM for the main 6 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL6, -1); - -/** - * Set the failsafe PWM for the main 7 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL7, -1); - -/** - * Set the failsafe PWM for the main 8 output - * - * This is the PWM pulse the autopilot is outputting if in failsafe mode. - * When set to -1 the value is set automatically depending if the actuator - * is a motor (900us) or a servo (1500us) - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_FAIL8, -1); - -/****************************************************************************** -* PWM_MAIN_DIS * -******************************************************************************/ - -/** - * Set the disarmed PWM for the main 1 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS1, -1); - -/** - * Set the disarmed PWM for the main 2 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS2, -1); - -/** - * Set the disarmed PWM for the main 3 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS3, -1); - -/** - * Set the disarmed PWM for the main 4 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS4, -1); - -/** - * Set the disarmed PWM for the main 5 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS5, -1); - -/** - * Set the disarmed PWM for the main 6 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS6, -1); - -/** - * Set the disarmed PWM for the main 7 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS7, -1); - -/** - * Set the disarmed PWM for the main 8 output - * - * This is the PWM pulse the autopilot is outputting if not armed. - * When set to -1 the value for PWM_DISARMED will be used - * - * @reboot_required true - * - * @min -1 - * @max 2200 - * @unit us - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_DIS8, -1); - -/****************************************************************************** -* PWM_MAIN_REV * -******************************************************************************/ - -/** - * Invert direction of main output channel 1 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV1, 0); - -/** - * Invert direction of main output channel 2 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV2, 0); - -/** - * Invert direction of main output channel 3 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV3, 0); - -/** - * Invert direction of main output channel 4 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV4, 0); - -/** - * Invert direction of main output channel 5 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV5, 0); - -/** - * Invert direction of main output channel 6 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV6, 0); - -/** - * Invert direction of main output channel 7 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV7, 0); - -/** - * Invert direction of main output channel 8 - * - * Enable to invert the channel. - * Warning: Use this parameter when connected to a servo only. - * For a brushless motor, invert manually two phases to reverse the direction. - * - * @boolean - * @group PWM Outputs - */ -PARAM_DEFINE_INT32(PWM_MAIN_REV8, 0); - -/****************************************************************************** -* PWM_MAIN_TRIM * -******************************************************************************/ - -/** - * Trim value for main output channel 1 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM1, 0); - -/** - * Trim value for main output channel 2 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM2, 0); - -/** - * Trim value for main output channel 3 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM3, 0); - -/** - * Trim value for main output channel 4 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM4, 0); - -/** - * Trim value for main output channel 5 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM5, 0); - -/** - * Trim value for main output channel 6 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM6, 0); - -/** - * Trim value for main output channel 7 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM7, 0); - -/** - * Trim value for main output channel 8 - * - * Set to normalized offset - * - * @min -0.2 - * @max 0.2 - * @decimal 2 - * @group PWM Outputs - */ -PARAM_DEFINE_FLOAT(PWM_MAIN_TRIM8, 0);