Skip to content

Commit 9f98a21

Browse files
committed
Split flight and ground station software
1 parent c881462 commit 9f98a21

File tree

21 files changed

+185
-24
lines changed

21 files changed

+185
-24
lines changed

.gitignore

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ venv
1212
firmware.uf2
1313

1414
# libs
15-
/lib/*
16-
!/lib/requirements.txt
17-
!/lib/proveskit_rp2040_v4/
15+
flight-software/src/lib/*
16+
!flight-software/src/lib/requirements.txt
17+
!flight-software/src/lib/proveskit_rp2040_v4/
18+
19+
ground-station/src/lib/*
20+
!ground-station/src/lib/requirements.txt
21+
!ground-station/src/lib/proveskit_rp2040_v4/

Makefile

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,20 @@ help: ## Display this help.
1414
@echo "Creating virtual environment..."
1515
@$(MAKE) uv
1616
@$(UV) venv
17-
@$(UV) pip install --requirement pyproject.toml
17+
@$(UV) pip install --requirement flight-software/pyproject.toml
18+
@$(UV) pip install --requirement ground-station/pyproject.toml
1819

1920
.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
21+
download-libraries: download-libraries/flight-software download-libraries/ground-station
2422

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

2832
.PHONY: pre-commit-install
2933
pre-commit-install: uv
@@ -45,13 +49,13 @@ BOARD_MOUNT_POINT ?= ""
4549
VERSION ?= $(shell git tag --points-at HEAD --sort=-creatordate < /dev/null | head -n 1)
4650

4751
.PHONY: install
48-
install: build ## Install the project onto a connected PROVES Kit use `make install BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
52+
install-%: build-% ## Install the project onto a connected PROVES Kit use `make install BOARD_MOUNT_POINT=/my_board_destination/` to specify the mount point
4953
ifeq ($(OS),Windows_NT)
5054
rm -rf $(BOARD_MOUNT_POINT)
51-
cp -r artifacts/proves/* $(BOARD_MOUNT_POINT)
55+
cp -r artifacts/proves/$*/* $(BOARD_MOUNT_POINT)
5256
else
5357
@rm $(BOARD_MOUNT_POINT)/code.py > /dev/null 2>&1 || true
54-
$(call rsync_to_dest,artifacts/proves,$(BOARD_MOUNT_POINT))
58+
$(call rsync_to_dest,artifacts/proves/$*,$(BOARD_MOUNT_POINT))
5559
endif
5660

5761
# install-firmware
@@ -66,15 +70,18 @@ clean: ## Remove all gitignored files such as downloaded libraries and artifacts
6670
##@ Build
6771

6872
.PHONY: build
69-
build: download-libraries mpy-cross ## Build the project, store the result in the artifacts directory
70-
@echo "Creating artifacts/proves"
71-
@mkdir -p artifacts/proves
72-
@echo "__version__ = '$(VERSION)'" > artifacts/proves/version.py
73-
$(call compile_mpy)
74-
$(call rsync_to_dest,.,artifacts/proves/)
75-
@$(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')]"
76-
@echo "Creating artifacts/proves.zip"
77-
@zip -r artifacts/proves.zip artifacts/proves > /dev/null
73+
build: build-flight-software build-ground-station ## Build all projects
74+
75+
.PHONY: build-*
76+
build-%: download-libraries/% mpy-cross ## Build the project, store the result in the artifacts directory
77+
@echo "Creating artifacts/proves/$*"
78+
@mkdir -p artifacts/proves/$*
79+
@echo "__version__ = '$(VERSION)'" > artifacts/proves/$*/version.py
80+
$(call compile_mpy,$*)
81+
$(call rsync_to_dest,$*/src,artifacts/proves/$*/)
82+
@$(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')]"
83+
@echo "Creating artifacts/proves/$*.zip"
84+
@zip -r artifacts/proves/$*.zip artifacts/proves/$* > /dev/null
7885

7986
define rsync_to_dest
8087
@if [ -z "$(1)" ]; then \
@@ -87,7 +94,7 @@ define rsync_to_dest
8794
exit 1; \
8895
fi
8996

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

93100
##@ Build Tools
@@ -136,5 +143,5 @@ endif
136143
endif
137144

138145
define compile_mpy
139-
@$(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
146+
@$(UV) run python -c "import os, subprocess; [subprocess.run(['$(MPY_CROSS)', os.path.join(root, file)]) for root, _, files in os.walk('$(1)/src/lib') for file in files if file.endswith('.py')]" || exit 1
140147
endef

config.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
"turbo_clock": false,
5858
"radio": {
5959
"license": "KK4PDM",
60+
"modulation": "LoRa",
6061
"receiver_id": 250,
6162
"sender_id": 251,
6263
"start_time": 80000,
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ dependencies = [
1313
"pytest==8.3.2",
1414
]
1515

16+
[tool.setuptools.packages.find]
17+
where = ["src/"]
18+
include = ["circuitpython_rp2040_v4.flight_software"]
19+
1620
[tool.ruff.format]
1721
# Use `\n` line endings for all files
1822
line-ending = "lf"
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)