clean up power module a bit

This commit is contained in:
2022-10-18 10:44:32 +02:00
parent 8655f0c9e6
commit 195d5343bc
7 changed files with 152 additions and 133 deletions

View File

@ -8,15 +8,18 @@
"""
from config.object_ids import PDU_2_HANDLER_ID
from tmtc.power.common_power import (
pack_gomspace_cmds,
pack_common_gomspace_cmds,
req_hk_cmds,
PowerOpCodes,
generic_on_cmd,
generic_off_cmd,
add_gomspace_cmd_defs,
pack_common_power_cmds,
)
from gomspace.gomspace_common import *
from gomspace.gomspace_pdu_definitions import *
from tmtccmd.config import OpCodeEntry
from tmtccmd.config import OpCodeEntry, TmtcDefinitionWrapper
from tmtccmd.config.tmtc import tmtc_definitions_provider
class Pdu2InfoBase:
@ -74,7 +77,8 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
objb = object_id.as_bytes
pdu2_cmds(q, op_code)
pdu2_req_hk_cmds(q, op_code)
pack_gomspace_cmds("PDU2", object_id, q, op_code)
pack_common_power_cmds("PDU2", object_id, q, op_code)
pack_common_gomspace_cmds("PDU2", object_id, q, op_code)
if PDU2TestProcedure.all or PDU2TestProcedure.reboot:
q.add_log_cmd("PDU2: Reboot")
q.add_pus_tc(pack_reboot_command(object_id))
@ -130,6 +134,26 @@ def pack_pdu2_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
q.add_pus_tc(pack_request_full_hk_table_command(object_id))
@tmtc_definitions_provider
def add_pdu2_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
add_pdu2_common_defs(oce)
add_gomspace_cmd_defs(oce)
oce.add(
keys=PowerOpCodes.PRINT_SWITCH_V_I,
info="PDU2: Print Switches, Voltages, Currents",
)
oce.add(
keys=PowerOpCodes.PRINT_LATCHUPS,
info="PDU2: Print Latchups",
)
defs.add_service(
name="pdu2",
info="PDU2 Device",
op_code_entry=oce,
)
def pdu2_cmds(q: DefaultPusQueueHelper, op_code: str):
if op_code in PowerOpCodes.PL_PCDU_VBAT_NOM_ON:
pl_pcdu_bat_nom_on_cmd(q)