Skip to content

Commit bd5dfb6

Browse files
committed
s
2 parents d01008f + 4fc060f commit bd5dfb6

File tree

4 files changed

+184
-102
lines changed

4 files changed

+184
-102
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
44
![CI](https://github.com/proveskit/CircuitPython_RP2040_v4/actions/workflows/ci.yaml/badge.svg)
55

6-
Software for the v4 PROVES Kit flight control board.
6+
This is the reference software for the v4x PROVES Kit Flight Controller boards. Clone this repository and use the `make install ...` tooling to get your v4x Flight Controller Board up and running!
77

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

1111
You can find our Getting Started Guide [here](https://github.com/proveskit/pysquared/blob/main/docs/dev-guide.md).
12+
13+
If you have a mission specific usecase for the CircuitPython Flight Software you can fork this repo and use it as a baseline for developing your own system!

config.json

Lines changed: 77 additions & 76 deletions
Original file line numberDiff line numberDiff line change
@@ -1,87 +1,88 @@
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": 600,
57-
"turbo_clock": false,
58-
"radio": {
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": 600,
57+
"turbo_clock": false,
58+
"radio": {
5959
"license": "KK4PDM",
60+
"modulation": "LoRa",
6061
"receiver_id": 250,
6162
"sender_id": 251,
6263
"start_time": 80000,
6364
"transmit_frequency": 437.4,
6465
"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
66+
"ack_delay": 0.2,
67+
"coding_rate": 8,
68+
"cyclic_redundancy_check": true,
69+
"max_output": true,
70+
"spreading_factor": 8,
71+
"transmit_power": 23
7172
},
7273
"fsk": {
73-
"broadcast_address": 255,
74-
"node_address": 1,
75-
"modulation_type": 0
74+
"broadcast_address": 255,
75+
"node_address": 1,
76+
"modulation_type": 0
7677
}
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-
]
78+
},
79+
"super_secret_code": "ABCD",
80+
"repeat_code": "RP",
81+
"joke_reply": [
82+
"Your Mom",
83+
"Your Mum",
84+
"Your Face",
85+
"not True lol",
86+
"I have brought peace, freedom, justice, and security to my new empire! Your New Empire?"
87+
]
8788
}

main.py

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
except ImportError:
2323
import board
2424

25-
from lib.proveskit_rp2040_v4.register import BitIndex, Register
25+
from lib.proveskit_rp2040_v4.register import Register
2626
from lib.pysquared.beacon import Beacon
2727
from lib.pysquared.cdh import CommandDataHandler
2828
from lib.pysquared.config.config import Config
@@ -34,7 +34,6 @@
3434
from lib.pysquared.hardware.radio.packetizer.packet_manager import PacketManager
3535
from lib.pysquared.logger import Logger
3636
from lib.pysquared.nvm.counter import Counter
37-
from lib.pysquared.nvm.flag import Flag
3837
from lib.pysquared.rtc.manager.microcontroller import MicrocontrollerManager
3938
from lib.pysquared.sleep_helper import SleepHelper
4039
from lib.pysquared.watchdog import Watchdog
@@ -46,7 +45,6 @@
4645

4746
(boot_count := Counter(index=Register.boot_count)).increment()
4847
error_count: Counter = Counter(index=Register.error_count)
49-
use_fsk = Flag(index=Register.flag, bit_index=BitIndex.use_fsk)
5048

5149
logger: Logger = Logger(
5250
error_counter=error_count,
@@ -82,7 +80,6 @@
8280
radio = RFM9xManager(
8381
logger,
8482
config.radio,
85-
use_fsk,
8683
spi0,
8784
initialize_pin(logger, board.SPI0_CS0, digitalio.Direction.OUTPUT, True),
8885
initialize_pin(logger, board.RF1_RST, digitalio.Direction.OUTPUT, True),
@@ -108,7 +105,7 @@
108105

109106
sleep_helper = SleepHelper(logger, watchdog, config)
110107

111-
cdh = CommandDataHandler(config, logger, radio)
108+
cdh = CommandDataHandler(logger, config, radio)
112109

113110
beacon = Beacon(
114111
logger,
@@ -118,7 +115,6 @@
118115
imu,
119116
magnetometer,
120117
radio,
121-
use_fsk,
122118
error_count,
123119
boot_count,
124120
)
@@ -127,9 +123,7 @@ def initial_boot():
127123
watchdog.pet()
128124
beacon.send()
129125
watchdog.pet()
130-
message: bytes | None = packet_manager.listen()
131-
if message:
132-
cdh.message_handler(message)
126+
cdh.listen_for_commands(10)
133127
watchdog.pet()
134128

135129
try:
@@ -162,9 +156,7 @@ def main():
162156

163157
watchdog.pet()
164158

165-
message: bytes | None = packet_manager.listen()
166-
if message:
167-
cdh.message_handler(message)
159+
cdh.listen_for_commands(10)
168160

169161
watchdog.pet()
170162

@@ -175,19 +167,15 @@ def main():
175167
# TODO(nateinaction): replace me
176168
# f.state_of_health()
177169

178-
message: bytes | None = packet_manager.listen()
179-
if message:
180-
cdh.message_handler(message)
170+
cdh.listen_for_commands(10)
181171

182172
watchdog.pet()
183173

184174
sleep_helper.safe_sleep(config.sleep_duration)
185175

186176
watchdog.pet()
187177

188-
message: bytes | None = packet_manager.listen()
189-
if message:
190-
cdh.message_handler(message)
178+
cdh.listen_for_commands(10)
191179

192180
watchdog.pet()
193181

@@ -199,9 +187,7 @@ def main():
199187

200188
watchdog.pet()
201189

202-
message: bytes | None = packet_manager.listen()
203-
if message:
204-
cdh.message_handler(message)
190+
cdh.listen_for_commands(10)
205191

206192
watchdog.pet()
207193

@@ -213,9 +199,7 @@ def main():
213199

214200
watchdog.pet()
215201

216-
message: bytes | None = packet_manager.listen()
217-
if message:
218-
cdh.message_handler(message)
202+
cdh.listen_for_commands(10)
219203

220204
watchdog.pet()
221205

0 commit comments

Comments
 (0)