v1.9.0 #53
@ -16,6 +16,7 @@ from config.object_ids import (
|
||||
GPS_HANDLER_1_ID,
|
||||
BPX_HANDLER_ID,
|
||||
CORE_CONTROLLER_ID,
|
||||
P60_DOCK_HANDLER
|
||||
)
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
@ -45,6 +46,8 @@ def handle_user_hk_packet(
|
||||
return handle_bpx_hk_data(hk_data=hk_data, set_id=set_id)
|
||||
elif object_id == CORE_CONTROLLER_ID:
|
||||
return handle_core_hk_data(hk_data=hk_data, set_id=set_id)
|
||||
elif object_id == P60_DOCK_HANDLER:
|
||||
return handle_p60_hk_data(hk_data=hk_data)
|
||||
else:
|
||||
LOGGER.info("Service 3 TM: Parsing for this SID has not been implemented.")
|
||||
return HkReplyUnpacked()
|
||||
@ -355,3 +358,137 @@ def handle_core_hk_data(hk_data: bytes, set_id: int) -> HkReplyUnpacked:
|
||||
reply.validity_buffer = hk_data[12:]
|
||||
reply.num_of_vars = 3
|
||||
return reply
|
||||
|
||||
|
||||
P60_INDEX_LIST = [
|
||||
"ACU VCC", "PDU1 VCC", "X3 IDLE", "PDU2 VCC", "ACU VBAT", "PDU1 VBAT",
|
||||
"X3 IDLE VBAT", "PDU2 VBAT", "STACK VBAT", "STACK 3V3", "STACK 5V",
|
||||
"GS3V3", "GS5V"
|
||||
]
|
||||
|
||||
|
||||
def handle_p60_hk_data(hk_data: bytes) -> HkReplyUnpacked:
|
||||
reply = HkReplyUnpacked()
|
||||
current_idx = 0
|
||||
for idx in range(0, 13):
|
||||
if idx == 0:
|
||||
reply.header_list.append(f"I [mA] {P60_INDEX_LIST[idx]}")
|
||||
|
||||
else:
|
||||
reply.header_list.append(f"I {P60_INDEX_LIST[idx]}")
|
||||
reply.content_list.append(struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
for idx in range(0, 13):
|
||||
if idx == 0:
|
||||
reply.header_list.append(f"U [mV] {P60_INDEX_LIST[idx]}")
|
||||
else:
|
||||
reply.header_list.append(f"U {P60_INDEX_LIST[idx]}")
|
||||
reply.content_list.append(struct.unpack("!H", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
for idx in range(0, 13):
|
||||
reply.header_list.append(f"OutEnb {P60_INDEX_LIST[idx]}")
|
||||
reply.content_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
reply.header_list.append("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("Temp 1 [C]")
|
||||
reply.content_list.append(struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
reply.header_list.append("Boot Cause")
|
||||
reply.content_list.append(struct.unpack("!I", hk_data[current_idx: current_idx + 4])[0])
|
||||
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 + 4])[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):
|
||||
reply.header_list.append(f"Latchup {P60_INDEX_LIST[idx]}")
|
||||
reply.content_list.append(struct.unpack("!H", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
reply.header_list.append("Dock VBAT [mV]")
|
||||
reply.content_list.append(struct.unpack("!H", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
reply.header_list.append("Dock VCC Current [mA]")
|
||||
reply.content_list.append(struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
reply.header_list.append("Batt Charge [mA]")
|
||||
reply.content_list.append(struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
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
|
||||
for idx in range(0, 7):
|
||||
reply.header_list.append(f"Device {idx} status")
|
||||
reply.content_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
reply.header_list.append("De-Arm Status")
|
||||
reply.content_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
reply.header_list.append("GND WDT Reboots")
|
||||
reply.content_list.append(struct.unpack("!I", hk_data[current_idx: current_idx + 4])[0])
|
||||
current_idx += 4
|
||||
reply.header_list.append("I2C WDT Reboots")
|
||||
reply.content_list.append(struct.unpack("!I", hk_data[current_idx: current_idx + 4])[0])
|
||||
current_idx += 4
|
||||
reply.header_list.append("CAN WDT Reboots")
|
||||
reply.content_list.append(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
|
||||
reply.header_list.append("CSP1 WDT Pings left")
|
||||
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
|
||||
reply.header_list.append("Batt Discharge Current")
|
||||
reply.content_list.append(struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0])
|
||||
current_idx += 2
|
||||
reply.header_list.append("ANT6 Depl Status")
|
||||
reply.content_list.append(struct.unpack("!b", hk_data[current_idx: current_idx + 1])[0])
|
||||
current_idx += 1
|
||||
reply.header_list.append("AR6 Depl Status")
|
||||
reply.content_list.append(struct.unpack("!b", hk_data[current_idx: current_idx + 1])[0])
|
||||
current_idx += 1
|
||||
return reply
|
||||
|
Loading…
Reference in New Issue
Block a user