eive-tmtc/pus_tc/devs/power.py

104 lines
3.3 KiB
Python

from gomspace.gomspace_common import GsInfo
from pus_tc.devs.common_power import (
PowerOpCodes,
Pdu1InfoBase,
Pdu2InfoBase,
add_pdu1_common_defs,
add_pdu2_common_defs,
PowerInfo,
)
from config.definitions import CustomServiceList
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from pus_tc.devs.p60dock import P60OpCodes, GomspaceOpCodes, P60Info
from pus_tc.devs.acu import add_acu_cmds
from tmtccmd.config.tmtc import tmtc_definitions_provider
@tmtc_definitions_provider
def add_p60_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
oce.add(keys=P60OpCodes.STACK_3V3_ON, info=P60Info.STACK_3V3_ON)
oce.add(keys=P60OpCodes.STACK_3V3_OFF, info=P60Info.STACK_3V3_OFF)
oce.add(keys=P60OpCodes.STACK_5V_ON, info=P60Info.STACK_5V_ON)
oce.add(keys=P60OpCodes.STACK_5V_OFF, info=P60Info.STACK_5V_OFF)
oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE)
oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE)
oce.add(
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="P60 Dock: Print Switches, Voltages, Currents",
)
oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="P60 Dock: Print Latchups")
oce.add(keys=P60OpCodes.TEST, info="P60 Tests")
defs.add_service(
name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce
)
@tmtc_definitions_provider
def add_power_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
add_pdu1_common_defs(oce)
add_pdu2_common_defs(oce)
oce.add(keys=PowerOpCodes.INFO_ALL, info=PowerInfo.INFO_ALL)
oce.add(keys=PowerOpCodes.INFO_CORE, info=PowerInfo.INFO_CORE)
oce.add(keys=PowerOpCodes.INFO_AUX, info=PowerInfo.INFO_AUX)
defs.add_service(
name=CustomServiceList.POWER.value,
info="Power Subsystem",
op_code_entry=oce,
)
@tmtc_definitions_provider
def add_pdu1_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
add_pdu1_common_defs(oce)
oce.add(keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE, info=GsInfo.REQUEST_CORE_HK_ONCE)
oce.add(keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE, info=GsInfo.REQUEST_AUX_HK_ONCE)
oce.add(
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU1: Print Switches, Voltages, Currents",
)
oce.add(keys=GomspaceOpCodes.PRINT_LATCHUPS, info="PDU1: Print Latchups")
oce.add(keys=GomspaceOpCodes.SET_PARAM, info="Set parameter")
defs.add_service(
name=CustomServiceList.PDU1.value,
info="PDU1 Device",
op_code_entry=oce,
)
@tmtc_definitions_provider
def add_pdu2_cmds(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
add_pdu2_common_defs(oce)
oce.add(
keys=GomspaceOpCodes.REQUEST_CORE_HK_ONCE,
info=GsInfo.REQUEST_CORE_HK_ONCE,
)
oce.add(
keys=GomspaceOpCodes.REQUEST_AUX_HK_ONCE,
info=GsInfo.REQUEST_AUX_HK_ONCE,
)
oce.add(
keys=GomspaceOpCodes.PRINT_SWITCH_V_I,
info="PDU2: Print Switches, Voltages, Currents",
)
oce.add(
keys=GomspaceOpCodes.PRINT_LATCHUPS,
info="PDU2: Print Latchups",
)
defs.add_service(
name="pdu2",
info="PDU2 Device",
op_code_entry=oce,
)
def add_pcdu_cmds(defs: TmtcDefinitionWrapper):
add_p60_cmds(defs)
add_pdu1_cmds(defs)
add_pdu2_cmds(defs)
add_acu_cmds(defs)