starting changing code to new API
This commit is contained in:
@ -7,6 +7,8 @@
|
||||
"""
|
||||
from tmtccmd.config.definitions import QueueCommands
|
||||
from tmtccmd.tc.packer import TcQueueT
|
||||
|
||||
from tmtccmd.tc import QueueHelper
|
||||
from tmtccmd.tc.pus_3_fsfw_hk import (
|
||||
generate_one_hk_command,
|
||||
make_sid,
|
||||
@ -87,240 +89,193 @@ class P60DockHkTable:
|
||||
wdt_gnd_left = TableEntry(bytearray([0x00, 0xA8]), TableEntry.uint32_size)
|
||||
|
||||
|
||||
def pack_p60dock_cmds(object_id: ObjectId, tc_queue: TcQueueT, op_code: str):
|
||||
def pack_p60dock_cmds(object_id: ObjectId, q: QueueHelper, op_code: str):
|
||||
objb = object_id.as_bytes
|
||||
if op_code in P60OpCodes.STACK_3V3_ON:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_3V3_ON))
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.on,
|
||||
q.add_log_cmd(Info.STACK_3V3_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code in P60OpCodes.STACK_3V3_OFF:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_3V3_OFF))
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.off,
|
||||
q.add_log_cmd(Info.STACK_3V3_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_9.parameter_address,
|
||||
P60DockConfigTable.out_en_9.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code in P60OpCodes.STACK_5V_ON:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_5V_ON))
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.on,
|
||||
q.add_log_cmd(Info.STACK_5V_ON)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.on,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code in P60OpCodes.STACK_5V_OFF:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, Info.STACK_5V_OFF))
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.off,
|
||||
q.add_log_cmd(Info.STACK_5V_OFF)
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_10.parameter_address,
|
||||
P60DockConfigTable.out_en_10.parameter_size,
|
||||
Channel.off,
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Requesting HK Core HK Once")
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Requesting HK Core HK Once")
|
||||
hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_CORE)
|
||||
command = generate_one_hk_command(sid=hk_sid, ssc=0)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
|
||||
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Requesting HK Aux HK Once")
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Requesting HK Aux HK Once")
|
||||
hk_sid = make_sid(object_id=P60_DOCK_HANDLER, set_id=SetIds.P60_AUX)
|
||||
command = generate_one_hk_command(sid=hk_sid, ssc=0)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
|
||||
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Print Switches, Voltages, Currents")
|
||||
q.add_log_cmd("P60 Dock: Print Switches, Voltages, Currents")
|
||||
q.add_pus_tc(
|
||||
generate_action_command(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
)
|
||||
)
|
||||
command = generate_action_command(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_SWITCH_V_I
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if op_code in GomspaceOpCodes.PRINT_LATCHUPS:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Print Latchups"))
|
||||
command = generate_action_command(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
|
||||
q.add_log_cmd("P60 Dock: Print Latchups")
|
||||
q.add_pus_tc(
|
||||
generate_action_command(
|
||||
object_id=objb, action_id=GomspaceDeviceActionIds.PRINT_LATCHUPS
|
||||
)
|
||||
)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.reboot:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Reboot"))
|
||||
command = pack_reboot_command(object_id)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_log_cmd("P60 Dock: Reboot")
|
||||
q.add_pus_tc(pack_reboot_command(object_id))
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_gnd_wdt:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Reading ground watchdog timer value")
|
||||
q.add_log_cmd("P60 Dock: Reading ground watchdog timer value")
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_address,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_address,
|
||||
P60DockHkTable.wdt_gnd_left.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=20, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.gnd_wdt_reset:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing ground watchdog reset")
|
||||
)
|
||||
command = pack_gnd_wdt_reset_command(object_id)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=21, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_log_cmd("P60 Dock: Testing ground watchdog reset")
|
||||
q.add_pus_tc(pack_gnd_wdt_reset_command(object_id))
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.ping:
|
||||
tc_queue.appendleft((QueueCommands.PRINT, "P60 Dock: Ping"))
|
||||
q.add_log_cmd("P60 Dock: Ping")
|
||||
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
|
||||
command = pack_ping_command(object_id, ping_data)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=22, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
q.add_pus_tc(pack_ping_command(object_id, ping_data))
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_off:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 off")
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Testing setting output channel 3 off")
|
||||
parameter = 0 # set channel off
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
)
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=23, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_temperature1:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing temperature reading")
|
||||
q.add_log_cmd("P60 Dock: Testing temperature reading")
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=24, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing Output Channel 3 state (PDU2)")
|
||||
q.add_log_cmd("P60 Dock: Testing Output Channel 3 state (PDU2)")
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
)
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=25, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.read_cur_lu_lim_0:
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Reading current limit value of output channel 0",
|
||||
q.add_log_cmd("P60 Dock: Reading current limit value of output channel 0")
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_address,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
)
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
TableIds.config,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_address,
|
||||
P60DockConfigTable.cur_lu_lim_0.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=26, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.channel_3_on:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing setting output channel 3 on")
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Testing setting output channel 3 on")
|
||||
parameter = 1 # set channel on
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
P60DockConfigTable.out_en_3.parameter_size,
|
||||
parameter,
|
||||
)
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=27, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_table_id_test:
|
||||
tc_queue.appendleft(
|
||||
(QueueCommands.PRINT, "P60 Dock: Testing invalid table id handling")
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Testing invalid table id handling")
|
||||
table_id_invalid = 5
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
table_id_invalid,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
table_id_invalid,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=28, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_address_test:
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing invalid address handling in get param command",
|
||||
)
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Testing invalid address handling in get param command")
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
invalid_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=29, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing invalid address handling in set param command",
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
invalid_address,
|
||||
P60DockHkTable.temperature1.parameter_size,
|
||||
)
|
||||
)
|
||||
q.add_log_cmd("P60 Dock: Testing invalid address handling in set param command")
|
||||
invalid_address = bytearray([0x01, 0xF4])
|
||||
parameter_size = 2
|
||||
parameter = 1
|
||||
command = pack_set_param_command(
|
||||
objb, invalid_address, parameter_size, parameter
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(objb, invalid_address, parameter_size, parameter)
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=30, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
if P60DockTestProcedure.all or P60DockTestProcedure.invalid_parameter_size_test:
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing handling of invalid parameter sizes in get-param command",
|
||||
)
|
||||
q.add_log_cmd(
|
||||
"P60 Dock: Testing handling of invalid parameter sizes in get-param command"
|
||||
)
|
||||
invalid_size = 5
|
||||
command = pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
invalid_size,
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=31, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
tc_queue.appendleft(
|
||||
(
|
||||
QueueCommands.PRINT,
|
||||
"P60 Dock: Testing handling of invalid parameter size in set-param command",
|
||||
q.add_pus_tc(
|
||||
pack_get_param_command(
|
||||
objb,
|
||||
TableIds.hk,
|
||||
P60DockHkTable.temperature1.parameter_address,
|
||||
invalid_size,
|
||||
)
|
||||
)
|
||||
parameter = 1
|
||||
command = pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
invalid_size,
|
||||
parameter,
|
||||
q.add_log_cmd(
|
||||
"P60 Dock: Testing handling of invalid parameter size in set-param command"
|
||||
)
|
||||
parameter = 1
|
||||
q.add_pus_tc(
|
||||
pack_set_param_command(
|
||||
objb,
|
||||
P60DockConfigTable.out_en_3.parameter_address,
|
||||
invalid_size,
|
||||
parameter,
|
||||
)
|
||||
)
|
||||
# command = PusTelecommand(service=8, subservice=128, ssc=32, app_data=command)
|
||||
tc_queue.appendleft(command.pack_command_tuple())
|
||||
|
||||
return tc_queue
|
||||
|
Reference in New Issue
Block a user