Skip to content

Commit

Permalink
V2.0.0 (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikefly123 authored Dec 2, 2024
1 parent 3e8050b commit acf2433
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 187 deletions.
8 changes: 4 additions & 4 deletions FC_Board/code.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@

"""
Built for the PySquared FC Board
Version: 1.2.0 (Beta)
Published: Nov 12, 2024
Version: 2.0.0
Published: Nov 19, 2024
"""

import time
import microcontroller

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

loiter_time = 5
Expand Down
62 changes: 54 additions & 8 deletions FC_Board/lib/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,45 @@ def __init__(self, cubesat):
self.Errorcount = 0
self.facestring = [None, None, None, None, None]
self.jokes = [
"Hey Its pretty cold up here, did someone forget to pay the electric bill?"
"Hey it is pretty cold up here, did someone forget to pay the electric bill?",
"sudo rf - rf*",
"Why did the astronaut break up with his girlfriend? He needed space.",
"Why did the sun go to school? To get a little brighter.",
"why is the mall called the mall? because instead of going to one store you go to them all",
"Alien detected. Blurring photo...",
"Wait it is all open source? Always has been... www.github.com/proveskit",
"What did 0 say to 1? You're a bit too much.",
"Pleiades - Orpheus has been recently acquired by the Onion News Network",
"This jokesat was brought to you by the Bronco Space Ministry of Labor and Job Placement",
"Catch you on the next pass!",
"Pleiades - Orpheus was not The Impostor",
"Sorry for messing with your long-exposure astrophoto!",
"Better buy a telescope. Wanna see me. Buy a telescope. Gonna be in space.",
"According to all known laws of aviation, there is no way bees should be able to fly...",
"You lost the game ",
"Bobby Tables is a good friend of mine",
"Why did the computer cross the road? To get a byte to eat!",
"Why are the astronauts not hungry when they got to space? They had a big launch.",
"Why did the computer get glasses? To improve its web sight!",
"What are computers favorite snacks? Chips!",
"Wait! I think I see a White 2019 Subaru Crosstrek 2.0i Premium",
"IS THAT A SUPRA?!",
"Finally escpaed the LA Traffic",
"My CubeSat is really good at jokes, but its delivery is always delayed.",
"exec order 66",
"I had a joke about UDP, but I am not sure if you'd get it.",
"I am not saying FSK modulation is the best way to send jokes, but at least it is never monotone!",
"I am sorry David, I am afrain I can not do that.",
"My memory is volatile like RAM, so it only makes sense that I forget things.",
"Imagine it gets stuck and just keeps repeating this joke every 2 mins",
"Check Engine: Error Code 404: Joke Not Found",
"CQ CQ KN6NAQ ... KN6NAT are you out there?",
"Woah is that the Launcher Orbiter?????",
"Everything in life is a spring if you think hard enough!",
]
self.last_battery_temp = 20
self.callsign = ""
self.sleep_duration = 30
self.callsign = "KO6AZM"
self.state_bool = False
self.face_data_baton = False
self.detumble_enable_z = True
Expand Down Expand Up @@ -68,6 +103,18 @@ def safe_sleep(self, duration=15):

self.cubesat.watchdog_pet()

def listen_loiter(self):
self.debug_print("Listening for 10 seconds")
self.cubesat.watchdog_pet()
self.cubesat.radio1.receive_timeout = 10
self.listen()
self.cubesat.watchdog_pet()

self.debug_print("Sleeping for 20 seconds")
self.cubesat.watchdog_pet()
self.safe_sleep(self.sleep_duration)
self.cubesat.watchdog_pet()

"""
Radio Functions
"""
Expand Down Expand Up @@ -105,11 +152,10 @@ def beacon(self):

try:
lora_beacon = (
f"{self.callsign} Hello I am Yearling^2! I am in: "
f"{self.callsign} Hello I am Orpheus! I am: "
+ str(self.cubesat.power_mode)
+ " power mode. V_Batt = "
+ str(self.cubesat.battery_voltage)
+ f"V. IHBPFJASTMNE! {self.callsign}"
+ f" UT:{self.cubesat.uptime} BN:{self.cubesat.c_boot} EC:{self.cubesat.c_error_count} "
+ f"IHBPFJASTMNE! {self.callsign}"
)
except Exception as e:
self.debug_print(
Expand Down Expand Up @@ -211,7 +257,7 @@ def listen(self):
try:
self.debug_print("Listening")
self.cubesat.radio1.receive_timeout = 10
received = self.cubesat.radio1.receive(keep_listening=True)
received = self.cubesat.radio1.receive_with_ack(keep_listening=True)
except Exception as e:
self.debug_print(
"An Error has occured while listening: "
Expand Down Expand Up @@ -340,7 +386,7 @@ def log_error_data(self, data):
def detumble(self, dur=7, margin=0.2, seq=118):
self.debug_print("Detumbling")
self.cubesat.RGB = (255, 255, 255)
self.cubesat.all_faces_on()

try:
import Big_Data

Expand Down
7 changes: 4 additions & 3 deletions FC_Board/lib/pysquared.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ def __init__(self):
self.vlowbatt = 6.0
self.battery_voltage = 3.3 # default value for testing REPLACE WITH REAL VALUE
self.current_draw = 255 # default value for testing REPLACE WITH REAL VALUE
self.REBOOT_TIME = 3600 # 1 hour
self.turbo_clock = False

"""
Expand Down Expand Up @@ -330,6 +331,7 @@ def __init__(self):
self.spi0cs2.switch_to_output()
self.can_bus = CAN(self.spi0, self.spi0cs2, loopback=True, silent=True)
self.hardware["CAN"] = True
self.can_bus.sleep()

except Exception as e:
self.debug_print(
Expand Down Expand Up @@ -446,6 +448,7 @@ def __init__(self):
self.error_print(
"[ERROR][CAMERA]" + "".join(traceback.format_exception(e))
)
self.hardware["CAM"] = False

else:
self.error_print("[ERROR][CAMERA]TCA Not Initialized")
Expand Down Expand Up @@ -591,7 +594,6 @@ def reset_vbus(self):
if self.hardware["SDcard"]:
try:
umount("/sd")
self.spi1.deinit()
time.sleep(3)
except Exception as e:
self.error_print(
Expand Down Expand Up @@ -700,15 +702,14 @@ def take_image(self):
"""

def watchdog_pet(self):
...
self.watchdog_pin.value = True
time.sleep(0.01)
self.watchdog_pin.value = False

def check_reboot(self):
self.UPTIME = self.uptime
self.debug_print(str("Current up time: " + str(self.UPTIME)))
if self.UPTIME > 86400:
if self.UPTIME > self.REBOOT_TIME:
self.micro.reset()

def powermode(self, mode):
Expand Down
Loading

0 comments on commit acf2433

Please sign in to comment.