Skip to content
Merged
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
21 changes: 21 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"containerEnv": {
"BLINKA_FORCEBOARD": "GENERIC_LINUX_PC",
"BLINKA_FORCECHIP": "GENERIC_X86"
},
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"ms-python.isort",
"ms-python.debugpy",
"redhat.vscode-yaml",
"tamasfe.even-better-toml"
]
}
},
"image": "mcr.microsoft.com/devcontainers/python:3.13",
"name": "pysquared-dev",
"postCreateCommand": "make .venv pre-commit-install"
}
18 changes: 15 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,27 @@ jobs:
- name: Lint
run: |
make fmt
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Typecheck
run: |
make typecheck
archive:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Build
run: |
make build
- name: Archive
- name: Archive Flight Software
uses: actions/upload-artifact@v4
with:
name: proveskit-flight-software
path: artifacts/proves/flight-software
- name: Archive Ground Station
uses: actions/upload-artifact@v4
with:
name: proves
path: artifacts/proves.zip
name: proveskit-ground-station
path: artifacts/proves/ground-station
5 changes: 3 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ venv
**/*.mpy

# libs
/lib/*
!/lib/requirements.txt
src/*/lib/*
!src/*/lib/requirements.txt
!src/flight-software/lib/proveskit_rp2350_v5b/
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ repos:
- id: check-yaml
- id: check-json
- id: check-added-large-files
- id: pretty-format-json
args: [--autofix]
exclude: '.vscode/.*'
#- id: mixed-line-ending
# args: [ --fix=lf ]

Expand Down
90 changes: 60 additions & 30 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
PYSQUARED_VERSION ?= v2.0.0-alpha-25w24
PYSQUARED_VERSION ?= v2.0.0-alpha-25w26-2
PYSQUARED ?= git+https://github.com/proveskit/pysquared@$(PYSQUARED_VERSION)
BOARD_MOUNT_POINT ?= ""
BOARD_TTY_PORT ?= ""
VERSION ?= $(shell git tag --points-at HEAD --sort=-creatordate < /dev/null | head -n 1)

.PHONY: all
all: .venv download-libraries pre-commit-install help
Expand All @@ -14,16 +17,19 @@ help: ## Display this help.
@echo "Creating virtual environment..."
@$(MAKE) uv
@$(UV) venv
@$(UV) pip install --requirement pyproject.toml
@$(UV) sync

.PHONY: download-libraries
download-libraries: uv .venv ## Download the required libraries
@echo "Downloading libraries..."
@$(UV) pip install --requirement lib/requirements.txt --target lib --no-deps --upgrade --quiet
@$(UV) pip --no-cache install $(PYSQUARED) --target lib --no-deps --upgrade --quiet
download-libraries: download-libraries-flight-software download-libraries-ground-station

@rm -rf lib/*.dist-info
@rm -rf lib/.lock
.PHONY: download-libraries-%
download-libraries-%: uv .venv ## Download the required libraries
@echo "Downloading libraries for $*..."
@$(UV) pip install --requirement src/$*/lib/requirements.txt --target src/$*/lib --no-deps --upgrade --quiet
@$(UV) pip --no-cache install $(PYSQUARED) --target src/$*/lib --no-deps --upgrade --quiet

@rm -rf src/$*/lib/*.dist-info
@rm -rf src/$*/lib/.lock

.PHONY: pre-commit-install
pre-commit-install: uv
Expand All @@ -38,23 +44,31 @@ sync-time: uv ## Syncs the time from your computer to the PROVES Kit board
fmt: pre-commit-install ## Lint and format files
$(UVX) pre-commit run --all-files

BOARD_MOUNT_POINT ?= ""
VERSION ?= $(shell git tag --points-at HEAD --sort=-creatordate < /dev/null | head -n 1)
typecheck: .venv download-libraries ## Run type check
@$(UV) run -m pyright .

.PHONY: install
install: build ## Install the project onto a connected PROVES Kit use `make install BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
install-%: build-% ## Install the project onto a connected PROVES Kit use `make install-flight-software BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
ifeq ($(OS),Windows_NT)
rm -rf $(BOARD_MOUNT_POINT)
cp -r artifacts/proves/* $(BOARD_MOUNT_POINT)
cp -r artifacts/proves/$*/* $(BOARD_MOUNT_POINT)
else
@rm $(BOARD_MOUNT_POINT)/code.py > /dev/null 2>&1 || true
$(call rsync_to_dest,artifacts/proves,$(BOARD_MOUNT_POINT))
$(call rsync_to_dest,artifacts/proves/$*,$(BOARD_MOUNT_POINT))
endif

# install-firmware
.PHONY: install-firmware
install-firmware: uv ## Install the board firmware onto a connected PROVES Kit
@$(UVX) --from git+https://github.com/proveskit/install-firmware@1.0.2 install-firmware v5b
# install-circuit-python
.PHONY: install-circuit-python
install-circuit-python: arduino-cli circuit-python ## Install the Circuit Python onto a connected PROVES Kit
@$(ARDUINO_CLI) config init || true
@$(ARDUINO_CLI) config add board_manager.additional_urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
@$(ARDUINO_CLI) core install rp2040:rp2040@4.1.1
@$(ARDUINO_CLI) upload -v -b 115200 --fqbn rp2040:rp2040:rpipico -p $(BOARD_TTY_PORT) -i $(CIRCUIT_PYTHON)

.PHONY: list-tty
list-tty: arduino-cli ## List available TTY ports
@echo "TTY ports:"
@$(ARDUINO_CLI) board list | grep "USB" | awk '{print $$1}'

.PHONY: clean
clean: ## Remove all gitignored files such as downloaded libraries and artifacts
Expand All @@ -63,15 +77,18 @@ clean: ## Remove all gitignored files such as downloaded libraries and artifacts
##@ Build

.PHONY: build
build: download-libraries mpy-cross ## Build the project, store the result in the artifacts directory
@echo "Creating artifacts/proves"
@mkdir -p artifacts/proves
@echo "__version__ = '$(VERSION)'" > artifacts/proves/version.py
$(call compile_mpy)
$(call rsync_to_dest,.,artifacts/proves/)
@$(UV) run python -c "import os; [os.remove(os.path.join(root, file)) for root, _, files in os.walk('artifacts/proves/lib') for file in files if file.endswith('.py')]"
@echo "Creating artifacts/proves.zip"
@zip -r artifacts/proves.zip artifacts/proves > /dev/null
build: build-flight-software build-ground-station ## Build all projects

.PHONY: build-*
build-%: download-libraries-% mpy-cross ## Build the project, store the result in the artifacts directory
@echo "Creating artifacts/proves/$*"
@mkdir -p artifacts/proves/$*
@echo "__version__ = '$(VERSION)'" > artifacts/proves/$*/version.py
$(call compile_mpy,$*)
$(call rsync_to_dest,src/$*,artifacts/proves/$*/)
@$(UV) run python -c "import os; [os.remove(os.path.join(root, file)) for root, _, files in os.walk('artifacts/proves/$*/lib') for file in files if file.endswith('.py')]"
@echo "Creating artifacts/proves/$*.zip"
@zip -r artifacts/proves/$*.zip artifacts/proves/$* > /dev/null

define rsync_to_dest
@if [ -z "$(1)" ]; then \
Expand All @@ -84,17 +101,18 @@ define rsync_to_dest
exit 1; \
fi

@rsync -avh $(1)/config.json artifacts/proves/version.py $(1)/*.py $(1)/lib --exclude=".*" --exclude='requirements.txt' --exclude='__pycache__' $(2) --delete --times --checksum
@rsync -avh ./config.json $(2)/version.py $(1)/*.py $(1)/lib --exclude=".*" --exclude='requirements.txt' --exclude='__pycache__' $(2) --delete --times --checksum
endef

##@ Build Tools
TOOLS_DIR ?= tools
$(TOOLS_DIR):
mkdir -p $(TOOLS_DIR)
@mkdir -p $(TOOLS_DIR)

### Tool Versions
UV_VERSION ?= 0.5.24
UV_VERSION ?= 0.7.13
MPY_CROSS_VERSION ?= 9.0.5
CIRCUIT_PYTHON_VERSION ?= 9.2.8

UV_DIR ?= $(TOOLS_DIR)/uv-$(UV_VERSION)
UV ?= $(UV_DIR)/uv
Expand All @@ -104,6 +122,18 @@ uv: $(UV) ## Download uv
$(UV): $(TOOLS_DIR)
@test -s $(UV) || { mkdir -p $(UV_DIR); curl -LsSf https://astral.sh/uv/$(UV_VERSION)/install.sh | UV_INSTALL_DIR=$(UV_DIR) sh > /dev/null; }

ARDUINO_CLI ?= $(TOOLS_DIR)/arduino-cli
.PHONY: arduino-cli
arduino-cli: $(ARDUINO_CLI) ## Download arduino-cli
$(ARDUINO_CLI): $(TOOLS_DIR)
@test -s $(ARDUINO_CLI) || curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$(TOOLS_DIR) sh > /dev/null

CIRCUIT_PYTHON ?= $(TOOLS_DIR)/adafruit-circuitpython-proveskit_rp2350_v5b-en_US-$(CIRCUIT_PYTHON_VERSION).uf2
.PHONY: circuit-python
circuit-python: $(CIRCUIT_PYTHON) ## Download Circuit Python firmware
$(CIRCUIT_PYTHON): $(TOOLS_DIR)
@test -s $(CIRCUIT_PYTHON) || curl -o $(CIRCUIT_PYTHON) -fsSL https://raw.githubusercontent.com/proveskit/flight_controller_board/main/Firmware/FC_FIRM_v5b_V1.uf2

UNAME_S := $(shell uname -s)
UNAME_M := $(shell uname -m)

Expand Down Expand Up @@ -133,5 +163,5 @@ endif
endif

define compile_mpy
@$(UV) run python -c "import os, subprocess; [subprocess.run(['$(MPY_CROSS)', os.path.join(root, file)]) for root, _, files in os.walk('lib') for file in files if file.endswith('.py')]" || exit 1
@$(UV) run python -c "import os, subprocess; [subprocess.run(['$(MPY_CROSS)', os.path.join(root, file)]) for root, _, files in os.walk('src/$(1)/lib') for file in files if file.endswith('.py')]" || exit 1
endef
11 changes: 3 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
# ProvesKit RP2350 v5a CircuitPython Flight Software
# PROVES Kit RP2040 v5b CircuitPython Flight Software and Ground Station

[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
![CI](https://github.com/proveskit/CircuitPython_RP2350_v5a/actions/workflows/ci.yaml/badge.svg)
![CI](https://github.com/proveskit/CircuitPython_RP2350_v5b/actions/workflows/ci.yaml/badge.svg)

Software for the v5a PROVES Kit flight control board.

# Development Getting Started
We welcome contributions, so please feel free to join us. If you have any questions about contributing please open an issue or a discussion.

You can find our Getting Started Guide [here](https://github.com/proveskit/pysquared/blob/main/docs/dev-guide.md).
This is the template repository for v5b PROVES Kit Flight Controller boards. Head to our [docs site](https://proveskit.github.io/pysquared/) to get started.
Loading