From 4521f7260d4584ed4928d32e8bac7498b11ef973 Mon Sep 17 00:00:00 2001 From: Bob Long Date: Thu, 6 Jun 2024 17:09:55 +1000 Subject: [PATCH] carbonix_build: build CPN variants based on .parm SW-159 --- .github/workflows/carbonix_build.yml | 22 ++------- Tools/Carbonix_scripts/carbonix_waf_build.sh | 47 ++++++++++--------- .../cpn_params/Volanti-LTail.parm | 8 ++++ .../cpn_params/Volanti-LWing.parm | 9 ++++ .../CarbonixCommon/cpn_params/Volanti-M1.parm | 13 +++++ .../CarbonixCommon/cpn_params/Volanti-M2.parm | 13 +++++ .../CarbonixCommon/cpn_params/Volanti-M3.parm | 13 +++++ .../CarbonixCommon/cpn_params/Volanti-M4.parm | 13 +++++ .../CarbonixCommon/cpn_params/Volanti-M5.parm | 17 +++++++ .../cpn_params/Volanti-RTail.parm | 9 ++++ .../cpn_params/Volanti-RWing.parm | 9 ++++ 11 files changed, 131 insertions(+), 42 deletions(-) create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LTail.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LWing.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M1.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M2.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M3.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M4.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M5.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RTail.parm create mode 100755 libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RWing.parm diff --git a/.github/workflows/carbonix_build.yml b/.github/workflows/carbonix_build.yml index d2f6c8453c..9e66d4caa7 100644 --- a/.github/workflows/carbonix_build.yml +++ b/.github/workflows/carbonix_build.yml @@ -171,26 +171,10 @@ jobs: run: | . .github/workflows/ccache.env - - name: build Carbonix Flight Controller + - name: build shell: bash - run: | - boards=("CubeOrange" "CubeOrange-Volanti" "CubeOrange-Ottano" "sitl") - for board in "${boards[@]}"; do - echo "Compiling ArduPlane for $board..." - ./waf configure --board "$board" --define=CARBOPILOT=1 - ./waf plane - done - echo "Script completed successfully." - - name: build Carbonix Periph boards - shell: bash - run: | - boards=("CarbonixF405" "CarbonixF405-no-crystal") - for board in "${boards[@]}"; do - echo "Compiling AP_Periph for $board..." - ./waf configure --board "$board" --define=CARBOPILOT=1 - ./waf AP_Periph - done - echo "Script completed successfully." + run: Tools/Carbonix_scripts/carbonix_waf_build.sh + - name: Check build files id: check_files uses: andstor/file-existence-action@v2 diff --git a/Tools/Carbonix_scripts/carbonix_waf_build.sh b/Tools/Carbonix_scripts/carbonix_waf_build.sh index 785489ecf4..7a6be6920b 100755 --- a/Tools/Carbonix_scripts/carbonix_waf_build.sh +++ b/Tools/Carbonix_scripts/carbonix_waf_build.sh @@ -3,39 +3,40 @@ # Exit if any command fails set -e -# Check unstaged changes -if [[ $(git status --porcelain) ]]; then - echo "Error: There are unstaged changes in the repository." - exit 1 -fi - -# Check outdated submodules -# git submodule update --remote --quiet -# outdated_submodules=$(git submodule status | grep -e '-[[:alnum:]]' | awk '{print $2}') -# if [[ -n $outdated_submodules ]]; then -# echo "The following submodules are not updated:" -# echo "$outdated_submodules" -# exit 1 -# fi - echo "Running distclean..." ./waf distclean -main_boards=("CubeOrange-Volanti" "CubeOrange-Ottano" "CubeOrange" "sitl") - +main_boards=("CubeOrange" "CubeOrange-Volanti" "CubeOrange-Ottano" "sitl") for board in "${main_boards[@]}"; do - echo "Compiling Plane for $board..." + echo "Compiling ArduPlane for $board..." ./waf configure --board "$board" --define=CARBOPILOT=1 ./waf plane done +echo "Script completed successfully." periph_boards=("CarbonixF405" "CarbonixF405-no-crystal") - for board in "${periph_boards[@]}"; do - echo "Compiling AP_Periph for $board..." - ./waf configure --board "$board" --define=CARBOPILOT=1 - ./waf AP_Periph + for file in libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/*.parm; do + # Extract the filename without the extension + filename=$(basename -- "$file") + filename="${filename%.*}" + + # Create extra hwdef file + printf "undef CAN_APP_NODE_NAME\ndefine CAN_APP_NODE_NAME \"$board-$filename\"" > temp.hwdef + + # Compile AP_Periph for each board + echo "Compiling AP_Periph for $board with $filename..." + ./waf configure --board "$board" --define=CARBOPILOT=1 --extra-hwdef=temp.hwdef + ./waf AP_Periph + + # Rename build outputs + mkdir build/$board/bin/$filename + # Move all the files (not folders) in build/$board/bin to build/$board/bin/$filename + find build/$board/bin -maxdepth 1 -type f -exec mv {} build/$board/bin/$filename \; + + # Cleanup + rm temp.hwdef + done done - echo "Script completed successfully." diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LTail.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LTail.parm new file mode 100755 index 0000000000..68a63b8a0f --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LTail.parm @@ -0,0 +1,8 @@ +CAN_NODE 17 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_FUNCTION 61 +OUT2_MIN 1000 +OUT2_MAX 2000 +OUT2_FUNCTION 57 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LWing.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LWing.parm new file mode 100755 index 0000000000..f2e3cbd198 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LWing.parm @@ -0,0 +1,9 @@ +CAN_NODE 26 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_FUNCTION 60 +OUT2_MIN 200 +OUT2_MAX 10000 +OUT2_TRIM 5000 +OUT2_FUNCTION 59 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M1.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M1.parm new file mode 100755 index 0000000000..4780b6905f --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M1.parm @@ -0,0 +1,13 @@ +CAN_NODE 11 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_TRIM 1000 +OUT1_FUNCTION 33 +OUT2_FUNCTION 0 +OUT_BLH_MASK 3 +OUT_BLH_OTYPE 6 +OUT_BLH_POLES 28 +OUT_BLH_EXTLM 1 +ESC_PWM_TYPE 6 +ESC_TELEM_PORT 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M2.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M2.parm new file mode 100755 index 0000000000..d2a9b5c39d --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M2.parm @@ -0,0 +1,13 @@ +CAN_NODE 12 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_TRIM 1000 +OUT1_FUNCTION 34 +OUT2_FUNCTION 0 +OUT_BLH_MASK 3 +OUT_BLH_OTYPE 6 +OUT_BLH_POLES 28 +OUT_BLH_EXTLM 1 +ESC_PWM_TYPE 6 +ESC_TELEM_PORT 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M3.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M3.parm new file mode 100755 index 0000000000..55077b7ecc --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M3.parm @@ -0,0 +1,13 @@ +CAN_NODE 23 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_TRIM 1000 +OUT1_FUNCTION 35 +OUT2_FUNCTION 0 +OUT_BLH_MASK 3 +OUT_BLH_OTYPE 6 +OUT_BLH_POLES 28 +OUT_BLH_EXTLM 1 +ESC_PWM_TYPE 6 +ESC_TELEM_PORT 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M4.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M4.parm new file mode 100755 index 0000000000..5929b13a9d --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M4.parm @@ -0,0 +1,13 @@ +CAN_NODE 24 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_TRIM 1000 +OUT1_FUNCTION 36 +OUT2_FUNCTION 0 +OUT_BLH_MASK 3 +OUT_BLH_OTYPE 6 +OUT_BLH_POLES 28 +OUT_BLH_EXTLM 1 +ESC_PWM_TYPE 6 +ESC_TELEM_PORT 1 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M5.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M5.parm new file mode 100755 index 0000000000..8f670db032 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M5.parm @@ -0,0 +1,17 @@ +CAN_NODE 15 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_TRIM 1000 +OUT1_FUNCTION 37 +OUT2_FUNCTION 0 +OUT_BLH_MASK 3 +OUT_BLH_OTYPE 6 +OUT_BLH_POLES 28 +OUT_BLH_EXTLM 1 +ESC_PWM_TYPE 6 +ESC_TELEM_PORT 1 +RNGFND_PORT 2 +RNGFND1_TYPE 8 +RNGFND1_MAX_CM 19500 +RNGFND1_GNDCLEAR 0 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RTail.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RTail.parm new file mode 100755 index 0000000000..78a05f9db6 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RTail.parm @@ -0,0 +1,9 @@ +CAN_NODE 27 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_REVERSED 1 +OUT1_FUNCTION 61 +OUT2_MIN 1000 +OUT2_MAX 2000 +OUT2_FUNCTION 57 diff --git a/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RWing.parm b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RWing.parm new file mode 100755 index 0000000000..f11634fc4a --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RWing.parm @@ -0,0 +1,9 @@ +CAN_NODE 16 +COMPASS_ENABLE 0 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_FUNCTION 60 +OUT2_MIN 200 +OUT2_MAX 10000 +OUT2_TRIM 5000 +OUT2_FUNCTION 59