Skip to content

Commit

Permalink
carbonix_build: build CPN variants based on .parm
Browse files Browse the repository at this point in the history
SW-159
  • Loading branch information
robertlong13 committed Jun 7, 2024
1 parent 057f503 commit 034d16f
Show file tree
Hide file tree
Showing 11 changed files with 123 additions and 43 deletions.
24 changes: 4 additions & 20 deletions .github/workflows/carbonix_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}
Expand Down
47 changes: 24 additions & 23 deletions Tools/Carbonix_scripts/carbonix_waf_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 034d16f

Please sign in to comment.