From 673e5898ea03538a475133ddac2bc712c609f7ab Mon Sep 17 00:00:00 2001 From: alexklimaj Date: Sat, 1 Oct 2022 11:46:35 -0600 Subject: [PATCH] Start rc.baseboard --- ROMFS/px4fmu_common/init.d/CMakeLists.txt | 1 + ROMFS/px4fmu_common/init.d/rc.baseboard | 65 +++++++++++++++++++++++ boards/ark/fmu-v6x/init/rc.board_sensors | 54 ++++--------------- boards/px4/fmu-v5x/init/rc.board_sensors | 55 +++++-------------- boards/px4/fmu-v6x/init/rc.board_sensors | 54 ++++--------------- 5 files changed, 101 insertions(+), 128 deletions(-) create mode 100644 ROMFS/px4fmu_common/init.d/rc.baseboard diff --git a/ROMFS/px4fmu_common/init.d/CMakeLists.txt b/ROMFS/px4fmu_common/init.d/CMakeLists.txt index 05ec84d3ef..3af172d1cd 100644 --- a/ROMFS/px4fmu_common/init.d/CMakeLists.txt +++ b/ROMFS/px4fmu_common/init.d/CMakeLists.txt @@ -39,6 +39,7 @@ px4_add_romfs_files( rc.balloon_apps rc.balloon_defaults rc.boat_defaults + rc.baseboard rc.fw_apps rc.fw_defaults rc.heli_defaults diff --git a/ROMFS/px4fmu_common/init.d/rc.baseboard b/ROMFS/px4fmu_common/init.d/rc.baseboard new file mode 100644 index 0000000000..7d0913cae9 --- /dev/null +++ b/ROMFS/px4fmu_common/init.d/rc.baseboard @@ -0,0 +1,65 @@ +#!/bin/sh +# +# Standard startup script for baseboard sensor drivers. +# +############################################################################### +# Begin Baseboard drivers # +############################################################################### + +set HAVE_PM2 yes + +if ver hwtypecmp V6X005000 V6X005001 V6X005003 V6X005004 +then + set HAVE_PM2 no +fi + +if param compare SENS_EN_INA226 1 +then + # Start Digital power monitors + ina226 -X -b 1 -t 1 -k start + + if [ $HAVE_PM2 = yes ] + then + ina226 -X -b 2 -t 2 -k start + fi +fi + +if param compare SENS_EN_INA228 1 +then + # Start Digital power monitors + ina228 -X -b 1 -t 1 -k start + if [ $HAVE_PM2 = yes ] + then + ina228 -X -b 2 -t 2 -k start + fi +fi + +if param compare SENS_EN_INA238 1 +then + # Start Digital power monitors + ina238 -X -b 1 -t 1 -k start + if [ $HAVE_PM2 = yes ] + then + ina238 -X -b 2 -t 2 -k start + fi +fi + +# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer) +ist8310 -X -b 1 -R 10 start + +if ver hwtypecmp V6X000000 V6X001000 +then + bmp388 -I start +else + if ver hwtypecmp V6X002001 + then + icp201xx -X start + else + bmp388 -X start + fi +fi + +# Baro on I2C3 +ms5611 -X start + +unset HAVE_PM2 diff --git a/boards/ark/fmu-v6x/init/rc.board_sensors b/boards/ark/fmu-v6x/init/rc.board_sensors index 2b66a4d021..2311c0cbfe 100644 --- a/boards/ark/fmu-v6x/init/rc.board_sensors +++ b/boards/ark/fmu-v6x/init/rc.board_sensors @@ -2,12 +2,7 @@ # # ARK FMUARKV6X specific board sensors init #------------------------------------------------------------------------------ -set HAVE_PM2 yes -if ver hwtypecmp ARKV6X005000 ARKV6X005001 ARKV6X005002 ARKV6X005003 ARKV6X005004 -then - set HAVE_PM2 no -fi if param compare -s ADC_ADS1115_EN 1 then ads1115 start -X @@ -15,38 +10,6 @@ else board_adc start fi - -if param compare SENS_EN_INA226 1 -then - # Start Digital power monitors - ina226 -X -b 1 -t 1 -k start - - if [ $HAVE_PM2 = yes ] - then - ina226 -X -b 2 -t 2 -k start - fi -fi - -if param compare SENS_EN_INA228 1 -then - # Start Digital power monitors - ina228 -X -b 1 -t 1 -k start - if [ $HAVE_PM2 = yes ] - then - ina228 -X -b 2 -t 2 -k start - fi -fi - -if param compare SENS_EN_INA238 1 -then - # Start Digital power monitors - ina238 -X -b 1 -t 1 -k start - if [ $HAVE_PM2 = yes ] - then - ina238 -X -b 2 -t 2 -k start - fi -fi - # Internal SPI bus IIM42652 iim42652 -R 3 -s -b 1 start @@ -59,13 +22,18 @@ icm42688p -R 6 -s -b 3 start # Internal magnetometer on I2c bmm150 -I start -# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer) -ist8310 -X -b 1 -R 10 start - # Possible internal Baro bmp388 -I start -# Baro on I2C3 -ms5611 -X start +# +# baseboard sensors: rc.baseboard +# +set BASEBOARD_SENSORS ${R}etc/init.d/rc.baseboard +if [ -f $BASEBOARD_SENSORS ] +then + echo "Baseboard sensors: ${BASEBOARD_SENSORS}" + . $BASEBOARD_SENSORS +fi +unset BASEBOARD_SENSORS -unset HAVE_PM2 +. ${R}etc/init.d/rc.baseboard diff --git a/boards/px4/fmu-v5x/init/rc.board_sensors b/boards/px4/fmu-v5x/init/rc.board_sensors index 4f7c1d078d..be29ef34f9 100644 --- a/boards/px4/fmu-v5x/init/rc.board_sensors +++ b/boards/px4/fmu-v5x/init/rc.board_sensors @@ -3,12 +3,6 @@ # PX4 FMUv5X specific board sensors init #------------------------------------------------------------------------------ -set HAVE_PM2 yes - -if ver hwtypecmp V5X005000 V5X005001 V5X005002 -then - set HAVE_PM2 no -fi if param compare -s ADC_ADS1115_EN 1 then ads1115 start -X @@ -17,38 +11,6 @@ else board_adc start fi - -if param compare SENS_EN_INA226 1 -then - # Start Digital power monitors - ina226 -X -b 1 -t 1 -k start - - if [ $HAVE_PM2 = yes ] - then - ina226 -X -b 2 -t 2 -k start - fi -fi - -if param compare SENS_EN_INA228 1 -then - # Start Digital power monitors - ina228 -X -b 1 -t 1 -k start - if [ $HAVE_PM2 = yes ] - then - ina228 -X -b 2 -t 2 -k start - fi -fi - -if param compare SENS_EN_INA238 1 -then - # Start Digital power monitors - ina238 -X -b 1 -t 1 -k start - if [ $HAVE_PM2 = yes ] - then - ina238 -X -b 2 -t 2 -k start - fi -fi - if ver hwtypecmp V5X000000 V5X000001 V5X000002 V5X001000 V5X004000 V5X004001 V5X004002 V5X005001 V5X005002 then #FMUv5Xbase board orientation @@ -96,9 +58,6 @@ else fi -# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer) -ist8310 -X -b 1 -R 10 start - # Possible internal Baro # Disable startup of internal baros if param is set to false @@ -113,4 +72,16 @@ then fi fi -unset HAVE_PM2 + +# +# baseboard sensors: rc.baseboard +# +set BASEBOARD_SENSORS ${R}etc/init.d/rc.baseboard +if [ -f $BASEBOARD_SENSORS ] +then + echo "Baseboard sensors: ${BASEBOARD_SENSORS}" + . $BASEBOARD_SENSORS +fi +unset BASEBOARD_SENSORS + +. ${R}etc/init.d/rc.baseboard diff --git a/boards/px4/fmu-v6x/init/rc.board_sensors b/boards/px4/fmu-v6x/init/rc.board_sensors index 826b26c2e6..3b5651f6c3 100644 --- a/boards/px4/fmu-v6x/init/rc.board_sensors +++ b/boards/px4/fmu-v6x/init/rc.board_sensors @@ -2,12 +2,7 @@ # # PX4 FMUv6X specific board sensors init #------------------------------------------------------------------------------ -set HAVE_PM2 yes -if ver hwtypecmp V6X005000 V6X005001 V6X005003 V6X005004 -then - set HAVE_PM2 no -fi if param compare -s ADC_ADS1115_EN 1 then ads1115 start -X @@ -15,38 +10,6 @@ else board_adc start fi - -if param compare SENS_EN_INA226 1 -then - # Start Digital power monitors - ina226 -X -b 1 -t 1 -k start - - if [ $HAVE_PM2 = yes ] - then - ina226 -X -b 2 -t 2 -k start - fi -fi - -if param compare SENS_EN_INA228 1 -then - # Start Digital power monitors - ina228 -X -b 1 -t 1 -k start - if [ $HAVE_PM2 = yes ] - then - ina228 -X -b 2 -t 2 -k start - fi -fi - -if param compare SENS_EN_INA238 1 -then - # Start Digital power monitors - ina238 -X -b 1 -t 1 -k start - if [ $HAVE_PM2 = yes ] - then - ina238 -X -b 2 -t 2 -k start - fi -fi - if ver hwtypecmp V6X000004 V6X001004 V6X004004 V6X005004 then # Internal SPI bus ICM20649 @@ -77,9 +40,6 @@ else bmm150 -I start fi -# External compass on GPS1/I2C1 (the 3rd external bus): standard Holybro Pixhawk 4 or CUAV V5 GPS/compass puck (with lights, safety button, and buzzer) -ist8310 -X -b 1 -R 10 start - # Possible internal Baro if ver hwtypecmp V6X002001 then @@ -100,7 +60,15 @@ else fi fi -# Baro on I2C3 -ms5611 -X start +# +# baseboard sensors: rc.baseboard +# +set BASEBOARD_SENSORS ${R}etc/init.d/rc.baseboard +if [ -f $BASEBOARD_SENSORS ] +then + echo "Baseboard sensors: ${BASEBOARD_SENSORS}" + . $BASEBOARD_SENSORS +fi +unset BASEBOARD_SENSORS -unset HAVE_PM2 +. ${R}etc/init.d/rc.baseboard