Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Attempt to re-implement fsk operation using adafruit_rfm modules #36

Merged
merged 25 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d94fb1f
Add utility for acting as a client to another satalite
Camerooooon Oct 7, 2024
5842bfe
Implement the rest of the commands
Camerooooon Oct 9, 2024
260c319
Run linter
Camerooooon Oct 9, 2024
f688745
Revert default radio_cfg destination as to not potentially intefere w…
Camerooooon Oct 9, 2024
a8e52d6
Attempt to implement fsk operation using adafruit_rfm modules
Camerooooon Oct 10, 2024
12a7844
Adjust some settings to allow FSK to work
Camerooooon Nov 12, 2024
f1b0fbe
Merge branch 'radio-client-utility' into fsk
Camerooooon Nov 13, 2024
efe28a0
Working FSK modulation
Camerooooon Nov 13, 2024
4d4d4c6
Merge in nightly-dev
Camerooooon Nov 13, 2024
aebba00
Merge in orhepeus
Camerooooon Nov 13, 2024
3d4e37d
Finish merge on radio test
Camerooooon Nov 13, 2024
79a1138
Clean up code, remove comments and unneccesary files
Camerooooon Nov 13, 2024
589dc4a
Remove call sign
Camerooooon Nov 13, 2024
a9e5c4b
Remove callsign from functions.py
Camerooooon Nov 13, 2024
509c96e
Re-enable watchdog for new board
Camerooooon Nov 14, 2024
85b300e
is_licensed = False
Camerooooon Nov 14, 2024
b08e412
Move disabling fsk mode to after radio init
Camerooooon Nov 18, 2024
09decb4
Allow radio_test.py to switch to fsk mode correctly
Camerooooon Nov 18, 2024
b475bd9
Format state of health to not oversize
Camerooooon Nov 18, 2024
2af72e9
Fix radio temperature readout
Camerooooon Nov 18, 2024
43f82c1
Add read_u8 function for getting temp
Camerooooon Nov 18, 2024
2e26772
Add register mapping for temp
Camerooooon Nov 18, 2024
eecdb3a
Update legacy function to new function
Camerooooon Nov 18, 2024
ee63fa0
Merge branch 'orpheus_edition' into fsk
Camerooooon Nov 18, 2024
24cdbcb
Ran the Linter
Mikefly123 Nov 18, 2024
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
25 changes: 15 additions & 10 deletions FC_Board/lib/Big_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import traceback
import gc


class Face:
def __init__(self, Add, Pos, debug_state, tca):
self.tca = tca
self.address = Add
self.position = Pos
self.debug = debug_state

# Use tuple instead of list for immutable data
self.senlist = ()
# Define sensors based on position using a dictionary lookup instead of if-elif chain
Expand All @@ -18,13 +19,13 @@ def __init__(self, Add, Pos, debug_state, tca):
"x-": ("MCP", "VEML"),
"y+": ("MCP", "VEML", "DRV"),
"y-": ("MCP", "VEML"),
"z-": ("MCP", "VEML", "DRV")
"z-": ("MCP", "VEML", "DRV"),
}
self.senlist = sensor_map.get(Pos, ())

# Initialize sensor states dict only with needed sensors
self.sensors = {sensor: False for sensor in self.senlist}

# Initialize sensor objects as None
self.mcp = None
self.veml = None
Expand All @@ -36,47 +37,51 @@ def debug_print(self, statement):

def Sensorinit(self, senlist, address):
gc.collect() # Force garbage collection before initializing sensors

if "MCP" in senlist:
try:
import adafruit_mcp9808

self.mcp = adafruit_mcp9808.MCP9808(self.tca[address], address=27)
self.sensors["MCP"] = True
except Exception as e:
self.debug_print("[ERROR][Temperature Sensor]" + str(e))

if "VEML" in senlist:
try:
import adafruit_veml7700

self.veml = adafruit_veml7700.VEML7700(self.tca[address])
self.sensors["VEML"] = True
except Exception as e:
self.debug_print("[ERROR][Light Sensor]" + str(e))

if "DRV" in senlist:
try:
import adafruit_drv2605

self.drv = adafruit_drv2605.DRV2605(self.tca[address])
self.sensors["DRV"] = True
except Exception as e:
self.debug_print("[ERROR][Motor Driver]" + str(e))

gc.collect() # Clean up after initialization


class AllFaces:
def __init__(self, debug, tca):
self.tca = tca
self.debug = debug
self.faces = []

# Create faces using a loop instead of individual variables
positions = [("y+", 0), ("y-", 1), ("x+", 2), ("x-", 3), ("z-", 4)]
for pos, addr in positions:
face = Face(addr, pos, debug, tca)
face.Sensorinit(face.senlist, face.address)
self.faces.append(face)
gc.collect() # Clean up after each face initialization

def Face_Test_All(self):
results = []
for face in self.faces:
Expand Down
22 changes: 4 additions & 18 deletions FC_Board/lib/Field.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,15 @@ def debug_print(self, statement):
def __init__(self, cubesat, debug):
self.debug = debug
self.cubesat = cubesat
try:
if self.cubesat.legacy:
self.cubesat.enable_rf.value = True

self.cubesat.radio1.spreading_factor = 8
self.cubesat.radio1.low_datarate_optimize = False
self.cubesat.radio1.node = 0xFB
self.cubesat.radio1.destination = 0xFA
self.cubesat.radio1.receive_timeout = 10
self.cubesat.radio1.enable_crc = True
if self.cubesat.radio1.spreading_factor > 8:
self.cubesat.radio1.low_datarate_optimize = True
except Exception as e:
self.debug_print(
"Error Defining Radio features: "
+ "".join(traceback.format_exception(e))
)

def Beacon(self, msg):
try:
if self.cubesat.is_licensed:
self.debug_print("I am beaconing: " + str(msg))
self.cubesat.radio1.send(msg)
print(
"Message Success: "
+ str(self.cubesat.radio1.send_with_ack(bytes(msg, "UTF-8")))
)
else:
self.debug_print(
"Please toggle licensed variable in code once you obtain an amateur radio license"
Expand Down
Loading