improve TM output
All checks were successful
EIVE/-/pipeline/pr-main This commit looks good

This commit is contained in:
Robin Müller 2023-10-26 20:45:14 +02:00
parent c4598ff058
commit 97b529318d
Signed by: muellerr
GPG Key ID: A649FB78196E3849
2 changed files with 17 additions and 10 deletions

View File

@ -2,7 +2,7 @@
""" """
import logging import logging
from eive_tmtc.config.object_ids import get_object_ids, STAR_TRACKER_ID from eive_tmtc.config.object_ids import get_object_ids
from spacepackets.ecss import PusTelemetry from spacepackets.ecss import PusTelemetry
from spacepackets.ecss.pus_17_test import Service17Tm from spacepackets.ecss.pus_17_test import Service17Tm
from spacepackets.util import PrintFormats from spacepackets.util import PrintFormats
@ -14,7 +14,6 @@ from tmtccmd.tm.pus_20_fsfw_param import Service20ParamDumpWrapper
from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice from tmtccmd.pus.s20_fsfw_param_defs import CustomSubservice as ParamSubservice
from tmtccmd.tm.pus_200_fsfw_mode import Subservice as ModeSubservice from tmtccmd.tm.pus_200_fsfw_mode import Subservice as ModeSubservice
from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter from tmtccmd.fsfw.tmtc_printer import FsfwTmTcPrinter
from tmtccmd.util import ObjectIdU32
from .defs import PrintWrapper from .defs import PrintWrapper
from .event_handler import handle_event_packet from .event_handler import handle_event_packet

View File

@ -834,11 +834,14 @@ def unpack_time_hk(hk_data: bytes, current_idx: int, pw: PrintWrapper) -> int:
(ticks, unix_time) = struct.unpack( (ticks, unix_time) = struct.unpack(
ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len] ticks_time_fmt, hk_data[current_idx : current_idx + fmt_len]
) )
try:
unix_as_dt = datetime.datetime.fromtimestamp( unix_as_dt = datetime.datetime.fromtimestamp(
int(round(unix_time / 1e6)), tz=datetime.timezone.utc int(round(unix_time / 1e6)), tz=datetime.timezone.utc
) )
pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}") pw.dlog(f"Ticks: {ticks} | UNIX time: {unix_time}")
pw.dlog(f"UNIX as datetime: {unix_as_dt}") pw.dlog(f"UNIX as datetime: {unix_as_dt}")
except ValueError as e:
_LOGGER.exception(e)
current_idx += fmt_len current_idx += fmt_len
return current_idx return current_idx
@ -1031,14 +1034,19 @@ def handle_matched_centroids_set(hk_data: bytes, pw: PrintWrapper):
y_errors = struct.unpack(fmt_floats, hk_data[current_idx : current_idx + inc_len]) y_errors = struct.unpack(fmt_floats, hk_data[current_idx : current_idx + inc_len])
current_idx += inc_len current_idx += inc_len
pw.dlog( pw.dlog(
"{:<8} {:<8} {:<8} {:<8} {:<8}".format( "{:<10} {:<10} {:<10} {:<10} {:<10}".format(
"Star ID", "X", "Y", "X Error", "Y Error" "Star ID", "X", "Y", "X Error", "Y Error"
) )
) )
for idx in range(16): for idx in range(16):
pw.dlog( pw.dlog(
"{:<8} {:<8} {:<8} {:<8} {:<8}".format( "{:<10} {:<10} {:<10.3f} {:<10.3f} {:<10.3f} {:<10.3f}".format(
star_id[idx], x_coords[idx], y_coords[idx], x_errors[idx], y_errors[idx] idx,
star_id[idx],
x_coords[idx],
y_coords[idx],
x_errors[idx],
y_errors[idx],
) )
) )
FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=8) FsfwTmTcPrinter.get_validity_buffer(hk_data[current_idx:], num_vars=8)