SUS HK Parsing #92
@ -6,16 +6,21 @@ from tmtccmd.utility import ObjectId
|
|||||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
|
||||||
|
|
||||||
def handle_sus_hk(object_id: ObjectId, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int):
|
def handle_sus_hk(
|
||||||
|
object_id: ObjectId, hk_data: bytes, printer: FsfwTmTcPrinter, set_id: int
|
||||||
|
):
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer)
|
||||||
pw.dlog(f"Received SUS HK data from {object_id}")
|
pw.dlog(f"Received SUS HK data from {object_id}")
|
||||||
if set_id == SetIds.HK:
|
if set_id == SetIds.HK:
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
temperature = struct.unpack('!f', hk_data[current_idx : current_idx + 4])[0]
|
temperature = struct.unpack("!f", hk_data[current_idx : current_idx + 4])[0]
|
||||||
current_idx += 4
|
current_idx += 4
|
||||||
channels = []
|
channels = []
|
||||||
for _ in range(6):
|
for _ in range(6):
|
||||||
channels.append(struct.unpack('!H', hk_data[current_idx : current_idx + 2]))
|
channels.append(struct.unpack("!H", hk_data[current_idx : current_idx + 2]))
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
|
pw.dlog(f"Temperature: {temperature} C")
|
||||||
|
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||||
|
for idx, val in enumerate(channels):
|
||||||
|
pw.dlog(f"{idx} | {val:#06x} | {str(val).ljust(5)}")
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
import struct
|
import struct
|
||||||
|
|
||||||
from pus_tm.devs.rad_sensor import handle_rad_sensor_data
|
from pus_tm.devs.rad_sensor import handle_rad_sensor_data
|
||||||
|
from pus_tm.devs.sus import handle_sus_hk
|
||||||
from pus_tm.system.tcs import handle_thermal_controller_hk_data, TM_TCP_SERVER
|
from pus_tm.system.tcs import handle_thermal_controller_hk_data, TM_TCP_SERVER
|
||||||
from tmtccmd.config.definitions import HkReplyUnpacked
|
from tmtccmd.config.definitions import HkReplyUnpacked
|
||||||
from tmtccmd.tm.pus_3_fsfw_hk import (
|
from tmtccmd.tm.pus_3_fsfw_hk import (
|
||||||
@ -117,6 +118,23 @@ def handle_regular_hk_print(
|
|||||||
return handle_rw_hk_data(
|
return handle_rw_hk_data(
|
||||||
printer=printer, object_id=object_id, set_id=set_id, hk_data=hk_data
|
printer=printer, object_id=object_id, set_id=set_id, hk_data=hk_data
|
||||||
)
|
)
|
||||||
|
if objb in [
|
||||||
|
obj_ids.SUS_0_N_LOC_XFYFZM_PT_XF,
|
||||||
|
obj_ids.SUS_1_N_LOC_XBYFZM_PT_XB,
|
||||||
|
obj_ids.SUS_2_N_LOC_XFYBZB_PT_YB,
|
||||||
|
obj_ids.SUS_3_N_LOC_XFYBZF_PT_YF,
|
||||||
|
obj_ids.SUS_4_N_LOC_XMYFZF_PT_ZF,
|
||||||
|
obj_ids.SUS_5_N_LOC_XFYMZB_PT_ZB,
|
||||||
|
obj_ids.SUS_6_R_LOC_XFYBZM_PT_XF,
|
||||||
|
obj_ids.SUS_7_R_LOC_XBYBZM_PT_XB,
|
||||||
|
obj_ids.SUS_8_R_LOC_XBYBZB_PT_YB,
|
||||||
|
obj_ids.SUS_9_R_LOC_XBYBZB_PT_YF,
|
||||||
|
obj_ids.SUS_10_R_LOC_XMYBZF_PT_ZF,
|
||||||
|
obj_ids.SUS_11_R_LOC_XBYMZB_PT_ZB,
|
||||||
|
]:
|
||||||
|
handle_sus_hk(
|
||||||
|
object_id=object_id, hk_data=hk_data, printer=printer, set_id=set_id
|
||||||
|
)
|
||||||
if objb == obj_ids.P60_DOCK_HANDLER:
|
if objb == obj_ids.P60_DOCK_HANDLER:
|
||||||
handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
handle_p60_hk_data(printer=printer, set_id=set_id, hk_data=hk_data)
|
||||||
if objb in [
|
if objb in [
|
||||||
@ -145,4 +163,3 @@ def handle_regular_hk_print(
|
|||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
|
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
|
||||||
return HkReplyUnpacked()
|
|
||||||
|
Loading…
Reference in New Issue
Block a user