Major TMTC Update #52
@ -5,6 +5,7 @@ from config.object_ids import get_object_ids
|
|||||||
|
|
||||||
from tmtccmd.tm import Service5Tm
|
from tmtccmd.tm import Service5Tm
|
||||||
from tmtccmd.logging import get_console_logger
|
from tmtccmd.logging import get_console_logger
|
||||||
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
from tmtccmd.fsfw import parse_fsfw_events_csv, EventDictT, EventInfo
|
from tmtccmd.fsfw import parse_fsfw_events_csv, EventDictT, EventInfo
|
||||||
|
|
||||||
|
|
||||||
@ -24,7 +25,13 @@ def get_event_dict() -> EventDictT:
|
|||||||
return __EVENT_DICT
|
return __EVENT_DICT
|
||||||
|
|
||||||
|
|
||||||
def handle_event_packet(file_logger: logging.Logger, tm: Service5Tm) -> str:
|
def handle_event_packet(
|
||||||
|
raw_tm: bytes,
|
||||||
|
printer: FsfwTmTcPrinter,
|
||||||
|
file_logger: logging.Logger
|
||||||
|
) -> str:
|
||||||
|
tm = Service5Tm.unpack(raw_telemetry=raw_tm)
|
||||||
|
printer.handle_long_tm_print(packet_if=tm, info_if=tm)
|
||||||
additional_event_info = ""
|
additional_event_info = ""
|
||||||
event_dict = get_event_dict()
|
event_dict = get_event_dict()
|
||||||
info = event_dict.get(tm.event_id)
|
info = event_dict.get(tm.event_id)
|
||||||
|
@ -43,36 +43,35 @@ def pus_factory_hook(raw_tm_packet: bytes):
|
|||||||
return
|
return
|
||||||
service_type = raw_tm_packet[7]
|
service_type = raw_tm_packet[7]
|
||||||
subservice_type = raw_tm_packet[8]
|
subservice_type = raw_tm_packet[8]
|
||||||
tm_packet = None
|
|
||||||
file_logger = FSFW_PRINTER.file_logger
|
file_logger = FSFW_PRINTER.file_logger
|
||||||
obj_id_dict = get_object_ids()
|
obj_id_dict = get_object_ids()
|
||||||
try:
|
try:
|
||||||
if service_type == 1:
|
if service_type == 1:
|
||||||
handle_service_1_packet(printer=FSFW_PRINTER, raw_tm=raw_tm_packet)
|
handle_service_1_packet(printer=FSFW_PRINTER, raw_tm=raw_tm_packet)
|
||||||
elif service_type == 3:
|
elif service_type == 3:
|
||||||
tm_packet = Service3FsfwTm.unpack(
|
|
||||||
raw_telemetry=raw_tm_packet, custom_hk_handling=False
|
|
||||||
)
|
|
||||||
named_obj_id = obj_id_dict.get(tm_packet.object_id.as_bytes)
|
|
||||||
if named_obj_id is None:
|
|
||||||
named_obj_id = tm_packet.object_id
|
|
||||||
handle_hk_packet(
|
handle_hk_packet(
|
||||||
printer=FSFW_PRINTER,
|
printer=FSFW_PRINTER,
|
||||||
object_id=named_obj_id,
|
raw_tm=raw_tm_packet,
|
||||||
hk_packet=tm_packet,
|
obj_id_dict=obj_id_dict
|
||||||
packet_if=tm_packet
|
|
||||||
)
|
)
|
||||||
elif service_type == 5:
|
elif service_type == 5:
|
||||||
tm_packet = Service5Tm.unpack(raw_telemetry=raw_tm_packet)
|
handle_event_packet(
|
||||||
handle_event_packet(file_logger=file_logger, tm=tm_packet)
|
raw_tm=raw_tm_packet,
|
||||||
|
printer=FSFW_PRINTER,
|
||||||
|
file_logger=file_logger
|
||||||
|
)
|
||||||
elif service_type == 8:
|
elif service_type == 8:
|
||||||
tm_packet = Service8FsfwTm.unpack(raw_telemetry=raw_tm_packet)
|
tm_packet = Service8FsfwTm.unpack(raw_telemetry=raw_tm_packet)
|
||||||
|
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||||
elif service_type == 17:
|
elif service_type == 17:
|
||||||
tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet)
|
tm_packet = Service17TMExtended.unpack(raw_telemetry=raw_tm_packet)
|
||||||
|
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||||
elif service_type == 20:
|
elif service_type == 20:
|
||||||
tm_packet = Service20FsfwTm.unpack(raw_telemetry=raw_tm_packet)
|
tm_packet = Service20FsfwTm.unpack(raw_telemetry=raw_tm_packet)
|
||||||
|
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||||
elif service_type == 200:
|
elif service_type == 200:
|
||||||
tm_packet = Service200FsfwTm.unpack(raw_telemetry=raw_tm_packet)
|
tm_packet = Service200FsfwTm.unpack(raw_telemetry=raw_tm_packet)
|
||||||
|
FSFW_PRINTER.handle_long_tm_print(packet_if=tm_packet, info_if=tm_packet)
|
||||||
else:
|
else:
|
||||||
LOGGER.info(
|
LOGGER.info(
|
||||||
f"The service {service_type} is not implemented in Telemetry Factory"
|
f"The service {service_type} is not implemented in Telemetry Factory"
|
||||||
|
@ -5,13 +5,12 @@ import datetime
|
|||||||
|
|
||||||
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
from tmtccmd.utility.tmtc_printer import FsfwTmTcPrinter
|
||||||
from tmtccmd.config.definitions import HkReplyUnpacked
|
from tmtccmd.config.definitions import HkReplyUnpacked
|
||||||
from tmtccmd.tm.base import PusTmInterface
|
from tmtccmd.tm.service_3_fsfw_housekeeping import Service3Base, HkContentType, Service3FsfwTm
|
||||||
from tmtccmd.tm.service_3_fsfw_housekeeping import Service3Base, HkContentType
|
|
||||||
from tmtccmd.logging import get_console_logger
|
from tmtccmd.logging import get_console_logger
|
||||||
from pus_tc.devs.bpx_batt import BpxSetIds
|
from pus_tc.devs.bpx_batt import BpxSetIds
|
||||||
from pus_tc.devs.syrlinks_hk_handler import SetIds
|
from pus_tc.devs.syrlinks_hk_handler import SetIds
|
||||||
from pus_tc.devs.imtq import ImtqSetIds
|
from pus_tc.devs.imtq import ImtqSetIds
|
||||||
from tmtccmd.pus.obj_id import ObjectId
|
from tmtccmd.pus.obj_id import ObjectId, ObjectIdDictT
|
||||||
from config.object_ids import (
|
from config.object_ids import (
|
||||||
SYRLINKS_HANDLER_ID,
|
SYRLINKS_HANDLER_ID,
|
||||||
IMTQ_HANDLER_ID,
|
IMTQ_HANDLER_ID,
|
||||||
@ -26,31 +25,39 @@ LOGGER = get_console_logger()
|
|||||||
|
|
||||||
|
|
||||||
def handle_hk_packet(
|
def handle_hk_packet(
|
||||||
|
raw_tm: bytes,
|
||||||
|
obj_id_dict: ObjectIdDictT,
|
||||||
printer: FsfwTmTcPrinter,
|
printer: FsfwTmTcPrinter,
|
||||||
object_id: ObjectId,
|
|
||||||
hk_packet: Service3Base,
|
|
||||||
packet_if: PusTmInterface
|
|
||||||
):
|
):
|
||||||
if packet_if.subservice == 25 or packet_if.subservice == 26:
|
tm_packet = Service3FsfwTm.unpack(
|
||||||
hk_data = packet_if.tm_data[8:]
|
raw_telemetry=raw_tm, custom_hk_handling=False
|
||||||
|
)
|
||||||
|
named_obj_id = obj_id_dict.get(tm_packet.object_id.as_bytes)
|
||||||
|
if named_obj_id is None:
|
||||||
|
named_obj_id = tm_packet.object_id
|
||||||
|
if tm_packet.subservice == 25 or tm_packet.subservice == 26:
|
||||||
|
hk_data = tm_packet.tm_data[8:]
|
||||||
printer.generic_hk_print(
|
printer.generic_hk_print(
|
||||||
content_type=HkContentType.HK,
|
content_type=HkContentType.HK,
|
||||||
object_id=object_id,
|
object_id=named_obj_id,
|
||||||
set_id=hk_packet.set_id,
|
set_id=tm_packet.set_id,
|
||||||
hk_data=hk_data
|
hk_data=hk_data,
|
||||||
)
|
)
|
||||||
handle_regular_hk_print(
|
handle_regular_hk_print(
|
||||||
printer=printer,
|
printer=printer,
|
||||||
object_id=object_id,
|
object_id=named_obj_id,
|
||||||
hk_packet=hk_packet,
|
hk_packet=tm_packet,
|
||||||
hk_data=hk_data,
|
hk_data=hk_data,
|
||||||
)
|
)
|
||||||
if packet_if.subservice == 10 or packet_if.subservice == 12:
|
if tm_packet.subservice == 10 or tm_packet.subservice == 12:
|
||||||
LOGGER.warning("HK definitions printout not implemented yet")
|
LOGGER.warning("HK definitions printout not implemented yet")
|
||||||
|
|
||||||
|
|
||||||
def handle_regular_hk_print(
|
def handle_regular_hk_print(
|
||||||
printer: FsfwTmTcPrinter, object_id: ObjectId, hk_packet: Service3Base, hk_data: bytes
|
printer: FsfwTmTcPrinter,
|
||||||
|
object_id: ObjectId,
|
||||||
|
hk_packet: Service3Base,
|
||||||
|
hk_data: bytes,
|
||||||
):
|
):
|
||||||
object_id = object_id.as_bytes
|
object_id = object_id.as_bytes
|
||||||
set_id = hk_packet.set_id
|
set_id = hk_packet.set_id
|
||||||
@ -74,7 +81,7 @@ def handle_regular_hk_print(
|
|||||||
elif object_id == BPX_HANDLER_ID:
|
elif object_id == BPX_HANDLER_ID:
|
||||||
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id)
|
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id)
|
||||||
elif object_id == CORE_CONTROLLER_ID:
|
elif object_id == CORE_CONTROLLER_ID:
|
||||||
return handle_core_hk_data(hk_data=hk_data, set_id=set_id)
|
return handle_core_hk_data(printer=printer, hk_data=hk_data)
|
||||||
elif object_id == P60_DOCK_HANDLER:
|
elif object_id == P60_DOCK_HANDLER:
|
||||||
return handle_p60_hk_data(printer=printer, hk_data=hk_data)
|
return handle_p60_hk_data(printer=printer, hk_data=hk_data)
|
||||||
else:
|
else:
|
||||||
@ -376,23 +383,26 @@ def handle_bpx_hk_data(hk_data: bytes, set_id: int) -> HkReplyUnpacked:
|
|||||||
return reply
|
return reply
|
||||||
|
|
||||||
|
|
||||||
def handle_core_hk_data(hk_data: bytes, set_id: int) -> HkReplyUnpacked:
|
def handle_core_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||||
reply = HkReplyUnpacked()
|
|
||||||
reply.header_list = ["Chip Temperature [°C]", "PS Voltage [mV]", "PL Voltage [mV]"]
|
fmt_str = "!fffH"
|
||||||
temperature = struct.unpack("!f", hk_data[0:4])
|
inc_len = struct.calcsize(fmt_str)
|
||||||
ps_voltage = struct.unpack("!f", hk_data[4:8])
|
(
|
||||||
pl_voltage = struct.unpack("!f", hk_data[8:12])
|
temperature,
|
||||||
tx_agc_value = struct.unpack("!H", hk_data[2:4])
|
ps_voltage,
|
||||||
reply.content_list = [temperature, ps_voltage, pl_voltage]
|
pl_voltage,
|
||||||
reply.validity_buffer = hk_data[12:]
|
tx_agc_value
|
||||||
reply.num_of_vars = 3
|
) = struct.unpack(fmt_str, hk_data[0:0 + inc_len])
|
||||||
return reply
|
printout = f"Chip Temperature [°C] {temperature} | PS Voltage [mV] {ps_voltage} | " \
|
||||||
|
f"PL Voltage [mV] {pl_voltage} | TX AGC {tx_agc_value}"
|
||||||
|
log_to_both(printer, printout)
|
||||||
|
printer.print_validity_buffer(validity_buffer=hk_data[inc_len:], num_vars=4)
|
||||||
|
|
||||||
|
|
||||||
P60_INDEX_LIST = [
|
P60_INDEX_LIST = [
|
||||||
"ACU VCC",
|
"ACU VCC",
|
||||||
"PDU1 VCC",
|
"PDU1 VCC",
|
||||||
"X3 IDLE",
|
"X3 IDLE VCC",
|
||||||
"PDU2 VCC",
|
"PDU2 VCC",
|
||||||
"ACU VBAT",
|
"ACU VBAT",
|
||||||
"PDU1 VBAT",
|
"PDU1 VBAT",
|
||||||
@ -405,14 +415,15 @@ P60_INDEX_LIST = [
|
|||||||
"GS5V",
|
"GS5V",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
|
||||||
|
|
||||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes) -> HkReplyUnpacked:
|
|
||||||
reply = HkReplyUnpacked()
|
def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
current_list = []
|
current_list = []
|
||||||
for idx in range(0, 13):
|
for idx in range(13):
|
||||||
current_list.append(
|
current_list.append(
|
||||||
struct.unpack('!h', hk_data[current_idx : current_idx + 2])[0]
|
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
||||||
)
|
)
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
voltage_list = []
|
voltage_list = []
|
||||||
@ -430,160 +441,108 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes) -> HkReplyUnpac
|
|||||||
printer.file_logger.info(header_str)
|
printer.file_logger.info(header_str)
|
||||||
for idx in range(13):
|
for idx in range(13):
|
||||||
out_enb = f"{out_enb_list[idx]}".ljust(6)
|
out_enb = f"{out_enb_list[idx]}".ljust(6)
|
||||||
content_line = f"{P60_INDEX_LIST[idx].ljust(24)} | {out_enb} | " \
|
content_line = (
|
||||||
|
f"{P60_INDEX_LIST[idx].ljust(24)} | {out_enb} | "
|
||||||
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
||||||
|
)
|
||||||
print(content_line)
|
print(content_line)
|
||||||
printer.file_logger.info(content_line)
|
printer.file_logger.info(content_line)
|
||||||
reply.header_list.append("Temp 0 [C]")
|
fmt_str = "!hhIIIhBBB"
|
||||||
reply.content_list.append(
|
inc_len = struct.calcsize(fmt_str)
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
(
|
||||||
|
temp0,
|
||||||
|
temp1,
|
||||||
|
boot_cause,
|
||||||
|
boot_count,
|
||||||
|
uptime,
|
||||||
|
reset_cause,
|
||||||
|
batt_mode,
|
||||||
|
heater_on,
|
||||||
|
conv_5v_on,
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
|
current_idx += inc_len
|
||||||
|
util_info = (
|
||||||
|
f"Batt Mode {batt_mode} | Boot Count {boot_count} | Heater On {heater_on}"
|
||||||
)
|
)
|
||||||
current_idx += 2
|
util_info2 = (
|
||||||
reply.header_list.append("Temp 1 [C]")
|
f"Reset Cause {reset_cause} | Boot Cause {boot_cause} | Uptime {uptime} | "
|
||||||
reply.content_list.append(
|
f"Conv 5V on {conv_5v_on}"
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
|
||||||
)
|
)
|
||||||
current_idx += 2
|
print(util_info)
|
||||||
reply.header_list.append("Boot Cause")
|
print(util_info2)
|
||||||
reply.content_list.append(
|
printer.file_logger.info(util_info)
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
printer.file_logger.info(util_info2)
|
||||||
)
|
latchup_list = []
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("Boot Count")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("Uptime")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("Reset Cause")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
|
||||||
)
|
|
||||||
current_idx += 2
|
|
||||||
reply.header_list.append("Battery Mode")
|
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
|
||||||
reply.header_list.append("Heater On")
|
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
|
||||||
reply.header_list.append("Conv 5V Enable Status")
|
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
|
||||||
for idx in range(0, 13):
|
for idx in range(0, 13):
|
||||||
reply.header_list.append(f"Latchup {P60_INDEX_LIST[idx]}")
|
latchup_list.append(
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||||
)
|
)
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
reply.header_list.append("Dock VBAT [mV]")
|
fmt_str = "!HhhHhh"
|
||||||
reply.content_list.append(
|
inc_len = struct.calcsize(fmt_str)
|
||||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
(
|
||||||
)
|
dock_vbat,
|
||||||
current_idx += 2
|
dock_vcc_current,
|
||||||
reply.header_list.append("Dock VCC Current [mA]")
|
batt_current,
|
||||||
reply.content_list.append(
|
batt_voltage,
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
batt_temp_0,
|
||||||
)
|
batt_temp_1
|
||||||
current_idx += 2
|
) = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||||
reply.header_list.append("Batt Charge [mA]")
|
current_idx += inc_len
|
||||||
reply.content_list.append(
|
device_types = []
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
device_statuses = []
|
||||||
)
|
for idx in range(8):
|
||||||
current_idx += 2
|
device_types.append(hk_data[current_idx])
|
||||||
reply.header_list.append("Batt Voltage [mV]")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
|
||||||
)
|
|
||||||
current_idx += 2
|
|
||||||
reply.header_list.append("Batt Temp 0 [C]")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
|
||||||
)
|
|
||||||
current_idx += 2
|
|
||||||
reply.header_list.append("Batt Temp 1 [C]")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
|
||||||
)
|
|
||||||
current_idx += 2
|
|
||||||
for idx in range(0, 7):
|
|
||||||
reply.header_list.append(f"Device {idx} type")
|
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
for idx in range(0, 7):
|
for idx in range(8):
|
||||||
reply.header_list.append(f"Device {idx} status")
|
device_statuses.append(hk_data[current_idx])
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
reply.header_list.append("De-Arm Status")
|
dearm_status = hk_data[current_idx]
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
reply.header_list.append("GND WDT Reboots")
|
wdt_reboots_list = []
|
||||||
reply.content_list.append(
|
for idx in range(5):
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
wdt_reboots_list.append(struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0])
|
||||||
)
|
|
||||||
current_idx += 4
|
current_idx += 4
|
||||||
reply.header_list.append("I2C WDT Reboots")
|
time_pings_left_list = []
|
||||||
reply.content_list.append(
|
for idx in range(3):
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
time_pings_left_list.append(struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0])
|
||||||
)
|
|
||||||
current_idx += 4
|
current_idx += 4
|
||||||
reply.header_list.append("CAN WDT Reboots")
|
for idx in range(2):
|
||||||
reply.content_list.append(
|
time_pings_left_list.append(hk_data[current_idx])
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("CSP0 WDT Reboots")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("CSP1 WDT Reboots")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("GND WDT time left [s]")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("I2C WDT time left [s]")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("CAN WDT time left [s]")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
|
||||||
)
|
|
||||||
current_idx += 4
|
|
||||||
reply.header_list.append("CSP0 WDT Pings Left")
|
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
reply.header_list.append("CSP1 WDT Pings left")
|
batt_charge_current = struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
||||||
reply.content_list.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
|
||||||
reply.header_list.append("Batt Charge Current")
|
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
|
||||||
)
|
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
reply.header_list.append("Batt Discharge Current")
|
batt_discharge_current = struct.unpack(
|
||||||
reply.content_list.append(
|
"!h", hk_data[current_idx : current_idx + 2]
|
||||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
)[0]
|
||||||
)
|
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
reply.header_list.append("ANT6 Depl Status")
|
ant6_depl_status = struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
|
||||||
)
|
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
reply.header_list.append("AR6 Depl Status")
|
ar6_depl_status = struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
||||||
reply.content_list.append(
|
|
||||||
struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
|
||||||
)
|
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
return reply
|
wdt_info = "WDT Type | Reboots | Time or Pings left (CSP only)"
|
||||||
|
log_to_both(printer, wdt_info)
|
||||||
|
for idx in range(len(wdt_reboots_list)):
|
||||||
|
log_to_both(
|
||||||
|
printer,
|
||||||
|
f"{WDT_LIST[idx].ljust(5)} | "
|
||||||
|
f"{wdt_reboots_list[idx]:010} | {time_pings_left_list[idx]:010}",
|
||||||
|
)
|
||||||
|
temps = (
|
||||||
|
f"In C: Temp 0 {temp0 / 10.0} | Temp 1 {temp1 / 10.0} | "
|
||||||
|
f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0}"
|
||||||
|
)
|
||||||
|
batt_info = (
|
||||||
|
f"Batt: Current {batt_current} | Volt {batt_voltage} | "
|
||||||
|
f"Charge Current {batt_charge_current} | Discharge Current {batt_discharge_current}"
|
||||||
|
)
|
||||||
|
log_to_both(printer, temps)
|
||||||
|
log_to_both(printer, batt_info)
|
||||||
|
misc_info = f"Dearm {dearm_status} | ANT6 Depl {ant6_depl_status} | AR6 Deply {ar6_depl_status}"
|
||||||
|
log_to_both(printer, misc_info)
|
||||||
|
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=36)
|
||||||
|
|
||||||
|
|
||||||
|
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||||
|
print(string)
|
||||||
|
printer.file_logger.info(string)
|
||||||
|
2
tmtccmd
2
tmtccmd
@ -1 +1 @@
|
|||||||
Subproject commit dfeaec0f452c32f2e3fa7eadaf91e3297fb8124e
|
Subproject commit e0f1f8c77e2a182181689743dbee065f0b894a26
|
Loading…
x
Reference in New Issue
Block a user