From c3ed50488f4e96e4bb8394419a0e6ce9f13970a4 Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Thu, 19 Oct 2023 09:06:52 +1300 Subject: [PATCH] Remove SYS_USE_IO param The param is not really required anymore with the actuator configuration. Also, when it is set to 0, RC doesn't work for some boards which would be nice to avoid. Signed-off-by: Julian Oes --- ROMFS/px4fmu_common/init.d/rcS | 35 ++++++++----------- boards/ark/fmu-v6x/init/rc.board_defaults | 7 ---- .../cubeorange/init/rc.board_defaults | 2 -- .../cubeorangeplus/init/rc.board_defaults | 2 -- .../cubeyellow/init/rc.board_defaults | 2 -- .../durandal-v1/init/rc.board_defaults | 2 -- boards/holybro/pix32v5/init/rc.board_defaults | 2 -- boards/mro/x21-777/init/rc.board_defaults | 2 -- boards/mro/x21/init/rc.board_defaults | 2 -- boards/px4/fmu-v2/init/rc.board_defaults | 2 -- boards/px4/fmu-v3/init/rc.board_defaults | 2 -- boards/px4/fmu-v4pro/init/rc.board_defaults | 2 -- boards/px4/fmu-v5/init/rc.board_defaults | 7 ---- boards/px4/fmu-v5x/init/rc.board_defaults | 2 -- boards/px4/fmu-v6c/init/rc.board_defaults | 2 -- boards/px4/fmu-v6x/init/rc.board_defaults | 1 - .../smartap-airlink/init/rc.board_defaults | 2 -- boards/thepeach/k1/init/rc.board_defaults | 2 -- boards/thepeach/r1/init/rc.board_defaults | 2 -- src/drivers/px4io/px4io.cpp | 5 ++- src/drivers/px4io/px4io_params.c | 12 ------- 21 files changed, 17 insertions(+), 80 deletions(-) diff --git a/ROMFS/px4fmu_common/init.d/rcS b/ROMFS/px4fmu_common/init.d/rcS index 4a391d39f9..8a216d8c8a 100644 --- a/ROMFS/px4fmu_common/init.d/rcS +++ b/ROMFS/px4fmu_common/init.d/rcS @@ -266,32 +266,26 @@ else . $FCONFIG fi - # - # Start IO for PWM output or RC input if enabled - # - if param compare -s SYS_USE_IO 1 + # Check if PX4IO present and update firmware if needed. + if [ -f $IOFW ] then - # Check if PX4IO present and update firmware if needed. - if [ -f $IOFW ] + if ! px4io checkcrc ${IOFW} then - if ! px4io checkcrc ${IOFW} - then - # tune Program PX4IO - tune_control play -t 16 # tune 16 = PROG_PX4IO + # tune Program PX4IO + tune_control play -t 16 # tune 16 = PROG_PX4IO - if px4io update ${IOFW} + if px4io update ${IOFW} + then + usleep 10000 + tune_control stop + if px4io checkcrc ${IOFW} then - usleep 10000 - tune_control stop - if px4io checkcrc ${IOFW} - then - tune_control play -t 17 # tune 17 = PROG_PX4IO_OK - else - tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR - fi + tune_control play -t 17 # tune 17 = PROG_PX4IO_OK else - tune_control stop + tune_control play -t 18 # tune 18 = PROG_PX4IO_ERR fi + else + tune_control stop fi fi @@ -302,6 +296,7 @@ else fi fi + # # RC update (map raw RC input to calibrate manual control) # start before commander diff --git a/boards/ark/fmu-v6x/init/rc.board_defaults b/boards/ark/fmu-v6x/init/rc.board_defaults index 7a26ee01c8..87451b0c52 100644 --- a/boards/ark/fmu-v6x/init/rc.board_defaults +++ b/boards/ark/fmu-v6x/init/rc.board_defaults @@ -32,11 +32,4 @@ then param set-default SENS_TEMP_ID 3014666 fi -if ver hwtypecmp ARKV6X001000 ARKV6X001001 ARKV6X001002 ARKV6X001003 ARKV6X001004 ARKV6X001005 ARKV6X001006 ARKV6X001007 -then - param set-default SYS_USE_IO 0 -else - param set-default SYS_USE_IO 1 -fi - safety_button start diff --git a/boards/cubepilot/cubeorange/init/rc.board_defaults b/boards/cubepilot/cubeorange/init/rc.board_defaults index 8ae2ed458b..7f961cd33e 100644 --- a/boards/cubepilot/cubeorange/init/rc.board_defaults +++ b/boards/cubepilot/cubeorange/init/rc.board_defaults @@ -14,6 +14,4 @@ param set-default SENS_EN_THERMAL 0 param set-default -s SENS_TEMP_ID 2621474 -param set-default SYS_USE_IO 1 - set IOFW "/etc/extras/cubepilot_io-v2_default.bin" diff --git a/boards/cubepilot/cubeorangeplus/init/rc.board_defaults b/boards/cubepilot/cubeorangeplus/init/rc.board_defaults index 8ae2ed458b..7f961cd33e 100644 --- a/boards/cubepilot/cubeorangeplus/init/rc.board_defaults +++ b/boards/cubepilot/cubeorangeplus/init/rc.board_defaults @@ -14,6 +14,4 @@ param set-default SENS_EN_THERMAL 0 param set-default -s SENS_TEMP_ID 2621474 -param set-default SYS_USE_IO 1 - set IOFW "/etc/extras/cubepilot_io-v2_default.bin" diff --git a/boards/cubepilot/cubeyellow/init/rc.board_defaults b/boards/cubepilot/cubeyellow/init/rc.board_defaults index 54705e650d..6f39beb0c8 100644 --- a/boards/cubepilot/cubeyellow/init/rc.board_defaults +++ b/boards/cubepilot/cubeyellow/init/rc.board_defaults @@ -13,6 +13,4 @@ param set-default BAT2_A_PER_V 17 # Disable IMU thermal control param set-default SENS_EN_THERMAL 0 -param set-default SYS_USE_IO 1 - set IOFW "/etc/extras/cubepilot_io-v2_default.bin" diff --git a/boards/holybro/durandal-v1/init/rc.board_defaults b/boards/holybro/durandal-v1/init/rc.board_defaults index 2a3b2c0a7b..49254efb15 100644 --- a/boards/holybro/durandal-v1/init/rc.board_defaults +++ b/boards/holybro/durandal-v1/init/rc.board_defaults @@ -11,5 +11,3 @@ param set-default BAT2_A_PER_V 36.367515152 # Enable IMU thermal control param set-default SENS_EN_THERMAL 1 - -param set-default SYS_USE_IO 1 diff --git a/boards/holybro/pix32v5/init/rc.board_defaults b/boards/holybro/pix32v5/init/rc.board_defaults index 94c5828214..c2300a50a7 100644 --- a/boards/holybro/pix32v5/init/rc.board_defaults +++ b/boards/holybro/pix32v5/init/rc.board_defaults @@ -9,7 +9,5 @@ param set-default BAT2_V_DIV 18.1 param set-default BAT1_A_PER_V 36.367515152 param set-default BAT2_A_PER_V 36.367515152 -param set-default SYS_USE_IO 1 - rgbled_pwm start safety_button start diff --git a/boards/mro/x21-777/init/rc.board_defaults b/boards/mro/x21-777/init/rc.board_defaults index e9fecd78a8..5d576dd747 100644 --- a/boards/mro/x21-777/init/rc.board_defaults +++ b/boards/mro/x21-777/init/rc.board_defaults @@ -5,5 +5,3 @@ param set-default BAT1_V_DIV 10.177939394 param set-default BAT1_A_PER_V 15.391030303 - -param set-default SYS_USE_IO 1 diff --git a/boards/mro/x21/init/rc.board_defaults b/boards/mro/x21/init/rc.board_defaults index e9fecd78a8..5d576dd747 100644 --- a/boards/mro/x21/init/rc.board_defaults +++ b/boards/mro/x21/init/rc.board_defaults @@ -5,5 +5,3 @@ param set-default BAT1_V_DIV 10.177939394 param set-default BAT1_A_PER_V 15.391030303 - -param set-default SYS_USE_IO 1 diff --git a/boards/px4/fmu-v2/init/rc.board_defaults b/boards/px4/fmu-v2/init/rc.board_defaults index e9fecd78a8..5d576dd747 100644 --- a/boards/px4/fmu-v2/init/rc.board_defaults +++ b/boards/px4/fmu-v2/init/rc.board_defaults @@ -5,5 +5,3 @@ param set-default BAT1_V_DIV 10.177939394 param set-default BAT1_A_PER_V 15.391030303 - -param set-default SYS_USE_IO 1 diff --git a/boards/px4/fmu-v3/init/rc.board_defaults b/boards/px4/fmu-v3/init/rc.board_defaults index e9fecd78a8..5d576dd747 100644 --- a/boards/px4/fmu-v3/init/rc.board_defaults +++ b/boards/px4/fmu-v3/init/rc.board_defaults @@ -5,5 +5,3 @@ param set-default BAT1_V_DIV 10.177939394 param set-default BAT1_A_PER_V 15.391030303 - -param set-default SYS_USE_IO 1 diff --git a/boards/px4/fmu-v4pro/init/rc.board_defaults b/boards/px4/fmu-v4pro/init/rc.board_defaults index 42378a19d7..8dd9df28d5 100644 --- a/boards/px4/fmu-v4pro/init/rc.board_defaults +++ b/boards/px4/fmu-v4pro/init/rc.board_defaults @@ -13,6 +13,4 @@ param set-default BAT2_A_PER_V 26.4 param set-default EKF2_MULTI_IMU 2 param set-default SENS_IMU_MODE 0 -param set-default SYS_USE_IO 1 - set LOGGER_BUF 64 diff --git a/boards/px4/fmu-v5/init/rc.board_defaults b/boards/px4/fmu-v5/init/rc.board_defaults index 83c1976b74..d7f8b05bd8 100644 --- a/boards/px4/fmu-v5/init/rc.board_defaults +++ b/boards/px4/fmu-v5/init/rc.board_defaults @@ -9,13 +9,6 @@ param set-default BAT2_V_DIV 18.1 param set-default BAT1_A_PER_V 36.367515152 param set-default BAT2_A_PER_V 36.367515152 -if ver hwtypecmp V5004000 V5006000 -then - param set-default SYS_USE_IO 0 -else - param set-default SYS_USE_IO 1 -fi - if ver hwtypecmp V5005000 V5005002 V5006000 V5006002 then # CUAV V5+ (V550/V552) and V5nano (V560/V562) have 3 IMUs diff --git a/boards/px4/fmu-v5x/init/rc.board_defaults b/boards/px4/fmu-v5x/init/rc.board_defaults index ba812e4b7b..a7d844a366 100644 --- a/boards/px4/fmu-v5x/init/rc.board_defaults +++ b/boards/px4/fmu-v5x/init/rc.board_defaults @@ -16,6 +16,4 @@ param set-default SENS_EN_INA238 0 param set-default SENS_EN_INA228 0 param set-default SENS_EN_INA226 1 -param set-default SYS_USE_IO 1 - safety_button start diff --git a/boards/px4/fmu-v6c/init/rc.board_defaults b/boards/px4/fmu-v6c/init/rc.board_defaults index 6418e5836d..f7dd269721 100644 --- a/boards/px4/fmu-v6c/init/rc.board_defaults +++ b/boards/px4/fmu-v6c/init/rc.board_defaults @@ -9,5 +9,3 @@ param set-default BAT2_V_DIV 18.1 param set-default BAT1_A_PER_V 36.367515152 param set-default BAT2_A_PER_V 36.367515152 - -param set-default SYS_USE_IO 1 diff --git a/boards/px4/fmu-v6x/init/rc.board_defaults b/boards/px4/fmu-v6x/init/rc.board_defaults index ba812e4b7b..f6e71a14ca 100644 --- a/boards/px4/fmu-v6x/init/rc.board_defaults +++ b/boards/px4/fmu-v6x/init/rc.board_defaults @@ -16,6 +16,5 @@ param set-default SENS_EN_INA238 0 param set-default SENS_EN_INA228 0 param set-default SENS_EN_INA226 1 -param set-default SYS_USE_IO 1 safety_button start diff --git a/boards/sky-drones/smartap-airlink/init/rc.board_defaults b/boards/sky-drones/smartap-airlink/init/rc.board_defaults index c581f8c741..212c72657f 100644 --- a/boards/sky-drones/smartap-airlink/init/rc.board_defaults +++ b/boards/sky-drones/smartap-airlink/init/rc.board_defaults @@ -25,8 +25,6 @@ param set-default BAT_V_OFFS_CURR 0.413 # Disable safety switch param set-default CBRK_IO_SAFETY 22027 -param set-default SYS_USE_IO 1 - safety_button start set LOGGER_BUF 32 diff --git a/boards/thepeach/k1/init/rc.board_defaults b/boards/thepeach/k1/init/rc.board_defaults index 5d8a3c182b..f22fa838f4 100644 --- a/boards/thepeach/k1/init/rc.board_defaults +++ b/boards/thepeach/k1/init/rc.board_defaults @@ -5,5 +5,3 @@ param set-default BAT1_V_DIV 18.1 param set-default BAT1_A_PER_V 36.367515152 - -param set-default SYS_USE_IO 1 diff --git a/boards/thepeach/r1/init/rc.board_defaults b/boards/thepeach/r1/init/rc.board_defaults index 5d8a3c182b..f22fa838f4 100644 --- a/boards/thepeach/r1/init/rc.board_defaults +++ b/boards/thepeach/r1/init/rc.board_defaults @@ -5,5 +5,3 @@ param set-default BAT1_V_DIV 18.1 param set-default BAT1_A_PER_V 36.367515152 - -param set-default SYS_USE_IO 1 diff --git a/src/drivers/px4io/px4io.cpp b/src/drivers/px4io/px4io.cpp index 21c0a53b2b..3f8d0f89a1 100644 --- a/src/drivers/px4io/px4io.cpp +++ b/src/drivers/px4io/px4io.cpp @@ -336,8 +336,7 @@ private: (ParamInt) _param_rc_rssi_pwm_max, (ParamInt) _param_rc_rssi_pwm_min, (ParamInt) _param_sens_en_themal, - (ParamInt) _param_sys_hitl, - (ParamInt) _param_sys_use_io + (ParamInt) _param_sys_hitl ) }; @@ -468,7 +467,7 @@ int PX4IO::init() } /* try to claim the generic PWM output device node as well - it's OK if we fail at this */ - if (_param_sys_hitl.get() <= 0 && _param_sys_use_io.get() == 1) { + if (_param_sys_hitl.get() <= 0) { _mixing_output.setMaxTopicUpdateRate(MIN_TOPIC_UPDATE_INTERVAL); } diff --git a/src/drivers/px4io/px4io_params.c b/src/drivers/px4io/px4io_params.c index ef1c1ee6ab..b390bdb18a 100644 --- a/src/drivers/px4io/px4io_params.c +++ b/src/drivers/px4io/px4io_params.c @@ -42,18 +42,6 @@ #include #include -/** - * Set usage of IO board - * - * Can be used to use a configure the use of the IO board. - * - * @value 0 IO PWM disabled (RC only) - * @value 1 IO enabled (RC & PWM) - * @reboot_required true - * @group System - */ -PARAM_DEFINE_INT32(SYS_USE_IO, 0); - /** * S.BUS out *