something is not right

This commit is contained in:
Robin Müller 2022-12-22 16:12:31 +01:00
parent 00991b92f1
commit 9016d3d992
4 changed files with 39 additions and 0 deletions

View File

@ -22,6 +22,7 @@ from eive_tmtc.tmtc.power.tm import (
handle_pdu_data,
handle_p60_hk_data,
handle_acu_hk_data,
handle_pcdu_hk,
)
from eive_tmtc.pus_tm.devs.syrlinks import handle_syrlinks_hk_data
from eive_tmtc.tmtc.acs.imtq import (
@ -109,6 +110,8 @@ def handle_regular_hk_print(
LOGGER.info("Service 3 TM: IMTQ handler reply with unknown set id")
elif objb == obj_ids.GPS_CONTROLLER:
return handle_gps_data(printer=printer, hk_data=hk_data)
elif objb == obj_ids.PCDU_HANDLER_ID:
return handle_pcdu_hk(printer=printer, set_id=set_id, hk_data=hk_data)
elif objb == obj_ids.BPX_HANDLER_ID:
handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, printer=printer)
elif objb == obj_ids.CORE_CONTROLLER_ID:

View File

@ -49,6 +49,7 @@ class GsInfo:
class PowerInfo:
INFO_CORE = "Core Information"
INFO_AUX = "Auxiliary Information"
SWITCHER_HK = "Switcher State Information"
INFO_ALL = "All Information"
ENABLE_INFO_HK = "Enable Core Info HK"
DISABLE_INFO_HK = "Disable Core Info HK"
@ -97,6 +98,7 @@ class PowerOpCodes:
PL_CAM_OFF = ["cam_off"]
INFO_CORE = ["info"]
SWITCHER_HK = ["switcher_states"]
ENABLE_INFO_HK = ["info_hk_on"]
DISABLE_INFO_HK = ["info_hk_off"]
INFO_AUX = ["info_aux"]

View File

@ -26,7 +26,9 @@ from eive_tmtc.tmtc.power.pdu2 import (
)
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.acu import add_acu_cmds, acu_req_hk_cmds
from tmtccmd.config.tmtc import tmtc_definitions_provider
@ -36,9 +38,18 @@ from tmtccmd.tc import DefaultPusQueueHelper
LOGGER = get_console_logger()
class PcduSetIds:
SWITCHER_SET = 0
def pack_power_commands(q: DefaultPusQueueHelper, op_code: str):
pdu1_switch_cmds(q, op_code)
pdu2_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))
)
if op_code in PowerOpCodes.INFO_CORE:
pdu1_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
pdu2_req_hk_cmds(q, PowerOpCodes.REQUEST_CORE_HK_ONCE[0])
@ -91,6 +102,7 @@ def add_power_cmd_defs(defs: TmtcDefinitionWrapper):
oce = OpCodeEntry()
add_pdu1_common_defs(oce)
add_pdu2_common_defs(oce)
oce.add(keys=PowerOpCodes.SWITCHER_HK, info=PowerInfo.SWITCHER_HK)
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)

View File

@ -7,6 +7,7 @@ from eive_tmtc.tmtc.power.common_power import (
unpack_array_in_data,
OBC_ENDIANNESS,
)
from eive_tmtc.tmtc.power.power import PcduSetIds
from tmtccmd.util import ObjectIdBase
from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
from eive_tmtc.pus_tm.defs import PrintWrapper
@ -554,3 +555,24 @@ def parse_name_list(data: bytes, name_len: int):
idx += len(name)
idx += 1
return ch_list
def handle_pcdu_hk(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
pw = PrintWrapper(printer)
pw.dlog("Received PCDU HK")
if set_id == PcduSetIds.SWITCHER_SET:
current_idx = 0
pdu1_vals = [hk_data[i] for i in range(len(PDU1_CHANNELS_NAMES))]
current_idx += len(PDU1_CHANNELS_NAMES)
pdu2_vals = [hk_data[i + current_idx] for i in range(len(PDU2_CHANNELS_NAMES))]
current_idx += len(PDU2_CHANNELS_NAMES)
p60_stack_val = hk_data[current_idx]
current_idx += 1
pw.dlog("PDU1 Switcher States")
for name, val in zip(PDU1_CHANNELS_NAMES, pdu1_vals):
pw.dlog(f"{name.ljust(25)}: {val}")
pw.dlog("PDU2 Switcher States")
for name, val in zip(PDU2_CHANNELS_NAMES, pdu2_vals):
pw.dlog(f"{name.ljust(25)}: {val}")
pw.dlog(f"{'P60 Dock 5V Stack'.ljust(25)}: {p60_stack_val}")
pw.printer.print_validity_buffer(hk_data[current_idx:], 3)