Skip to content

Commit

Permalink
Electrical's PCB impl
Browse files Browse the repository at this point in the history
  • Loading branch information
dyka3773 committed Jan 14, 2024
1 parent 661fe84 commit e485616
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 27 deletions.
12 changes: 6 additions & 6 deletions Rocket/app/Enums/PinsEnum.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
class PinsEnum(Enum):
"""An enum to store the pins used in the Jetson Nano."""

# LO = 11 # FIXME: Change this later
# SOE = 13 # FIXME: Change this later
# SODS = 15 # FIXME: Change this later\
LO = 21 # This is in Jim's PCB
SOE = 15 # This is in Jim's PCB
SODS = 11 # This is in Jim's PCB
LO = 16 # This is in Electrical's PCB
SOE = 18 # This is in Electrical's PCB
SODS = 22 # This is in Electrical's PCB
# LO = 21 # This is in Jim's PCB
# SOE = 15 # This is in Jim's PCB
# SODS = 11 # This is in Jim's PCB
UART_TX = 8 # These will not be used by the code but it's nice to have them for reference
UART_RX = 10 # These will not be used by the code but it's nice to have them for reference
LED_HEALTH = 16 # This is in Jim's PCB
Expand Down
2 changes: 1 addition & 1 deletion Rocket/app/Enums/TimelineEnum.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class TimelineEnum(Enum):
SOE_ON = 86 # Switch off the motor
SOE_OFF = 191 # The end of microgravity
LIFT_OFF = 0
START_MOTOR = 66 # 64 in Electrical's PCB
START_MOTOR = 64 # 66 in Jim's PCB
START_OF_MICROGRAVITY = 72

@property
Expand Down
17 changes: 9 additions & 8 deletions Rocket/app/SoundCard/SoundCardController.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,18 +103,19 @@ async def run_sound_card_cycle(starting_time: float):
run_motor_for = TimelineEnum.SOE_ON.value - TimelineEnum.START_MOTOR.value

# NOTE: This is the Electrical's PCB implementation
# threading.Thread(
# target=run_motor_cycle_labjack,
# args=(run_motor_for, card),
# daemon=True
# ).start()

threading.Thread(
target=run_motor_cycle,
args=(run_motor_for,),
target=run_motor_cycle_labjack,
args=(run_motor_for, card),
daemon=True
).start()

# NOTE: This is the Jim's PCB implementation
# threading.Thread(
# target=run_motor_cycle,
# args=(run_motor_for,),
# daemon=True
# ).start()

logging.info("Motor is ON and running at FULL_SPEED")
else:
await DataStorage().save_motor_speed(MotorSpeedsEnum.STOP.value)
Expand Down
12 changes: 0 additions & 12 deletions Rocket/app/SoundCard/motor_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
filemode='a'
)

CURRENT_STATE = None


def run_motor_cycle_labjack(run_for: float, device: u3.U3):
"""Runs the motor cycle.
Expand Down Expand Up @@ -74,19 +72,10 @@ def run_motor_cycle(run_for: float):

turn_off_motor()

# try:
# turn_on_motor()
# time.sleep(run_for)
# turn_off_motor()
# except Exception as e:
# logging.error("An Error has occured in the LED Driver")
# logging.error(e)


def turn_on_motor() -> None:
try:
GPIO.output(PinsEnum.MOTOR_CONTROL.value, GPIO.HIGH)
CURRENT_STATE = GPIO.HIGH
except Exception as e:
logging.error("An Error has occured in the LED Driver")
logging.error(e)
Expand All @@ -96,7 +85,6 @@ def turn_on_motor() -> None:
def turn_off_motor() -> None:
try:
GPIO.output(PinsEnum.MOTOR_CONTROL.value, GPIO.LOW)
CURRENT_STATE = GPIO.LOW
except Exception as e:
logging.error("An Error has occured in the LED Driver")
logging.error(e)
Expand Down

0 comments on commit e485616

Please sign in to comment.