Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 14 additions & 6 deletions .github/workflows/merge-criteria.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:

- name: Filter changed directories
id: changed-files-filtered
env:
REQUESTED_COMMIT_SHA: ${{ inputs.commit_sha }}
CHANGED_DIRECTORIES: ${{ steps.changed-files.outputs.all_changed_files }}
# The build pipeline is triggered only for the project in which the changes happened.
# For example if a change was made in flight_computer/src/main.cpp, a pipeline will
# run only for the 'flight_computer' project.
Expand All @@ -42,14 +45,13 @@ jobs:
# Additionally, the pipeline will also run for all three projects if it is triggered
# when pushing to main.
run: |
contains_dot=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq 'map(select(. == ".")) | length')
contains_dotgithub=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq 'map(select(. == ".github")) | length')
is_manual_trigger=$(echo '${{ github.event.inputs.commit_sha }}')
contains_dot=$(jq 'map(select(. == ".")) | length' <<< "$CHANGED_DIRECTORIES")
contains_dotgithub=$(jq 'map(select(. == ".github")) | length' <<< "$CHANGED_DIRECTORIES")

if [[ -n "$is_manual_trigger" || "${GITHUB_REF}" == "refs/heads/main" || $contains_dot -gt 0 || $contains_dotgithub -gt 0 ]]; then
if [[ -n "$REQUESTED_COMMIT_SHA" || "$GITHUB_REF" == "refs/heads/main" || $contains_dot -gt 0 || $contains_dotgithub -gt 0 ]]; then
filtered_array='["flight_computer","ground_station","telemetry"]'
else
filtered_array=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq -c '[.[] | select(. == "flight_computer" or . == "ground_station" or . == "telemetry")]')
filtered_array=$(jq -c '[.[] | select(. == "flight_computer" or . == "ground_station" or . == "telemetry")]' <<< "$CHANGED_DIRECTORIES")
fi

echo "$filtered_array"
Expand All @@ -74,6 +76,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.commit_sha }}

- name: Run clang-format
uses: jidicula/clang-format-action@v4.18.0
Expand All @@ -97,6 +101,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.commit_sha }}

- name: Check cache
uses: actions/cache@v6
Expand Down Expand Up @@ -179,6 +185,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v7
with:
ref: ${{ inputs.commit_sha }}

- name: Check cache
uses: actions/cache@v6
Expand All @@ -190,7 +198,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v7
with:
python-version: '3.11'
python-version: ${{ matrix.project == 'ground_station' && '3.14.10' || '3.15.2' }}
cache: 'pip'

- name: Install dependencies
Expand Down
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,24 @@ platformio run -d flight_computer --environment debug

Pull requests are automatically checked for formatting, build errors, and static-analysis warnings.

### Reproducing Windows release builds

On 64-bit Windows, create a virtual environment with the Python version used by the GitHub Actions upload job. Install `requirements.txt` as shown above and build the same commit as that job.

| Project | Python |
| --- | --- |
| `flight_computer` | 3.15.2 |
| `telemetry` | 3.15.2 |
| `ground_station` | 3.14.10 |

Use a dedicated PlatformIO Core directory for each project to isolate the installed SCons version. Set `$project` to the directory you want to build.

```powershell
$project = 'flight_computer'
$env:PLATFORMIO_CORE_DIR = "$env:LOCALAPPDATA\CATS\${project}-platformio"
python -m platformio run -d $project
```

## Contributing

Contributions are welcome. Examples include:
Expand Down
6 changes: 4 additions & 2 deletions flight_computer/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
default_envs = release

[env]
platform = ststm32
platform = platformio/ststm32@20.0.0
board = genericSTM32F411CE
#framework = stm32cube
platform_packages = platformio/toolchain-gccarmnoneeabi@^1.100301.220327
platform_packages =
platformio/toolchain-gccarmnoneeabi@1.140201.0
platformio/tool-scons@4.40801.0
upload_protocol = stlink
debug_tool = stlink
board_build.ldscript = src/target/VEGA/STM32F411CCUX_FLASH.ld
Expand Down
5 changes: 3 additions & 2 deletions ground_station/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,9 @@ QR navigation, and live compass checks on hardware.
Preserve those deltas when rebasing a vendored library and record the exact upstream tag or commit.
- Do not blanket-format vendored libraries. Preserve upstream source unless a documented CATS compatibility patch is
necessary.
- Use PlatformIO 6.1.19 with Python 3.11 from the root `requirements.txt`. Upload-only packages are pinned in
`ground_station/requirements-upload.txt`; never install the unrelated Python package named `serial`.
- Install PlatformIO 6.1.19 from the root `requirements.txt`. Use Python 3.14.10 for Windows release builds and
Python 3.11 for WSL pre-commit checks. Upload-only packages are pinned in `ground_station/requirements-upload.txt`;
never install the unrelated Python package named `serial`.
- On Windows, if `platformio` is not on `PATH`, use
`& "$env:USERPROFILE\.platformio\penv\Scripts\platformio.exe"` and verify that it reports version 6.1.19. Do not
create a separate legacy environment just to make the command available.
Expand Down
5 changes: 5 additions & 0 deletions ground_station/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
board = esp32-s2-saola-1
framework = arduino
platform = https://github.com/tasmota/platform-espressif32/releases/download/2026.05.50/platform-espressif32.zip
platform_packages = platformio/tool-scons@4.40801.0

board_build.boot=qio
board_build.bootloader=qio
Expand All @@ -19,13 +20,17 @@ board_build.mcu = esp32s2

lib_deps =
adafruit/Adafruit SPIFlash@5.1.1
adafruit/Adafruit NeoPixel@1.15.5
adafruit/SdFat - Adafruit Fork@2.3.103
bblanchon/ArduinoJson@7.4.3
jchristensen/JC_Button@2.1.6
QMC5883Compass ; This library was modified by us
Wire
paulstoffregen/Time@1.6.1

; Keep the pinned NeoPixel dependency of SPIFlash out of the firmware build.
lib_ignore = Adafruit NeoPixel

build_flags =
-fexceptions ; Required by the Nayuki C++ QR encoder
-DFIRMWARE_VERSION='"1.3.3"' ; Enter Firmware Version here
Expand Down
20 changes: 18 additions & 2 deletions ground_station/pre_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,28 @@
# below the PlatformIO package root. A shared PlatformIO home can retain the
# package metadata while losing the installer-added PATH adjustment, leaving
# an otherwise valid compiler undiscoverable on Windows.
toolchain_root = env.PioPlatform().get_package_dir("toolchain-xtensa-esp-elf")
platform = env.PioPlatform()
toolchain_root = platform.get_package_dir("toolchain-xtensa-esp-elf")
if toolchain_root:
nested_toolchain_bin = os.path.join(toolchain_root, "xtensa-esp-elf", "bin")
nested_toolchain_root = os.path.join(toolchain_root, "xtensa-esp-elf")
nested_toolchain_bin = os.path.join(nested_toolchain_root, "bin")
compiler_name = "xtensa-esp32s2-elf-g++.exe" if os.name == "nt" else "xtensa-esp32s2-elf-g++"
if os.path.isfile(os.path.join(nested_toolchain_bin, compiler_name)):
env.PrependENVPath("PATH", nested_toolchain_bin)
toolchain_root = nested_toolchain_root

# Keep source paths in diagnostics and debug information independent of the build machine.
project_root = env.subst("$PROJECT_DIR").replace(os.sep, "/")
core_root = platform.config.get("platformio", "core_dir").replace(os.sep, "/")
prefix_map_flags = [
f"-ffile-prefix-map={project_root}=.",
f"-ffile-prefix-map={core_root}=platformio",
]
if toolchain_root:
# Use the same DWARF paths for flat and nested toolchain installations.
compiler_root = toolchain_root.replace(os.sep, "/")
prefix_map_flags.append(f"-fdebug-prefix-map={compiler_root}=platformio/packages/toolchain-xtensa-esp-elf")
env.Append(CCFLAGS=prefix_map_flags, LINKFLAGS=prefix_map_flags)

env.Append(
# Unfortunately we can't use the standard standard,
Expand Down
8 changes: 6 additions & 2 deletions telemetry/platformio.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,12 @@

[env:telemetry]

platform = ststm32
platform_packages = platformio/toolchain-gccarmnoneeabi@^1.100301.220327
platform = platformio/ststm32@20.0.0
platform_packages =
platformio/toolchain-gccarmnoneeabi@1.140201.0
platformio/framework-stm32cubeg0@1.6.3
platformio/tool-ldscripts-ststm32@0.3.0
platformio/tool-scons@4.40801.0
board = disco_g071rb
framework = stm32cube

Expand Down
Loading