Skip to content

Commit

Permalink
V.1.2.0 | 33 bring big data back (#49)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikefly123 authored Nov 12, 2024
1 parent 7b34621 commit ce9b7c4
Show file tree
Hide file tree
Showing 17 changed files with 1,635 additions and 109 deletions.
6 changes: 3 additions & 3 deletions Batt_Board/can_test.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from pysquared_eps import cubesat as c
import battery_functions
from pysquared import cubesat as c
import functions
import can_bus_helper
import time

f = battery_functions.functions(c)
f = functions.functions(c)

cb = can_bus_helper.CanBusHelper(c.can_bus, f, True)

Expand Down
4 changes: 4 additions & 0 deletions Batt_Board/lib/adafruit_mcp2515/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ def initialize(self):

self._set_mode(new_mode)

def sleep(self):
"""Put the MCP2515 to sleep"""
self._set_mode(_MODE_SLEEP)

def send(self, message_obj):
"""Send a message on the bus with the given data and id. If the message could not be sent
due to a full fifo or a bus error condition, RuntimeError is raised.
Expand Down
18 changes: 0 additions & 18 deletions Batt_Board/lib/battery_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,24 +265,6 @@ def face_toggle(self, face, state):
elif face == "Face5":
self.cubesat.Face0.duty_cycle = duty_cycle

def all_face_data(self):

self.cubesat.all_faces_on()
try:
import Big_Data

a = Big_Data.AllFaces(self.debug, self.cubesat.tca)

self.facestring = a.Face_Test_All()

del a
del Big_Data

except Exception as e:
self.debug_print("Big_Data error" + "".join(traceback.format_exception(e)))

return self.facestring

def get_imu_data(self):

self.cubesat.all_faces_on()
Expand Down
4 changes: 2 additions & 2 deletions FC_Board/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
"""
Built for the PySquared FC Board
Version: 1.2.0 (Beta)
Published: October 31, 2024
Published: Nov 12, 2024
"""

import time

print("=" * 70)
print("Hello World!")
print("PySquared FC Board Circuit Python Software Version: 1.2.0 (Beta)")
print("Published: October 31, 2024")
print("Published: November 12, 2024")
print("=" * 70)

loiter_time = 5
Expand Down
26 changes: 16 additions & 10 deletions Batt_Board/lib/Big_Data.py → FC_Board/lib/Big_Data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,20 @@

from debugcolor import co
import time
import board
import busio
import traceback
import gc

print(gc.mem_free())
import adafruit_mcp9808 # temperature sensor
import adafruit_tca9548a # I2C multiplexer

print(gc.mem_free())
import adafruit_veml7700 # light sensor

print(gc.mem_free())
import adafruit_drv2605 # Coil motor driver

print(gc.mem_free())


# Is the Face cass even necessary?
class Face:
Expand Down Expand Up @@ -168,8 +174,8 @@ def drive(self, sequence):
self.debug_print("[WARNING]Motor driver not initialized")

# Function to test all sensors that should be on each face.
# Function takes number of tests "num" and polling rate in hz "rate"
def test_all(self, num, rate):
# Function takes number of tests "num"
def test_all(self, num):
self.datalist = []
self.debug_print("Expected Sensors: " + str(self.senlist_what))
self.debug_print("Initialized Sensors: " + str(self.active_sensors))
Expand Down Expand Up @@ -341,11 +347,11 @@ def Face_Test_All(self):
try:
self.BigFaceList = []
self.debug_print("Creating Face List")
self.BigFaceList.append(self.Face0.test_all(1, 0.1))
self.BigFaceList.append(self.Face1.test_all(1, 0.1))
self.BigFaceList.append(self.Face2.test_all(1, 0.1))
self.BigFaceList.append(self.Face3.test_all(1, 0.1))
self.BigFaceList.append(self.Face4.test_all(1, 0.1))
self.BigFaceList.append(self.Face0.test_all(1))
self.BigFaceList.append(self.Face1.test_all(1))
self.BigFaceList.append(self.Face2.test_all(1))
self.BigFaceList.append(self.Face3.test_all(1))
self.BigFaceList.append(self.Face4.test_all(1))

for face in self.BigFaceList:
self.debug_print(str(face))
Expand Down
4 changes: 4 additions & 0 deletions FC_Board/lib/adafruit_mcp2515/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,10 @@ def initialize(self):

self._set_mode(new_mode)

def sleep(self):
"""Put the MCP2515 to sleep"""
self._set_mode(_MODE_SLEEP)

def send(self, message_obj):
"""Send a message on the bus with the given data and id. If the message could not be sent
due to a full fifo or a bus error condition, RuntimeError is raised.
Expand Down
Binary file removed FC_Board/lib/adafruit_tca9548a.mpy
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def __init__(self, tca: "TCA9548A", channel: int) -> None:

def try_lock(self) -> bool:
"""Pass through for try_lock."""
while not self.tca.i2c.try_lock():
trys = 0
while not self.tca.i2c.try_lock() and trys < 100:
trys += 1
time.sleep(0)
self.tca.i2c.writeto(self.tca.address, self.channel_switch)
return True
Expand Down
Loading

0 comments on commit ce9b7c4

Please sign in to comment.