add pdu HK handler

This commit is contained in:
Robin Mueller 2022-04-12 15:36:04 +02:00
parent a6c91640a1
commit a966471fe5
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814

View File

@ -16,16 +16,8 @@ from pus_tc.devs.syrlinks_hk_handler import SetIds
from pus_tc.devs.p60dock import SetIds
from pus_tc.devs.imtq import ImtqSetIds
from tmtccmd.pus.obj_id import ObjectId, ObjectIdDictT
from config.object_ids import (
SYRLINKS_HANDLER_ID,
IMTQ_HANDLER_ID,
GPS_HANDLER_0_ID,
GPS_HANDLER_1_ID,
BPX_HANDLER_ID,
CORE_CONTROLLER_ID,
P60_DOCK_HANDLER,
PL_PCDU_ID,
)
import config.object_ids as obj_ids
LOGGER = get_console_logger()
@ -66,29 +58,33 @@ def handle_regular_hk_print(
object_id = object_id.as_bytes
set_id = hk_packet.set_id
"""This function is called when a Service 3 Housekeeping packet is received."""
if object_id == SYRLINKS_HANDLER_ID:
if object_id == obj_ids.SYRLINKS_HANDLER_ID:
if set_id == SetIds.RX_REGISTERS_DATASET:
return handle_syrlinks_rx_registers_dataset(printer, hk_data)
elif set_id == SetIds.TX_REGISTERS_DATASET:
return handle_syrlinks_tx_registers_dataset(printer, hk_data)
else:
LOGGER.info("Service 3 TM: Syrlinks handler reply with unknown set id")
elif object_id == IMTQ_HANDLER_ID:
elif object_id == obj_ids.IMTQ_HANDLER_ID:
if (set_id >= ImtqSetIds.POSITIVE_X_TEST) and (
set_id <= ImtqSetIds.NEGATIVE_Z_TEST
):
return handle_self_test_data(printer, hk_data)
else:
LOGGER.info("Service 3 TM: Syrlinks handler reply with unknown set id")
elif object_id == GPS_HANDLER_0_ID or object_id == GPS_HANDLER_1_ID:
elif object_id == obj_ids.GPS_HANDLER_0_ID or object_id == obj_ids.GPS_HANDLER_1_ID:
handle_gps_data(printer=printer, hk_data=hk_data)
elif object_id == BPX_HANDLER_ID:
elif object_id == obj_ids.BPX_HANDLER_ID:
handle_bpx_hk_data(hk_data=hk_data, set_id=set_id, printer=printer)
elif object_id == CORE_CONTROLLER_ID:
elif object_id == obj_ids.CORE_CONTROLLER_ID:
return handle_core_hk_data(printer=printer, hk_data=hk_data)
elif object_id == P60_DOCK_HANDLER:
elif object_id == obj_ids.PDU_1_HANDLER_ID:
return handle_pdu_data(printer=printer, pdu_idx=1, hk_data=hk_data)
elif object_id == obj_ids.PDU_2_HANDLER_ID:
return handle_pdu_data(printer=printer, pdu_idx=2, hk_data=hk_data)
elif object_id == obj_ids.P60_DOCK_HANDLER:
handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
elif object_id == PL_PCDU_ID:
elif object_id == obj_ids.PL_PCDU_ID:
log_to_both(printer, "Received PL PCDU HK data")
else:
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
@ -430,6 +426,10 @@ P60_INDEX_LIST = [
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
def handle_pdu_data(printer: FsfwTmTcPrinter, pdu_idx: int, hk_data: bytes):
log_to_both(printer, f"Received PDU HK from PDU {pdu_idx}")
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
if set_id == SetIds.P60_CORE:
log_to_both(printer, "Received P60 Core HK. Voltages in mV, currents in mA")