Skip to content

Commit 39723e0

Browse files
authored
Merge pull request #6 from proveskit/beacon
Implement beacon in flight-software add ground-station
2 parents 684fbf5 + 2bc98d7 commit 39723e0

File tree

21 files changed

+433
-439
lines changed

21 files changed

+433
-439
lines changed

.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_v5a/

.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: 32 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
PYSQUARED_VERSION ?= v2.0.0-alpha-25w20
1+
PYSQUARED_VERSION ?= v2.0.0-alpha-25w26-2
22
PYSQUARED ?= git+https://github.com/proveskit/pysquared@$(PYSQUARED_VERSION)
33

44
.PHONY: all
@@ -14,16 +14,19 @@ help: ## Display this help.
1414
@echo "Creating virtual environment..."
1515
@$(MAKE) uv
1616
@$(UV) venv
17-
@$(UV) pip install --requirement pyproject.toml
17+
@$(UV) sync
1818

1919
.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
20+
download-libraries: download-libraries-flight-software download-libraries-ground-station
2421

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

2831
.PHONY: pre-commit-install
2932
pre-commit-install: uv
@@ -38,17 +41,20 @@ sync-time: uv ## Syncs the time from your computer to the PROVES Kit board
3841
fmt: pre-commit-install ## Lint and format files
3942
$(UVX) pre-commit run --all-files
4043

44+
typecheck: .venv download-libraries ## Run type check
45+
@$(UV) run -m pyright .
46+
4147
BOARD_MOUNT_POINT ?= ""
4248
VERSION ?= $(shell git tag --points-at HEAD --sort=-creatordate < /dev/null | head -n 1)
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

5460
# install-firmware
@@ -63,15 +69,18 @@ clean: ## Remove all gitignored files such as downloaded libraries and artifacts
6369
##@ Build
6470

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

7685
define rsync_to_dest
7786
@if [ -z "$(1)" ]; then \
@@ -84,7 +93,7 @@ define rsync_to_dest
8493
exit 1; \
8594
fi
8695

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

9099
##@ Build Tools
@@ -93,7 +102,7 @@ $(TOOLS_DIR):
93102
mkdir -p $(TOOLS_DIR)
94103

95104
### Tool Versions
96-
UV_VERSION ?= 0.5.24
105+
UV_VERSION ?= 0.7.13
97106
MPY_CROSS_VERSION ?= 9.0.5
98107

99108
UV_DIR ?= $(TOOLS_DIR)/uv-$(UV_VERSION)
@@ -133,5 +142,5 @@ endif
133142
endif
134143

135144
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
145+
@$(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
137146
endef

config.json

Lines changed: 80 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,84 @@
11
{
2-
"cubesat_name": "Orpheus",
3-
"last_battery_temp": 20.0,
4-
"sleep_duration": 30,
5-
"detumble_enable_z": true,
6-
"detumble_enable_x":true,
7-
"detumble_enable_y": true,
8-
"jokes": [
9-
"Hey it is pretty cold up here, did someone forget to pay the electric bill?",
10-
"sudo rf - rf*",
11-
"Why did the astronaut break up with his girlfriend? He needed space.",
12-
"Why did the sun go to school? To get a little brighter.",
13-
"why is the mall called the mall? because instead of going to one store you go to them all",
14-
"Alien detected. Blurring photo...",
15-
"Wait it is all open source? Always has been... www.github.com/proveskit",
16-
"What did 0 say to 1? You're a bit too much.",
17-
"Pleiades - Orpheus has been recently acquired by the Onion News Network",
18-
"This jokesat was brought to you by the Bronco Space Ministry of Labor and Job Placement",
19-
"Catch you on the next pass!",
20-
"Pleiades - Orpheus was not The Impostor",
21-
"Sorry for messing with your long-exposure astrophoto!",
22-
"Better buy a telescope. Wanna see me. Buy a telescope. Gonna be in space.",
23-
"According to all known laws of aviation, there is no way bees should be able to fly...",
24-
"You lost the game ",
25-
"Bobby Tables is a good friend of mine",
26-
"Why did the computer cross the road? To get a byte to eat!",
27-
"Why are the astronauts not hungry when they got to space? They had a big launch.",
28-
"Why did the computer get glasses? To improve its web sight!",
29-
"What are computers favorite snacks? Chips!",
30-
"Wait! I think I see a White 2019 Subaru Crosstrek 2.0i Premium",
31-
"IS THAT A SUPRA?!",
32-
"Finally escpaed the LA Traffic",
33-
"My CubeSat is really good at jokes, but its delivery is always delayed.",
34-
"exec order 66",
35-
"I had a joke about UDP, but I am not sure if you'd get it.",
36-
"I am not saying FSK modulation is the best way to send jokes, but at least it is never monotone!",
37-
"I am sorry David, I am afrain I can not do that.",
38-
"My memory is volatile like RAM, so it only makes sense that I forget things.",
39-
"Imagine it gets stuck and just keeps repeating this joke every 2 mins",
40-
"Check Engine: Error Code 404: Joke Not Found",
41-
"CQ CQ KN6NAQ ... KN6NAT are you out there?",
42-
"Woah is that the Launcher Orbiter?????",
43-
"Everything in life is a spring if you think hard enough!"
44-
],
45-
"debug": true,
46-
"heating": false,
47-
"normal_temp": 20,
48-
"normal_battery_temp": 1,
49-
"normal_micro_temp": 20,
50-
"normal_charge_current": 0.5,
51-
"normal_battery_voltage": 6.9,
52-
"critical_battery_voltage": 6.6,
53-
"battery_voltage": 5.2,
54-
"current_draw": 240.5,
55-
"reboot_time": 3600,
56-
"longest_allowable_sleep_time": 360,
57-
"turbo_clock": false,
58-
"radio": {
59-
"license": "",
60-
"receiver_id": 250,
61-
"sender_id": 251,
62-
"start_time": 80000,
63-
"transmit_frequency": 437.4,
2+
"battery_voltage": 5.2,
3+
"critical_battery_voltage": 6.6,
4+
"cubesat_name": "PROVES-MY_SATELLITE_NAME",
5+
"current_draw": 240.5,
6+
"debug": true,
7+
"detumble_enable_x": true,
8+
"detumble_enable_y": true,
9+
"detumble_enable_z": true,
10+
"heating": false,
11+
"jokes": [
12+
"Hey it is pretty cold up here, did someone forget to pay the electric bill?",
13+
"sudo rf - rf*",
14+
"Why did the astronaut break up with his girlfriend? He needed space.",
15+
"Why did the sun go to school? To get a little brighter.",
16+
"why is the mall called the mall? because instead of going to one store you go to them all",
17+
"Alien detected. Blurring photo...",
18+
"Wait it is all open source? Always has been... www.github.com/proveskit",
19+
"What did 0 say to 1? You're a bit too much.",
20+
"Pleiades - Orpheus has been recently acquired by the Onion News Network",
21+
"This jokesat was brought to you by the Bronco Space Ministry of Labor and Job Placement",
22+
"Catch you on the next pass!",
23+
"Pleiades - Orpheus was not The Impostor",
24+
"Sorry for messing with your long-exposure astrophoto!",
25+
"Better buy a telescope. Wanna see me. Buy a telescope. Gonna be in space.",
26+
"According to all known laws of aviation, there is no way bees should be able to fly...",
27+
"You lost the game ",
28+
"Bobby Tables is a good friend of mine",
29+
"Why did the computer cross the road? To get a byte to eat!",
30+
"Why are the astronauts not hungry when they got to space? They had a big launch.",
31+
"Why did the computer get glasses? To improve its web sight!",
32+
"What are computers favorite snacks? Chips!",
33+
"Wait! I think I see a White 2019 Subaru Crosstrek 2.0i Premium",
34+
"IS THAT A SUPRA?!",
35+
"Finally escpaed the LA Traffic",
36+
"My CubeSat is really good at jokes, but its delivery is always delayed.",
37+
"exec order 66",
38+
"I had a joke about UDP, but I am not sure if you'd get it.",
39+
"I am not saying FSK modulation is the best way to send jokes, but at least it is never monotone!",
40+
"I am sorry David, I am afrain I can not do that.",
41+
"My memory is volatile like RAM, so it only makes sense that I forget things.",
42+
"Imagine it gets stuck and just keeps repeating this joke every 2 mins",
43+
"Check Engine: Error Code 404: Joke Not Found",
44+
"CQ CQ KN6NAQ ... KN6NAT are you out there?",
45+
"Woah is that the Launcher Orbiter?????",
46+
"Everything in life is a spring if you think hard enough!",
47+
"Your Mom",
48+
"Your Mum",
49+
"Your Face",
50+
"not True lol",
51+
"I have brought peace, freedom, justice, and security to my new empire! Your New Empire?"
52+
],
53+
"last_battery_temp": 20.0,
54+
"longest_allowable_sleep_time": 360,
55+
"normal_battery_temp": 1,
56+
"normal_battery_voltage": 6.9,
57+
"normal_charge_current": 0.5,
58+
"normal_micro_temp": 20,
59+
"normal_temp": 20,
60+
"radio": {
61+
"fsk": {
62+
"broadcast_address": 255,
63+
"modulation_type": 0,
64+
"node_address": 1
65+
},
66+
"license": "KK4PDM",
6467
"lora": {
65-
"ack_delay": 0.2,
66-
"coding_rate": 8,
67-
"cyclic_redundancy_check": true,
68-
"max_output": true,
69-
"spreading_factor": 8,
70-
"transmit_power": 23
68+
"ack_delay": 0.2,
69+
"coding_rate": 8,
70+
"cyclic_redundancy_check": true,
71+
"max_output": true,
72+
"spreading_factor": 8,
73+
"transmit_power": 23
7174
},
72-
"fsk": {
73-
"broadcast_address": 255,
74-
"node_address": 1,
75-
"modulation_type": 0
76-
}
77-
},
78-
"super_secret_code": "ABCD",
79-
"repeat_code": "RP",
80-
"joke_reply": [
81-
"Your Mom",
82-
"Your Mum",
83-
"Your Face",
84-
"not True lol",
85-
"I have brought peace, freedom, justice, and security to my new empire! Your New Empire?"
86-
]
75+
"modulation": "LoRa",
76+
"start_time": 80000,
77+
"transmit_frequency": 437.4
78+
},
79+
"reboot_time": 3600,
80+
"repeat_code": "RP",
81+
"sleep_duration": 30,
82+
"super_secret_code": "ABCD",
83+
"turbo_clock": false
8784
}

pyproject.toml

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,38 @@ version = "1.0.0"
44
description = "Flight Software for the PROVES Kit RP2350 v5A"
55
readme = "README.md"
66
requires-python = ">=3.13"
7-
dependencies = [
8-
"adafruit-circuitpython-typing==1.11.2",
9-
"circuitpython-stubs==9.2.5",
10-
"coverage==7.6.10",
11-
"pre-commit==4.0.1",
12-
"pyright[nodejs]==1.1.399",
13-
"pytest==8.3.2",
7+
dependencies = []
8+
9+
[dependency-groups]
10+
dev = [
11+
"adafruit-circuitpython-typing==1.12.1",
12+
"circuitpython-stubs==9.2.8",
13+
"pre-commit==4.2.0",
14+
"pyright[nodejs]==1.1.402",
1415
]
1516

1617
[tool.ruff.format]
1718
# Use `\n` line endings for all files
1819
line-ending = "lf"
1920

2021
[tool.pyright]
21-
include = ["main.py", "boot.py", "repl.py", "safemode.py"]
22+
include = [
23+
"src/flight-software/boot.py",
24+
"src/flight-software/main.py",
25+
"src/flight-software/repl.py",
26+
"src/flight-software/safemode.py",
27+
"src/flight-software/lib/proveskit_rp2040_v4/*",
28+
"src/ground_station/boot.py",
29+
"src/ground_station/main.py",
30+
"src/ground_station/repl.py",
31+
"src/ground_station/safemode.py",
32+
]
2233
exclude = [
2334
"**/__pycache__",
2435
".venv",
2536
".git",
2637
"artifacts",
27-
"lib",
38+
"src/*/lib",
2839
"typings",
2940
]
3041
stubPath = "./typings"
File renamed without changes.

src/flight-software/lib/proveskit_rp2350_v5a/__init__.py

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
class Register:
2+
boot_count = 0
3+
error_count = 1
File renamed without changes.

0 commit comments

Comments
 (0)