added STR temperature set

This commit is contained in:
Robin Müller 2023-03-13 10:51:55 +01:00
parent 21a3813643
commit 10362f7d30
No known key found for this signature in database
GPG Key ID: 11D4952C8CCEF814
2 changed files with 30 additions and 8 deletions

View File

@ -15,6 +15,7 @@ list yields a list of all related PRs for each release.
## Added
- Added RTD ID enum and Set ID enumeration in the RTD module.
- STR Temperature Set
## Fixed

View File

@ -687,15 +687,8 @@ def handle_str_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
pw.dlog("Received solution set")
if len(hk_data) < 78:
_LOGGER.warning(
f"Solution dataset HK data with length {len(hk_data)} too short"
)
return
def unpack_time_hk(hk_data: bytes, current_idx: int, pw: PrintWrapper) -> int:
ticks_time_fmt = "!IQ"
current_idx = 0
fmt_len = struct.calcsize(ticks_time_fmt)
(ticks, unix_time) = struct.unpack(
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
@ -704,6 +697,34 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
pw.dlog(f"UNIX as datetime: {unix_as_dt}")
current_idx += fmt_len
return current_idx
def handle_temperature_set(hk_data: bytes, pw: PrintWrapper):
pw.dlog("Received temperature set")
if len(hk_data) < 24:
_LOGGER.warning(f"Temperature dataset HK with length {len(hk_data)} too short")
current_idx = unpack_time_hk(hk_data, 0, pw)
temps_fmt = "!fff"
fmt_len = struct.calcsize(temps_fmt)
(mcu_temp, cmos_temp, fpga_temp) = struct.unpack(
temps_fmt, hk_data[current_idx : current_idx + fmt_len]
)
pw.dlog(f"MCU Temperature: {mcu_temp}")
pw.dlog(f"CMOS Temperature: {cmos_temp}")
pw.dlog(f"FPGA Temperature: {fpga_temp}")
current_idx += fmt_len
pw.printer.print_validity_buffer(hk_data[current_idx:], 5)
def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
pw.dlog("Received solution set")
if len(hk_data) < 78:
_LOGGER.warning(
f"Solution dataset HK data with length {len(hk_data)} too short"
)
return
current_idx = unpack_time_hk(hk_data, 0, pw)
calib_quaternions_fmt = "!ffff"
fmt_len = struct.calcsize(calib_quaternions_fmt)
(calib_q_w, calib_q_x, calib_q_y, calib_q_z) = struct.unpack(