better event handling
This commit is contained in:
parent
5651475955
commit
3479f5607d
@ -29,7 +29,6 @@ def get_event_dict() -> EventDictT:
|
|||||||
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
||||||
pw = PrintWrapper(printer)
|
pw = PrintWrapper(printer)
|
||||||
tm = Service5Tm.unpack(raw_telemetry=raw_tm)
|
tm = Service5Tm.unpack(raw_telemetry=raw_tm)
|
||||||
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
|
||||||
event_dict = get_event_dict()
|
event_dict = get_event_dict()
|
||||||
info = event_dict.get(tm.event_id)
|
info = event_dict.get(tm.event_id)
|
||||||
if info is None:
|
if info is None:
|
||||||
@ -46,6 +45,11 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
generic_event_string = (
|
generic_event_string = (
|
||||||
f"Object {obj_name} generated Event {tm.event_id} | {info.name}"
|
f"Object {obj_name} generated Event {tm.event_id} | {info.name}"
|
||||||
)
|
)
|
||||||
|
pw.printer.file_logger.info(
|
||||||
|
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
||||||
|
)
|
||||||
|
LOGGER.info(generic_event_string)
|
||||||
|
specific_handler = True
|
||||||
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
if info.name == "SUPV_UPDATE_PROGRESS" or info.name == "WRITE_MEMORY_FAILED":
|
||||||
additional_event_info = f"Additional info: {info.info}"
|
additional_event_info = f"Additional info: {info.info}"
|
||||||
context = (
|
context = (
|
||||||
@ -55,12 +59,11 @@ def handle_event_packet(raw_tm: bytes, printer: FsfwTmTcPrinter):
|
|||||||
pw.dlog(additional_event_info)
|
pw.dlog(additional_event_info)
|
||||||
pw.dlog(context)
|
pw.dlog(context)
|
||||||
else:
|
else:
|
||||||
|
specific_handler = False
|
||||||
if info.info != "":
|
if info.info != "":
|
||||||
additional_event_info = (
|
additional_event_info = (
|
||||||
f"Additional info: {info.info} | P1: {tm.param_1} | P2: {tm.param_2}"
|
f"Additional info: {info.info} | P1: {tm.param_1} | P2: {tm.param_2}"
|
||||||
)
|
)
|
||||||
pw.dlog(additional_event_info)
|
pw.dlog(additional_event_info)
|
||||||
pw.printer.file_logger.info(
|
if not specific_handler:
|
||||||
f"{datetime.now().strftime('%Y-%m-%d %H:%M:%S')}: {generic_event_string}"
|
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
||||||
)
|
|
||||||
LOGGER.info(generic_event_string)
|
|
||||||
|
Loading…
Reference in New Issue
Block a user