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

@ -3,18 +3,25 @@
@author J. Meier
@date 17.12.2020
"""
from config.definitions import CustomServiceList
from config.object_ids import PDU_1_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,
GomspaceOpCodes,
GsInfo,
PowerInfo,
)
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 Pdu1InfoBase:
@ -61,7 +68,8 @@ def pack_pdu1_commands(object_id: ObjectIdU32, q: DefaultPusQueueHelper, op_code
objb = object_id.as_bytes
pdu1_cmds(q, op_code)
pdu1_req_hk_cmds(q, op_code)
pack_gomspace_cmds("PDU1", object_id, q, op_code)
pack_common_power_cmds("PDU1", object_id, q, op_code)
pack_common_gomspace_cmds("PDU1", object_id, q, op_code)
if PDU1TestProcedure.all or PDU1TestProcedure.ping:
q.add_log_cmd("PDU1: Ping Test")
ping_data = bytearray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9])
@ -146,6 +154,26 @@ def add_pdu1_common_defs(oce: OpCodeEntry):
oce.add(keys=PowerOpCodes.SCEX_OFF, info=info_off_pdu1(Pdu1InfoBase.SCEX))
@tmtc_definitions_provider
def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
add_pdu1_common_defs(oce)
add_gomspace_cmd_defs(oce)
oce.add(keys=PowerOpCodes.REQUEST_CORE_HK_ONCE, info=PowerInfo.REQUEST_CORE_HK_ONCE)
oce.add(keys=PowerOpCodes.REQUEST_AUX_HK_ONCE, info=PowerInfo.REQUEST_AUX_HK_ONCE)
oce.add(
keys=PowerOpCodes.PRINT_SWITCH_V_I,
info="PDU1: Print Switches, Voltages, Currents",
)
oce.add(keys=GomspaceOpCodes.GET_PARAM, info=GsInfo.GET_PARAMETER)
defs.add_service(
name=CustomServiceList.PDU1.value,
info="PDU1 Device",
op_code_entry=oce,
)
def tcs_on_cmd(q: DefaultPusQueueHelper):
generic_on_cmd(PDU_1_HANDLER_ID, q, Pdu1InfoBase.TCS, Pdu1ChIndex.TCS)