heater selection input

This commit is contained in:
Jakob Meier 2021-02-14 09:37:28 +01:00
parent 4433fb68ac
commit e19883d80f

View File

@ -14,12 +14,25 @@ class TestProcedure:
"""
@brief The variables in this class can be used to configure the heater test procedure.
"""
on = False # All heaters will be turned on
off = True # All heaters will be turned off
allOn = False # All heaters will be turned on
allOff = False # All heaters will be turned off
# Set to true if a specific heater shall be set to on or off
singleHeaterOn = True
singleHeaterOff = False
# When in single heater test mode, define here the heater to switch
singleHeaterSelection = 0xFF
class SwitchNumbers:
PAYLOAD_CAMERA_HEATER = 0
HEATER_0 = 0
HEATER_1 = 1
HEATER_2 = 2
HEATER_3 = 3
HEATER_4 = 4
HEATER_5 = 5
HEATER_6 = 6
HEATER_7 = 7
NUMBER_OF_SWITCHES = 8
class SwitchActions:
@ -34,16 +47,18 @@ class ActionIds:
def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT) -> TcQueueT:
tc_queue.appendleft((QueueCommands.PRINT, "Testing Heater Switching"))
if TestProcedure.on:
tc_queue.appendleft((QueueCommands.PRINT, "Switching on heater of payload camera"))
command = pack_switch_heater_command(object_id, SwitchNumbers.PAYLOAD_CAMERA_HEATER, SwitchActions.ON)
command = PusTelecommand(service=8, subservice=128, ssc=300, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
if TestProcedure.off:
tc_queue.appendleft((QueueCommands.PRINT, "Switching off heater of payload camera"))
command = pack_switch_heater_command(object_id, SwitchNumbers.PAYLOAD_CAMERA_HEATER, SwitchActions.OFF)
command = PusTelecommand(service=8, subservice=128, ssc=301, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
heater_number = int(input("Type number of heater to switch: "))
if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES:
print("Invalid heater switch number")
return
action = int(input("Turn switch on or off? (0 - off, 1 - on): "))
if action != 0 and action != 1:
print("Invalid action defined. Must be 0 (off) or 1 (on")
debug_string = "Switching heater " + str(heater_number)
tc_queue.appendleft((QueueCommands.PRINT, debug_string))
command = pack_switch_heater_command(object_id, heater_number, action)
command = PusTelecommand(service=8, subservice=128, ssc=300, app_data=command)
tc_queue.appendleft(command.pack_command_tuple())
def pack_switch_heater_command(object_id: bytearray, switch_nr: int, switch_action: int) -> bytearray: