added mgm hk handling

This commit is contained in:
Robin Müller 2022-05-19 14:50:24 +02:00
parent 730acf5ebe
commit ef4c0a9189
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
3 changed files with 40 additions and 3 deletions

View File

@ -1,8 +1,44 @@
import struct
from pus_tm.defs import PrintWrapper
from pus_tc.devs.mgms import MgmRm3100SetIds, MgmLis3SetIds
from tmtccmd.utility import ObjectId
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
import config.object_ids as obj_ids
def handle_mgm_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if object_id in [obj_ids.MGM_0_LIS3_HANDLER_ID, obj_ids.MGM_2_LIS3_HANDLER_ID]:
handle_mgm_lis3_hk_data(object_id, printer, set_id, hk_data)
pass
def handle_mgm_lis3_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if set_id == MgmLis3SetIds.CORE_HK:
pw = PrintWrapper(printer)
fmt_str = "!ffff"
inc_len = struct.calcsize(fmt_str)
(field_x, field_y, field_z, temp) = struct.unpack(
fmt_str, hk_data[0 : 0 + inc_len]
)
pw.dlog(f"Received MGM LIS3 from object {object_id}")
pw.dlog(f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}")
pw.dlog(f"Temperature {temp} C")
def handle_mgm_rm3100_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):
if set_id == MgmRm3100SetIds.CORE_HK:
pw = PrintWrapper(printer)
fmt_str = f"!fff"
inc_len = struct.calcsize(fmt_str)
(field_x, field_y, field_z) = struct.unpack(
fmt_str, hk_data[0 : 0 + inc_len]
)
pw.dlog(f"Received MGM LIS3 from object {object_id}")
pw.dlog(f"Field strengths in micro Tesla X {field_x} | Y {field_y} | Z {field_z}")

View File

@ -29,8 +29,6 @@ from pus_tm.tm_tcp_server import TmTcpServer
LOGGER = get_console_logger()
TM_TCP_SERVER = TmTcpServer.getInstance()
def handle_hk_packet(
raw_tm: bytes,

View File

@ -1,11 +1,14 @@
import struct
from pus_tm.defs import PrintWrapper
from pus_tm.hk_handling import TM_TCP_SERVER
from pus_tm.tm_tcp_server import TmTcpServer
from tmtccmd.utility import ObjectId
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
TM_TCP_SERVER = TmTcpServer.getInstance()
def handle_thermal_controller_hk_data(
object_id: ObjectId, printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes
):