Merge branch 'main' into zink_startracker
This commit is contained in:
commit
de0ecb44e4
@ -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
|
||||
|
||||
|
@ -683,10 +683,42 @@ def handle_str_hk_data(set_id: int, hk_data: bytes, printer: FsfwTmTcPrinter):
|
||||
pw.dlog(f"Received STR HK set with set ID {set_id}")
|
||||
if set_id == SetId.SOLUTION:
|
||||
handle_solution_set(hk_data, pw)
|
||||
elif set_id == SetId.TEMPERATURE:
|
||||
handle_temperature_set(hk_data, pw)
|
||||
else:
|
||||
_LOGGER.warning(f"HK parsing for Star Tracker set ID {set_id} unimplemented")
|
||||
|
||||
|
||||
def unpack_time_hk(hk_data: bytes, current_idx: int, pw: PrintWrapper) -> int:
|
||||
ticks_time_fmt = "!IQ"
|
||||
fmt_len = struct.calcsize(ticks_time_fmt)
|
||||
(ticks, unix_time) = struct.unpack(
|
||||
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
|
||||
)
|
||||
unix_as_dt = datetime.datetime.fromtimestamp(unix_time, tz=datetime.timezone.utc)
|
||||
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:
|
||||
@ -694,16 +726,7 @@ def handle_solution_set(hk_data: bytes, pw: PrintWrapper):
|
||||
f"Solution dataset HK data with length {len(hk_data)} too short"
|
||||
)
|
||||
return
|
||||
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]
|
||||
)
|
||||
unix_as_dt = datetime.datetime.fromtimestamp(unix_time, tz=datetime.timezone.utc)
|
||||
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
|
||||
pw.dlog(f"UNIX as datetime: {unix_as_dt}")
|
||||
current_idx += fmt_len
|
||||
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(
|
||||
|
Loading…
Reference in New Issue
Block a user