added various useful commands

This commit is contained in:
Robin Müller 2022-03-16 18:44:28 +01:00
parent d188b10f64
commit 6e14e1b268
5 changed files with 106 additions and 24 deletions

View File

@ -306,47 +306,66 @@ def add_pcdu_cmds(cmd_dict: ServiceOpCodeDictT):
)
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict,
keys="0",
info="PDU2 Tests",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(op_code_dict=op_code_dict, keys="0", info="PDU2 Tests")
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.ACS_SIDE_B_ON.value,
info="PDU2: Turn ACS Side B on",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.ACS_SIDE_B_OFF.value,
info="PDU2: Turn ACS Side B off",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_ON.value,
info="PDU2: Turn SUS redundant on",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.SUS_REDUNDANT_OFF.value,
info="PDU2: Turn SUS redundant off",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_ON.value,
info="PDU2: Turn reaction wheels on",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.RW_OFF.value,
info="PDU2: Turn reaction wheels off",
options={OpCodeDictKeys.TIMEOUT: 2.0},
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value,
info="PDU2: PL PCDU Switch Channel Nominal (1) off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value,
info="PDU2: PL PCDU Switch Channel Redundant (1) off",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_ON.value,
info="PDU2: Switch TCS Heater Input on",
)
add_op_code_entry(
op_code_dict=op_code_dict,
keys=Pdu2OpCodes.TCS_HEATER_IN_OFF.value,
info="PDU2: Switch TCS Heater Input off",
)
add_op_code_entry(
op_code_dict=op_code_dict,

View File

@ -29,8 +29,8 @@ class ActionIds:
def pack_heater_test_into(object_id: bytearray, tc_queue: TcQueueT):
tc_queue.appendleft((QueueCommands.PRINT, "Testing Heater Switching"))
heater_number = int(input("Type number of heater to switch: "))
if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES:
heater_number = int(input("Type number of heater to switch [0-7]: "))
if heater_number >= SwitchNumbers.NUMBER_OF_SWITCHES or heater_number < 0:
print("Invalid heater switch number")
return
action = int(input("Turn switch on or off? (0 - off, 1 - on): "))
@ -52,7 +52,8 @@ def pack_switch_heater_command(
@param switch_action Action to perform. 0 - Sets switch off, 1 - Sets switch on.
"""
action_id = ActionIds.SWITCH_HEATER
command = object_id + action_id
command = bytearray()
command += object_id + action_id
command.append(switch_nr)
command.append(switch_action)
return command

View File

@ -126,9 +126,7 @@ def pack_p60dock_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: st
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "P60 Dock: Print Latchups")
)
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Latchups"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)

View File

@ -204,9 +204,7 @@ def pack_pdu1_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU1: Print Latchups")
)
tc_queue.appendleft((QueueCommands.PRINT, "PDU1: Print Latchups"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)

View File

@ -21,6 +21,12 @@ class Pdu2OpCodes(enum.Enum):
SUS_REDUNDANT_OFF = "4"
RW_ON = "5"
RW_OFF = "6"
PL_PCDU_VBAT_NOM_ON = "7"
PL_PCDU_VBAT_NOM_OFF = "8"
PL_PCDU_VBAT_RED_ON = "9"
PL_PCDU_VBAT_RED_OFF = "10"
TCS_HEATER_IN_ON = "11"
TCS_HEATER_IN_OFF = "12"
# There is not really a point of the on command, the SW can not be commanded if the OBC is off
Q7S_OFF = "32"
@ -120,6 +126,68 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_ON.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 on")
)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_NOM_OFF.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 1 off")
)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_1.parameter_address,
PDUConfigTable.out_en_1.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_ON.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 on")
)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.PL_PCDU_VBAT_RED_OFF.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Turn PDU2 PL PCDU Channel 6 off")
)
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_6.parameter_address,
PDUConfigTable.out_en_6.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.TCS_HEATER_IN_ON.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input on"))
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.on,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == Pdu2OpCodes.TCS_HEATER_IN_OFF.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn TCS Heater Input off"))
command = pack_set_param_command(
object_id,
PDUConfigTable.out_en_3.parameter_address,
PDUConfigTable.out_en_3.parameter_size,
Channel.off,
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.REQUEST_HK_ONCE.value:
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Requesting HK Table Once"))
hk_sid = make_sid(object_id=PDU_2_HANDLER_ID, set_id=SetIds.PDU_2)
@ -134,9 +202,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str):
)
tc_queue.appendleft(command.pack_command_tuple())
if op_code == GomspaceOpCodes.PRINT_LATCHUPS.value:
tc_queue.appendleft(
(QueueCommands.PRINT, "PDU2: Print Latchups")
)
tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Print Latchups"))
command = generate_action_command(
object_id=object_id, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
)