Merge remote-tracking branch 'origin/main' into mueller_new_switcher_hk

This commit is contained in:
2023-02-14 16:10:55 +01:00
94 changed files with 3828 additions and 2542 deletions

View File

@ -1,3 +1,6 @@
import enum
import logging
from eive_tmtc.tmtc.power.common_power import (
PowerOpCodes,
PowerInfo,
@ -21,21 +24,25 @@ from eive_tmtc.tmtc.power.pdu1 import (
from eive_tmtc.tmtc.power.pdu2 import (
pdu2_req_hk_cmds,
add_pdu2_common_defs,
pdu2_cmds,
pdu2_switch_cmds,
add_pdu2_cmds,
)
from tmtccmd import get_console_logger
from tmtccmd.config import TmtcDefinitionWrapper, OpCodeEntry
from eive_tmtc.config.object_ids import PCDU_HANDLER_ID
from tmtccmd.tc.pus_3_fsfw_hk import generate_one_hk_command, make_sid
from eive_tmtc.tmtc.power.p60dock import P60OpCodes, P60Info, p60_dock_req_hk_cmds
from eive_tmtc.tmtc.power.p60dock import P60OpCode, P60Info, p60_dock_req_hk_cmds
from eive_tmtc.tmtc.power.acu import add_acu_cmds, acu_req_hk_cmds
from tmtccmd.tc.pus_3_fsfw_hk import (
create_request_one_diag_command,
make_sid,
create_request_one_hk_command,
)
from tmtccmd.config.tmtc import tmtc_definitions_provider
from tmtccmd.tc import DefaultPusQueueHelper
LOGGER = get_console_logger()
class SetId(enum.IntEnum):
SWITCHER_SET = 0
class PcduSetIds:
@ -44,11 +51,13 @@ class PcduSetIds:
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pdu1_switch_cmds(q, op_code)
pdu2_cmds(q, op_code)
pdu2_switch_cmds(q, op_code)
if op_code in PowerOpCodes.SWITCHER_HK:
q.add_log_cmd("Requesting switcher state HK")
q.add_pus_tc(
generate_one_hk_command(make_sid(PCDU_HANDLER_ID, PcduSetIds.SWITCHER_SET))
create_request_one_hk_command(
make_sid(PCDU_HANDLER_ID, PcduSetIds.SWITCHER_SET)
)
)
if op_code in PowerOpCodes.INFO_CORE:
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
@ -79,19 +88,28 @@ def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pack_reset_gnd_wdt_cmd(q, "PDU1", oids[PDU_1_HANDLER_ID])
pack_reset_gnd_wdt_cmd(q, "PDU2", oids[PDU_2_HANDLER_ID])
q.add_wait_seconds(5.0)
elif op_code in PowerOpCodes.SWITCHER_HK:
q.add_log_cmd("PCDU: Requesting Switcher Set")
q.add_pus_tc(
create_request_one_diag_command(
make_sid(PCDU_HANDLER_ID, SetId.SWITCHER_SET)
)
)
if q.empty():
LOGGER.info(f"Queue is empty, no stack for op code {op_code}")
logging.getLogger(__name__).info(
f"Queue is empty, no stack for op code {op_code}"
)
@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=P60OpCode.STACK_3V3_ON, info=P60Info.STACK_3V3_ON)
oce.add(keys=P60OpCode.STACK_3V3_OFF, info=P60Info.STACK_3V3_OFF)
oce.add(keys=P60OpCode.STACK_5V_ON, info=P60Info.STACK_5V_ON)
oce.add(keys=P60OpCode.STACK_5V_OFF, info=P60Info.STACK_5V_OFF)
add_gomspace_cmd_defs(oce)
oce.add(keys=P60OpCodes.TEST, info="P60 Tests")
oce.add(keys=P60OpCode.TEST, info="P60 Tests")
defs.add_service(
name=CustomServiceList.P60DOCK.value, info="P60 Device", op_code_entry=oce
)