split up p60 hk set
This commit is contained in:
parent
25bab108df
commit
ab5cca85bf
@ -31,10 +31,11 @@ class GomspaceOpCodes:
|
|||||||
|
|
||||||
|
|
||||||
class SetIds:
|
class SetIds:
|
||||||
PDU_1 = 0x01
|
PDU_1 = 1
|
||||||
PDU_2 = 0x02
|
PDU_2 = 2
|
||||||
P60_DOCK = 0x03
|
P60_CORE = 3
|
||||||
ACU = 0x04
|
P60_AUX = 4
|
||||||
|
ACU = 5
|
||||||
|
|
||||||
|
|
||||||
class TableIds:
|
class TableIds:
|
||||||
|
@ -13,6 +13,7 @@ from tmtccmd.tm.service_3_fsfw_housekeeping import (
|
|||||||
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.p60dock import SetIds
|
||||||
from pus_tc.devs.imtq import ImtqSetIds
|
from pus_tc.devs.imtq import ImtqSetIds
|
||||||
from tmtccmd.pus.obj_id import ObjectId, ObjectIdDictT
|
from tmtccmd.pus.obj_id import ObjectId, ObjectIdDictT
|
||||||
from config.object_ids import (
|
from config.object_ids import (
|
||||||
@ -23,7 +24,7 @@ from config.object_ids import (
|
|||||||
BPX_HANDLER_ID,
|
BPX_HANDLER_ID,
|
||||||
CORE_CONTROLLER_ID,
|
CORE_CONTROLLER_ID,
|
||||||
P60_DOCK_HANDLER,
|
P60_DOCK_HANDLER,
|
||||||
PL_PCDU_ID
|
PL_PCDU_ID,
|
||||||
)
|
)
|
||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
@ -429,7 +430,9 @@ P60_INDEX_LIST = [
|
|||||||
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
|
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
|
||||||
|
|
||||||
|
|
||||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||||
|
if set_id == SetIds.P60_CORE:
|
||||||
|
log_to_both(printer, "P60 Core HK")
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
current_list = []
|
current_list = []
|
||||||
for idx in range(13):
|
for idx in range(13):
|
||||||
@ -456,60 +459,52 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
f"{P60_INDEX_LIST[idx].ljust(24)} | {out_enb} | "
|
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)
|
log_to_both(printer, content_line)
|
||||||
printer.file_logger.info(content_line)
|
fmt_str = "!IBhHhh"
|
||||||
fmt_str = "!hhIIIhBBB"
|
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(
|
(
|
||||||
temp0,
|
|
||||||
temp1,
|
|
||||||
boot_cause,
|
|
||||||
boot_count,
|
boot_count,
|
||||||
uptime,
|
|
||||||
reset_cause,
|
|
||||||
batt_mode,
|
batt_mode,
|
||||||
heater_on,
|
batt_current,
|
||||||
conv_5v_on,
|
batt_voltage,
|
||||||
|
temp_0,
|
||||||
|
temp_1,
|
||||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
util_info = (
|
batt_info = (
|
||||||
f"Batt Mode {batt_mode} | Boot Count {boot_count} | Heater On {heater_on}"
|
f"Batt Mode {batt_mode} | Boot Count {boot_count} | "
|
||||||
|
f"Batt: Current {batt_current} | Volt {batt_voltage}"
|
||||||
)
|
)
|
||||||
util_info2 = (
|
temps = f"In C: Temp 0 {temp_0 / 10.0} | Temp 1 {temp_1 / 10.0} | "
|
||||||
f"Reset Cause {reset_cause} | Boot Cause {boot_cause} | Uptime {uptime} | "
|
log_to_both(printer, temps)
|
||||||
f"Conv 5V on {conv_5v_on}"
|
log_to_both(printer, batt_info)
|
||||||
)
|
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=9)
|
||||||
print(util_info)
|
if set_id == SetIds.P60_AUX:
|
||||||
print(util_info2)
|
log_to_both(printer, "P60 AUX HK")
|
||||||
printer.file_logger.info(util_info)
|
current_idx = 0
|
||||||
printer.file_logger.info(util_info2)
|
|
||||||
latchup_list = []
|
latchup_list = []
|
||||||
for idx in range(0, 13):
|
for idx in range(0, 13):
|
||||||
latchup_list.append(
|
latchup_list.append(
|
||||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||||
)
|
)
|
||||||
|
content_line = f"{P60_INDEX_LIST[idx].ljust(24)} | {latchup_list[idx]}"
|
||||||
|
log_to_both(printer, content_line)
|
||||||
current_idx += 2
|
current_idx += 2
|
||||||
fmt_str = "!HhhHhh"
|
fmt_str = "!IIHBBHHhhB"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(
|
(
|
||||||
|
boot_cause,
|
||||||
|
uptime,
|
||||||
|
reset_cause,
|
||||||
|
heater_on,
|
||||||
|
conv_5v_on,
|
||||||
dock_vbat,
|
dock_vbat,
|
||||||
dock_vcc_current,
|
dock_vcc_c,
|
||||||
batt_current,
|
|
||||||
batt_voltage,
|
|
||||||
batt_temp_0,
|
batt_temp_0,
|
||||||
batt_temp_1,
|
batt_temp_1,
|
||||||
|
dearm_status,
|
||||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
device_types = []
|
|
||||||
device_statuses = []
|
|
||||||
for idx in range(8):
|
|
||||||
device_types.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
|
||||||
for idx in range(8):
|
|
||||||
device_statuses.append(hk_data[current_idx])
|
|
||||||
current_idx += 1
|
|
||||||
dearm_status = hk_data[current_idx]
|
|
||||||
current_idx += 1
|
|
||||||
wdt_reboots_list = []
|
wdt_reboots_list = []
|
||||||
for idx in range(5):
|
for idx in range(5):
|
||||||
wdt_reboots_list.append(
|
wdt_reboots_list.append(
|
||||||
@ -525,16 +520,32 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
for idx in range(2):
|
for idx in range(2):
|
||||||
time_pings_left_list.append(hk_data[current_idx])
|
time_pings_left_list.append(hk_data[current_idx])
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
batt_charge_current = struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
fmt_str = "!hhbb"
|
||||||
current_idx += 2
|
inc_len = struct.calcsize(fmt_str)
|
||||||
batt_discharge_current = struct.unpack(
|
(
|
||||||
"!h", hk_data[current_idx : current_idx + 2]
|
batt_charge_current,
|
||||||
)[0]
|
batt_discharge_current,
|
||||||
current_idx += 2
|
ant6_depl,
|
||||||
ant6_depl_status = struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
ar6_depl,
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
|
current_idx += inc_len
|
||||||
|
device_types = []
|
||||||
|
device_statuses = []
|
||||||
|
for idx in range(8):
|
||||||
|
device_types.append(hk_data[current_idx])
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
ar6_depl_status = struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
for idx in range(8):
|
||||||
|
device_statuses.append(hk_data[current_idx])
|
||||||
current_idx += 1
|
current_idx += 1
|
||||||
|
util_info = (
|
||||||
|
f"Reset Cause {reset_cause} | Boot Cause {boot_cause} | Uptime {uptime}"
|
||||||
|
)
|
||||||
|
util_info_2 = (
|
||||||
|
f"Conv 5V on {conv_5v_on} | Heater On {heater_on} | "
|
||||||
|
f"Dock VBAT {dock_vbat} | DOCK VCC Current {dock_vcc_c}"
|
||||||
|
)
|
||||||
|
log_to_both(printer, util_info)
|
||||||
|
log_to_both(printer, util_info_2)
|
||||||
wdt_info = "WDT Type | Reboots | Time or Pings left (CSP only)"
|
wdt_info = "WDT Type | Reboots | Time or Pings left (CSP only)"
|
||||||
log_to_both(printer, wdt_info)
|
log_to_both(printer, wdt_info)
|
||||||
for idx in range(len(wdt_reboots_list)):
|
for idx in range(len(wdt_reboots_list)):
|
||||||
@ -543,19 +554,18 @@ def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
|||||||
f"{WDT_LIST[idx].ljust(5)} | "
|
f"{WDT_LIST[idx].ljust(5)} | "
|
||||||
f"{wdt_reboots_list[idx]:010} | {time_pings_left_list[idx]:010}",
|
f"{wdt_reboots_list[idx]:010} | {time_pings_left_list[idx]:010}",
|
||||||
)
|
)
|
||||||
temps = (
|
misc_info = (
|
||||||
f"In C: Temp 0 {temp0 / 10.0} | Temp 1 {temp1 / 10.0} | "
|
f"Dearm {dearm_status} | ANT6 Depl {ant6_depl} | AR6 Deply {ar6_depl}"
|
||||||
f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0}"
|
|
||||||
)
|
)
|
||||||
|
log_to_both(printer, misc_info)
|
||||||
batt_info = (
|
batt_info = (
|
||||||
f"Batt: Current {batt_current} | Volt {batt_voltage} | "
|
f"Batt Temp 0 {batt_temp_0 / 10.0} | Batt Temp 1 {batt_temp_1 / 10.0}"
|
||||||
f"Charge Current {batt_charge_current} | Discharge Current {batt_discharge_current}"
|
f"Charge Current {batt_charge_current} | Discharge Current {batt_discharge_current}"
|
||||||
)
|
)
|
||||||
log_to_both(printer, temps)
|
|
||||||
log_to_both(printer, batt_info)
|
log_to_both(printer, batt_info)
|
||||||
misc_info = f"Dearm {dearm_status} | ANT6 Depl {ant6_depl_status} | AR6 Deply {ar6_depl_status}"
|
printer.print_validity_buffer(
|
||||||
log_to_both(printer, misc_info)
|
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=36)
|
)
|
||||||
|
|
||||||
|
|
||||||
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
def log_to_both(printer: FsfwTmTcPrinter, string: str):
|
||||||
|
Loading…
Reference in New Issue
Block a user