Skip to content

Commit f4eacff

Browse files
Getting ready for docs update (#3)
* New repo organization with groundstation * fix readme * Add dev container * Update pyproject.toml Co-authored-by: Copilot <[email protected]> --------- Co-authored-by: Copilot <[email protected]>
1 parent 7f42a0e commit f4eacff

File tree

24 files changed

+633
-644
lines changed

24 files changed

+633
-644
lines changed

.devcontainer/devcontainer.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"containerEnv": {
3+
"BLINKA_FORCEBOARD": "GENERIC_LINUX_PC",
4+
"BLINKA_FORCECHIP": "GENERIC_X86"
5+
},
6+
"customizations": {
7+
"vscode": {
8+
"extensions": [
9+
"ms-python.python",
10+
"ms-python.vscode-pylance",
11+
"ms-python.isort",
12+
"ms-python.debugpy",
13+
"redhat.vscode-yaml",
14+
"tamasfe.even-better-toml"
15+
]
16+
}
17+
},
18+
"image": "mcr.microsoft.com/devcontainers/python:3.13",
19+
"name": "pysquared-dev",
20+
"postCreateCommand": "make .venv pre-commit-install"
21+
}

.github/workflows/ci.yaml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,27 @@ jobs:
1414
- name: Lint
1515
run: |
1616
make fmt
17+
typecheck:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Typecheck
22+
run: |
23+
make typecheck
1724
archive:
1825
runs-on: ubuntu-latest
1926
steps:
2027
- uses: actions/checkout@v4
2128
- name: Build
2229
run: |
2330
make build
24-
- name: Archive
31+
- name: Archive Flight Software
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: proveskit-flight-software
35+
path: artifacts/proves/flight-software
36+
- name: Archive Ground Station
2537
uses: actions/upload-artifact@v4
2638
with:
27-
name: proves
28-
path: artifacts/proves.zip
39+
name: proveskit-ground-station
40+
path: artifacts/proves/ground-station

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ venv
1111
**/*.mpy
1212

1313
# libs
14-
/lib/*
15-
!/lib/requirements.txt
14+
src/*/lib/*
15+
!src/*/lib/requirements.txt
16+
!src/flight-software/lib/proveskit_rp2350_v5b/

.pre-commit-config.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ repos:
77
- id: check-yaml
88
- id: check-json
99
- id: check-added-large-files
10+
- id: pretty-format-json
11+
args: [--autofix]
12+
exclude: '.vscode/.*'
1013
#- id: mixed-line-ending
1114
# args: [ --fix=lf ]
1215

Makefile

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

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

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

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

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

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

4450
.PHONY: install
45-
install: build ## Install the project onto a connected PROVES Kit use `make install BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
51+
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
4652
ifeq ($(OS),Windows_NT)
4753
rm -rf $(BOARD_MOUNT_POINT)
48-
cp -r artifacts/proves/* $(BOARD_MOUNT_POINT)
54+
cp -r artifacts/proves/$*/* $(BOARD_MOUNT_POINT)
4955
else
5056
@rm $(BOARD_MOUNT_POINT)/code.py > /dev/null 2>&1 || true
51-
$(call rsync_to_dest,artifacts/proves,$(BOARD_MOUNT_POINT))
57+
$(call rsync_to_dest,artifacts/proves/$*,$(BOARD_MOUNT_POINT))
5258
endif
5359

54-
# install-firmware
55-
.PHONY: install-firmware
56-
install-firmware: uv ## Install the board firmware onto a connected PROVES Kit
57-
@$(UVX) --from git+https://github.com/proveskit/[email protected] install-firmware v5b
60+
# install-circuit-python
61+
.PHONY: install-circuit-python
62+
install-circuit-python: arduino-cli circuit-python ## Install the Circuit Python onto a connected PROVES Kit
63+
@$(ARDUINO_CLI) config init || true
64+
@$(ARDUINO_CLI) config add board_manager.additional_urls https://github.com/earlephilhower/arduino-pico/releases/download/global/package_rp2040_index.json
65+
@$(ARDUINO_CLI) core install rp2040:[email protected]
66+
@$(ARDUINO_CLI) upload -v -b 115200 --fqbn rp2040:rp2040:rpipico -p $(BOARD_TTY_PORT) -i $(CIRCUIT_PYTHON)
67+
68+
.PHONY: list-tty
69+
list-tty: arduino-cli ## List available TTY ports
70+
@echo "TTY ports:"
71+
@$(ARDUINO_CLI) board list | grep "USB" | awk '{print $$1}'
5872

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

6579
.PHONY: build
66-
build: download-libraries mpy-cross ## Build the project, store the result in the artifacts directory
67-
@echo "Creating artifacts/proves"
68-
@mkdir -p artifacts/proves
69-
@echo "__version__ = '$(VERSION)'" > artifacts/proves/version.py
70-
$(call compile_mpy)
71-
$(call rsync_to_dest,.,artifacts/proves/)
72-
@$(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')]"
73-
@echo "Creating artifacts/proves.zip"
74-
@zip -r artifacts/proves.zip artifacts/proves > /dev/null
80+
build: build-flight-software build-ground-station ## Build all projects
81+
82+
.PHONY: build-*
83+
build-%: download-libraries-% mpy-cross ## Build the project, store the result in the artifacts directory
84+
@echo "Creating artifacts/proves/$*"
85+
@mkdir -p artifacts/proves/$*
86+
@echo "__version__ = '$(VERSION)'" > artifacts/proves/$*/version.py
87+
$(call compile_mpy,$*)
88+
$(call rsync_to_dest,src/$*,artifacts/proves/$*/)
89+
@$(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')]"
90+
@echo "Creating artifacts/proves/$*.zip"
91+
@zip -r artifacts/proves/$*.zip artifacts/proves/$* > /dev/null
7592

7693
define rsync_to_dest
7794
@if [ -z "$(1)" ]; then \
@@ -84,17 +101,18 @@ define rsync_to_dest
84101
exit 1; \
85102
fi
86103

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

90107
##@ Build Tools
91108
TOOLS_DIR ?= tools
92109
$(TOOLS_DIR):
93-
mkdir -p $(TOOLS_DIR)
110+
@mkdir -p $(TOOLS_DIR)
94111

95112
### Tool Versions
96-
UV_VERSION ?= 0.5.24
113+
UV_VERSION ?= 0.7.13
97114
MPY_CROSS_VERSION ?= 9.0.5
115+
CIRCUIT_PYTHON_VERSION ?= 9.2.8
98116

99117
UV_DIR ?= $(TOOLS_DIR)/uv-$(UV_VERSION)
100118
UV ?= $(UV_DIR)/uv
@@ -104,6 +122,18 @@ uv: $(UV) ## Download uv
104122
$(UV): $(TOOLS_DIR)
105123
@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; }
106124

125+
ARDUINO_CLI ?= $(TOOLS_DIR)/arduino-cli
126+
.PHONY: arduino-cli
127+
arduino-cli: $(ARDUINO_CLI) ## Download arduino-cli
128+
$(ARDUINO_CLI): $(TOOLS_DIR)
129+
@test -s $(ARDUINO_CLI) || curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | BINDIR=$(TOOLS_DIR) sh > /dev/null
130+
131+
CIRCUIT_PYTHON ?= $(TOOLS_DIR)/adafruit-circuitpython-proveskit_rp2350_v5b-en_US-$(CIRCUIT_PYTHON_VERSION).uf2
132+
.PHONY: circuit-python
133+
circuit-python: $(CIRCUIT_PYTHON) ## Download Circuit Python firmware
134+
$(CIRCUIT_PYTHON): $(TOOLS_DIR)
135+
@test -s $(CIRCUIT_PYTHON) || curl -o $(CIRCUIT_PYTHON) -fsSL https://raw.githubusercontent.com/proveskit/flight_controller_board/main/Firmware/FC_FIRM_v5b_V1.uf2
136+
107137
UNAME_S := $(shell uname -s)
108138
UNAME_M := $(shell uname -m)
109139

@@ -133,5 +163,5 @@ endif
133163
endif
134164

135165
define compile_mpy
136-
@$(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
166+
@$(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
137167
endef

README.md

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
1-
# ProvesKit RP2350 v5a CircuitPython Flight Software
1+
# PROVES Kit RP2040 v5b CircuitPython Flight Software and Ground Station
22

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

6-
Software for the v5a PROVES Kit flight control board.
7-
8-
# Development Getting Started
9-
We welcome contributions, so please feel free to join us. If you have any questions about contributing please open an issue or a discussion.
10-
11-
You can find our Getting Started Guide [here](https://github.com/proveskit/pysquared/blob/main/docs/dev-guide.md).
6+
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.

0 commit comments

Comments
 (0)