From 034d16fca01ca0da9d2897cb9879932561055450 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 | 24 ++-------- Tools/Carbonix_scripts/carbonix_waf_build.sh | 47 ++++++++++--------- .../cpn_params/Volanti-LTail.parm | 7 +++ .../cpn_params/Volanti-LWing.parm | 8 ++++ .../CarbonixCommon/cpn_params/Volanti-M1.parm | 12 +++++ .../CarbonixCommon/cpn_params/Volanti-M2.parm | 12 +++++ .../CarbonixCommon/cpn_params/Volanti-M3.parm | 12 +++++ .../CarbonixCommon/cpn_params/Volanti-M4.parm | 12 +++++ .../CarbonixCommon/cpn_params/Volanti-M5.parm | 16 +++++++ .../cpn_params/Volanti-RTail.parm | 8 ++++ .../cpn_params/Volanti-RWing.parm | 8 ++++ 11 files changed, 123 insertions(+), 43 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..1fd818de0a 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 @@ -210,7 +194,7 @@ jobs: mkdir -p temp for dir in CubeOrange CubeOrange-Volanti CubeOrange-Ottano sitl CarbonixF405 CarbonixF405-no-crystal; do mkdir -p temp/$dir/bin - cp -v build/$dir/bin/* temp/$dir/bin/ + cp -vr build/$dir/bin/* temp/$dir/bin/ done cp -v ArduPlane/ReleaseNotes.txt temp/ shell: sh -e {0} diff --git a/Tools/Carbonix_scripts/carbonix_waf_build.sh b/Tools/Carbonix_scripts/carbonix_waf_build.sh index 785489ecf4..83809f5f0f 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 --default-parameters="$file" + ./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..18274ecd35 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LTail.parm @@ -0,0 +1,7 @@ +CAN_NODE 17 +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..1b399c4b47 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-LWing.parm @@ -0,0 +1,8 @@ +CAN_NODE 26 +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..2036ebea51 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M1.parm @@ -0,0 +1,12 @@ +CAN_NODE 11 +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..7f9c2193ce --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M2.parm @@ -0,0 +1,12 @@ +CAN_NODE 12 +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..af91360a5f --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M3.parm @@ -0,0 +1,12 @@ +CAN_NODE 23 +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..e923709e29 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M4.parm @@ -0,0 +1,12 @@ +CAN_NODE 24 +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..e7839ada30 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-M5.parm @@ -0,0 +1,16 @@ +CAN_NODE 15 +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..29f96aef52 --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RTail.parm @@ -0,0 +1,8 @@ +CAN_NODE 27 +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..40c506799b --- /dev/null +++ b/libraries/AP_HAL_ChibiOS/hwdef/CarbonixCommon/cpn_params/Volanti-RWing.parm @@ -0,0 +1,8 @@ +CAN_NODE 16 +OUT1_MIN 1000 +OUT1_MAX 2000 +OUT1_FUNCTION 60 +OUT2_MIN 200 +OUT2_MAX 10000 +OUT2_TRIM 5000 +OUT2_FUNCTION 59