a lot of improvements

This commit is contained in:
2022-08-11 18:10:15 +02:00
parent dc07dd8c6d
commit 8b275bdca8
14 changed files with 446 additions and 505 deletions

View File

@ -4,7 +4,7 @@
@date 17.12.2020
"""
import gomspace.gomspace_common as gs
from pus_tc.devs.common_power import tcs_on_cmd, tcs_off_cmd
from pus_tc.devs.common_power import pdu1_cmds, pdu1_req_hk_cmds
from tmtccmd.tc import DefaultPusQueueHelper
from tmtccmd.tc.pus_3_fsfw_hk import (
@ -17,28 +17,6 @@ from gomspace.gomspace_pdu_definitions import *
from config.object_ids import PDU_1_HANDLER_ID
class Pdu1OpCodes:
TCS_BOARD_ON = ["tcs-on", "0"]
TCS_BOARD_OFF = ["tcs-off", "1"]
STAR_TRACKER_ON = ["str-on", "2"]
STAR_TRACKER_OFF = ["str-off", "3"]
SUS_NOMINAL_ON = ["sus-nom-on", "4"]
SUS_NOMINAL_OFF = ["sum-nom-off", "5"]
ACS_A_SIDE_ON = ["acs-a-on", "6"]
ACS_A_SIDE_OFF = ["acs-a-off", "7"]
SYRLINKS_ON = ["syrlinks-on", "8"]
SYRLINKS_OFF = ["syrlinks-off", "9"]
MGT_ON = ["mgt-on", "10"]
MGT_OFF = ["mgt-off", "11"]
# Solar Cell Experiment
SCEX_ON = ["scex-on", "12"]
SCEX_OFF = ["scex-off", "13"]
PLOC_ON = ["ploc-on", "14"]
PLOC_OFF = ["ploc-off", "15"]
TESTS = "32"
class PDU1TestProcedure:
"""
@brief Use this class to define the tests to perform for the PDU2.
@ -59,168 +37,8 @@ class PDU1TestProcedure:
def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code: str):
q.add_log_cmd("Commanding PDU1")
objb = object_id.as_bytes
if op_code in Pdu1OpCodes.TCS_BOARD_ON:
tcs_on_cmd(object_id, q)
if op_code in Pdu1OpCodes.TCS_BOARD_OFF:
tcs_off_cmd(object_id, q)
if op_code in Pdu1OpCodes.STAR_TRACKER_ON:
q.add_log_cmd("PDU1: Turn star tracker on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_2.parameter_address,
PduConfigTable.out_en_2.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.STAR_TRACKER_OFF:
q.add_log_cmd("PDU1: Turn star tracker off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_2.parameter_address,
PduConfigTable.out_en_2.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.SUS_NOMINAL_ON:
q.add_log_cmd("PDU1: Turn SUS nominal on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_4.parameter_address,
PduConfigTable.out_en_4.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.SUS_NOMINAL_OFF:
q.add_log_cmd("PDU1: Turn SUS nominal off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_4.parameter_address,
PduConfigTable.out_en_4.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.ACS_A_SIDE_ON:
q.add_log_cmd("PDU1: Turn ACS Side A on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_7.parameter_address,
PduConfigTable.out_en_7.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.ACS_A_SIDE_OFF:
q.add_log_cmd("PDU1: Turn ACS Side A off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_7.parameter_address,
PduConfigTable.out_en_7.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.SUS_NOMINAL_OFF:
q.add_log_cmd("PDU1: Turn SUS nominal off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_4.parameter_address,
PduConfigTable.out_en_4.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.SCEX_ON:
q.add_log_cmd("PDU1: Turn Solar Cell Experiment on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_5.parameter_address,
PduConfigTable.out_en_5.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.SCEX_OFF:
q.add_log_cmd("PDU1: Turn Solar Cell Experiment off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_5.parameter_address,
PduConfigTable.out_en_5.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.SYRLINKS_ON:
q.add_log_cmd("PDU1: Turn Syrlinks on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_1.parameter_address,
PduConfigTable.out_en_1.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.SYRLINKS_OFF:
q.add_log_cmd("PDU1: Turn Syrlinks off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_1.parameter_address,
PduConfigTable.out_en_1.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.MGT_ON:
q.add_log_cmd("PDU1: Turn MGT on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_3.parameter_address,
PduConfigTable.out_en_3.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.MGT_OFF:
q.add_log_cmd("PDU1: Turn MGT off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_3.parameter_address,
PduConfigTable.out_en_3.parameter_size,
Channel.off,
)
)
if op_code in Pdu1OpCodes.PLOC_ON:
q.add_log_cmd("PDU1: Turn PLOC on")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_6.parameter_address,
PduConfigTable.out_en_6.parameter_size,
Channel.on,
)
)
if op_code in Pdu1OpCodes.PLOC_OFF:
q.add_log_cmd("PDU1: Turn PLOC off")
q.add_pus_tc(
pack_set_param_command(
objb,
PduConfigTable.out_en_6.parameter_address,
PduConfigTable.out_en_6.parameter_size,
Channel.off,
)
)
if op_code in GomspaceOpCodes.REQUEST_CORE_HK_ONCE:
q.add_log_cmd(f"PDU1: {Info.REQUEST_CORE_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_CORE)
q.add_pus_tc(generate_one_diag_command(sid=hk_sid))
if op_code in GomspaceOpCodes.REQUEST_AUX_HK_ONCE:
q.add_log_cmd(f"PDU1: {Info.REQUEST_AUX_HK_ONCE}")
hk_sid = make_sid(object_id=PDU_1_HANDLER_ID, set_id=SetIds.PDU_1_AUX)
q.add_pus_tc(generate_one_hk_command(sid=hk_sid))
pdu1_cmds(q, op_code)
pdu1_req_hk_cmds(q, op_code)
if op_code in GomspaceOpCodes.PRINT_SWITCH_V_I:
q.add_log_cmd("PDU1: Print Switches, Voltages, Currents")
q.add_pus_tc(
@ -290,7 +108,7 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
)
)
if op_code in GomspaceOpCodes.SET_PARAM:
q.add_log_cmd(f"PDU1: {Info.SET_PARAMETER}")
q.add_log_cmd(f"PDU1: {GsInfo.SET_PARAMETER}")
memory_address = int(input("Specify memory address: 0x"), 16)
memory_address = struct.pack("!H", memory_address)
parameter_size = int(input("Specify parameter size: "))