rad sensor HK parsing
This commit is contained in:
parent
314071de1c
commit
2506d911de
@ -14,6 +14,10 @@ from spacepackets.ecss.tc import PusTelecommand
|
|||||||
from pus_tc.service_200_mode import pack_mode_data, Modes
|
from pus_tc.service_200_mode import pack_mode_data, Modes
|
||||||
|
|
||||||
|
|
||||||
|
class SetIds:
|
||||||
|
HK = 3
|
||||||
|
|
||||||
|
|
||||||
class CommandIds:
|
class CommandIds:
|
||||||
START_CONVERSIONS = 2
|
START_CONVERSIONS = 2
|
||||||
READ_CONVERSIONS = 3
|
READ_CONVERSIONS = 3
|
||||||
|
@ -1,5 +1,24 @@
|
|||||||
|
import struct
|
||||||
|
|
||||||
|
from pus_tm.defs import PrintWrapper
|
||||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
|
from pus_tc.devs.rad_sensor import SetIds
|
||||||
|
|
||||||
|
|
||||||
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_rad_sensor_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||||
pass
|
if set_id == SetIds.HK:
|
||||||
|
pw = PrintWrapper(printer)
|
||||||
|
current_idx = 0
|
||||||
|
pw.dlog("Received Radiation Sensor HK data")
|
||||||
|
fmt_str = "!fHHHHHH"
|
||||||
|
inc_len = struct.calcsize(fmt_str)
|
||||||
|
(temp, ain0, ain1, ain4, ain5, ain6, ain7) = struct.unpack(
|
||||||
|
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
||||||
|
)
|
||||||
|
ain_dict = {{0: ain0}, {1: ain1}, {4: ain4}, {5: ain5}, {6: ain6}, {7: ain7}}
|
||||||
|
pw.dlog(f"Temperature: {temp} C")
|
||||||
|
pw.dlog(f"AIN Channel | Raw Value (hex) | Raw Value (dec)")
|
||||||
|
for idx, val in ain_dict:
|
||||||
|
pw.dlog(f"{idx} | {val:#04x} | {str(val).ljust(5)}")
|
||||||
|
current_idx += inc_len
|
||||||
|
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=7)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user