diff --git a/pus_tc/cmd_definitions.py b/pus_tc/cmd_definitions.py index 74d5439..a41d75e 100644 --- a/pus_tc/cmd_definitions.py +++ b/pus_tc/cmd_definitions.py @@ -134,9 +134,7 @@ def add_pl_pcdu_cmds(cmd_dict: ServiceOpCodeDictT): info=Info.NORMAL_HPA, ) add_op_code_entry( - op_code_dict=op_code_dict, - keys=OpCodes.SWITCH_OFF, - info=Info.SWITCH_OFF + op_code_dict=op_code_dict, keys=OpCodes.SWITCH_OFF, info=Info.SWITCH_OFF ) add_op_code_entry( op_code_dict=op_code_dict, diff --git a/pus_tc/devs/pdu2.py b/pus_tc/devs/pdu2.py index db800fa..d08087d 100644 --- a/pus_tc/devs/pdu2.py +++ b/pus_tc/devs/pdu2.py @@ -215,9 +215,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == Pdu2OpCodes.PL_CAMERA_ON.value: - tc_queue.appendleft( - (QueueCommands.PRINT, "PDU2: Turn payload camera on") - ) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn payload camera on")) command = pack_set_param_command( object_id, PDUConfigTable.out_en_8.parameter_address, @@ -226,9 +224,7 @@ def pack_pdu2_commands(object_id: bytearray, tc_queue: TcQueueT, op_code: str): ) tc_queue.appendleft(command.pack_command_tuple()) if op_code == Pdu2OpCodes.PL_CAMERA_OFF.value: - tc_queue.appendleft( - (QueueCommands.PRINT, "PDU2: Turn payload camera off") - ) + tc_queue.appendleft((QueueCommands.PRINT, "PDU2: Turn payload camera off")) command = pack_set_param_command( object_id, PDUConfigTable.out_en_8.parameter_address, diff --git a/pus_tc/devs/ploc_mpsoc.py b/pus_tc/devs/ploc_mpsoc.py index 8872b2a..6a360af 100644 --- a/pus_tc/devs/ploc_mpsoc.py +++ b/pus_tc/devs/ploc_mpsoc.py @@ -70,16 +70,12 @@ def pack_ploc_mpsoc_commands( ) if op_code == "0": - tc_queue.appendleft( - (QueueCommands.PRINT, "PLOC MPSoC: Set mode off") - ) + tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Set mode off")) command = pack_mode_data(object_id, Modes.OFF, 0) command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "1": - tc_queue.appendleft( - (QueueCommands.PRINT, "PLOC MPSoC: Set mode on") - ) + tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Set mode on")) command = pack_mode_data(object_id, Modes.ON, 0) command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) @@ -142,8 +138,10 @@ def pack_ploc_mpsoc_commands( command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) elif op_code == "12": - tc_queue.appendleft((QueueCommands.PRINT, "PLOC MPSoC: Reset OBSW sequence count")) - command = object_id + struct.pack('!I', CommandIds.OBSW_RESET_SEQ_COUNT) + tc_queue.appendleft( + (QueueCommands.PRINT, "PLOC MPSoC: Reset OBSW sequence count") + ) + command = object_id + struct.pack("!I", CommandIds.OBSW_RESET_SEQ_COUNT) command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) elif op_code == "13": diff --git a/pus_tc/devs/plpcdu.py b/pus_tc/devs/plpcdu.py index 2e631fa..cdf5e0a 100644 --- a/pus_tc/devs/plpcdu.py +++ b/pus_tc/devs/plpcdu.py @@ -52,14 +52,13 @@ class Info: NORMAL_HPA = f"{NORMAL}, HPA on" -class NormalSubmodes(enum.IntEnum): - ALL_OFF = 0 - SOLID_STATE_RELAYS_ADC_ON = 1 - DRO_ON = 2 - X8_ON = 3 - TX_ON = 4 - MPA_ON = 5 - HPA_ON = 6 +class NormalSubmodesMask(enum.IntEnum): + SOLID_STATE_RELAYS_ADC_ON = 0 + DRO_ON = 1 + X8_ON = 2 + TX_ON = 3 + MPA_ON = 4 + HPA_ON = 5 class ParamIds(enum.IntEnum): @@ -114,42 +113,67 @@ def pack_pl_pcdu_commands(tc_queue: TcQueueT, op_code: str): tc_queue=tc_queue, info=Info.NORMAL_SSR, mode=Modes.NORMAL, - submode=NormalSubmodes.SOLID_STATE_RELAYS_ADC_ON, + submode=(1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON), ) if op_code in OpCodes.NORMAL_DRO: pack_pl_pcdu_mode_cmd( tc_queue=tc_queue, info=Info.NORMAL_DRO, mode=Modes.NORMAL, - submode=NormalSubmodes.DRO_ON, + submode=( + 1 << NormalSubmodesMask.DRO_ON + | (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON) + ), ) if op_code in OpCodes.NORMAL_X8: pack_pl_pcdu_mode_cmd( tc_queue=tc_queue, info=Info.NORMAL_X8, mode=Modes.NORMAL, - submode=NormalSubmodes.X8_ON, + submode=( + 1 << NormalSubmodesMask.DRO_ON + | (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON) + | (1 << NormalSubmodesMask.X8_ON) + ), ) if op_code in OpCodes.NORMAL_TX: pack_pl_pcdu_mode_cmd( tc_queue=tc_queue, info=Info.NORMAL_TX, mode=Modes.NORMAL, - submode=NormalSubmodes.TX_ON, + submode=( + 1 << NormalSubmodesMask.DRO_ON + | (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON) + | (1 << NormalSubmodesMask.X8_ON) + | (1 << NormalSubmodesMask.TX_ON) + ), ) if op_code in OpCodes.NORMAL_MPA: pack_pl_pcdu_mode_cmd( tc_queue=tc_queue, info=Info.NORMAL_MPA, mode=Modes.NORMAL, - submode=NormalSubmodes.MPA_ON, + submode=( + 1 << NormalSubmodesMask.DRO_ON + | (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON) + | (1 << NormalSubmodesMask.X8_ON) + | (1 << NormalSubmodesMask.TX_ON) + | (1 << NormalSubmodesMask.MPA_ON) + ), ) if op_code in OpCodes.NORMAL_HPA: pack_pl_pcdu_mode_cmd( tc_queue=tc_queue, info=Info.NORMAL_HPA, mode=Modes.NORMAL, - submode=NormalSubmodes.HPA_ON, + submode=( + 1 << NormalSubmodesMask.DRO_ON + | (1 << NormalSubmodesMask.SOLID_STATE_RELAYS_ADC_ON) + | (1 << NormalSubmodesMask.X8_ON) + | (1 << NormalSubmodesMask.TX_ON) + | (1 << NormalSubmodesMask.MPA_ON) + | (1 << NormalSubmodesMask.MPA_ON) + ), ) if op_code in OpCodes.UPDATE_DRO_TO_X8_WAIT: pack_wait_time_cmd( diff --git a/pus_tc/devs/rad_sensor.py b/pus_tc/devs/rad_sensor.py index 4216a23..cd66930 100644 --- a/pus_tc/devs/rad_sensor.py +++ b/pus_tc/devs/rad_sensor.py @@ -49,24 +49,24 @@ def pack_rad_sensor_test_into(object_id: bytearray, tc_queue: TcQueueT, op_code: if op_code == "3": tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Start conversions")) - command = object_id + struct.pack('!I', CommandIds.START_CONVERSIONS) + command = object_id + struct.pack("!I", CommandIds.START_CONVERSIONS) command = PusTelecommand(service=8, subservice=128, ssc=43, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "4": tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Read conversions")) - command = object_id + struct.pack('!I', CommandIds.READ_CONVERSIONS) + command = object_id + struct.pack("!I", CommandIds.READ_CONVERSIONS) command = PusTelecommand(service=8, subservice=128, ssc=44, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "5": tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Enable debug output")) - command = object_id + struct.pack('!I', CommandIds.ENABLE_DEBUG_OUTPUT) + command = object_id + struct.pack("!I", CommandIds.ENABLE_DEBUG_OUTPUT) command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "6": tc_queue.appendleft((QueueCommands.PRINT, "Rad sensor: Disable debug output")) - command = object_id + struct.pack('!I', CommandIds.DISABLE_DEBUG_OUTPUT) + command = object_id + struct.pack("!I", CommandIds.DISABLE_DEBUG_OUTPUT) command = PusTelecommand(service=8, subservice=128, ssc=45, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) diff --git a/pus_tc/devs/syrlinks_hk_handler.py b/pus_tc/devs/syrlinks_hk_handler.py index 109ba79..b891e6b 100644 --- a/pus_tc/devs/syrlinks_hk_handler.py +++ b/pus_tc/devs/syrlinks_hk_handler.py @@ -43,16 +43,12 @@ def pack_syrlinks_command( ) if op_code == "0": - tc_queue.appendleft( - (QueueCommands.PRINT, "Syrlinks: Set mode off") - ) + tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set mode off")) command = pack_mode_data(object_id, Modes.OFF, 0) command = PusTelecommand(service=200, subservice=1, ssc=9, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "1": - tc_queue.appendleft( - (QueueCommands.PRINT, "Syrlinks: Set mode on") - ) + tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Set mode on")) command = pack_mode_data(object_id, Modes.ON, 0) command = PusTelecommand(service=200, subservice=1, ssc=10, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) @@ -111,23 +107,17 @@ def pack_syrlinks_command( command = PusTelecommand(service=8, subservice=128, ssc=16, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "12": - tc_queue.appendleft( - (QueueCommands.PRINT, "Syrlinks: Write LCL config") - ) - command = object_id + struct.pack('!I', CommandIds.WRITE_LCL_CONFIG) + tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Write LCL config")) + command = object_id + struct.pack("!I", CommandIds.WRITE_LCL_CONFIG) command = PusTelecommand(service=8, subservice=128, ssc=17, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "13": - tc_queue.appendleft( - (QueueCommands.PRINT, "Syrlinks: Read RX status registers") - ) - command = object_id + struct.pack('!I', CommandIds.READ_RX_STATUS_REGISTERS) + tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read RX status registers")) + command = object_id + struct.pack("!I", CommandIds.READ_RX_STATUS_REGISTERS) command = PusTelecommand(service=8, subservice=128, ssc=18, app_data=command) tc_queue.appendleft(command.pack_command_tuple()) if op_code == "14": - tc_queue.appendleft( - (QueueCommands.PRINT, "Syrlinks: Read LCL config register") - ) - command = object_id + struct.pack('!I', CommandIds.READ_LCL_CONFIG_REGISTER) + tc_queue.appendleft((QueueCommands.PRINT, "Syrlinks: Read LCL config register")) + command = object_id + struct.pack("!I", CommandIds.READ_LCL_CONFIG_REGISTER) command = PusTelecommand(service=8, subservice=128, ssc=19, app_data=command) tc_queue.appendleft(command.pack_command_tuple())