split up p60 hk set
This commit is contained in:
parent
25bab108df
commit
ab5cca85bf
@ -31,10 +31,11 @@ class GomspaceOpCodes:
|
||||
|
||||
|
||||
class SetIds:
|
||||
PDU_1 = 0x01
|
||||
PDU_2 = 0x02
|
||||
P60_DOCK = 0x03
|
||||
ACU = 0x04
|
||||
PDU_1 = 1
|
||||
PDU_2 = 2
|
||||
P60_CORE = 3
|
||||
P60_AUX = 4
|
||||
ACU = 5
|
||||
|
||||
|
||||
class TableIds:
|
||||
|
@ -13,6 +13,7 @@ from tmtccmd.tm.service_3_fsfw_housekeeping import (
|
||||
from tmtccmd.logging import get_console_logger
|
||||
from pus_tc.devs.bpx_batt import BpxSetIds
|
||||
from pus_tc.devs.syrlinks_hk_handler import SetIds
|
||||
from pus_tc.devs.p60dock import SetIds
|
||||
from pus_tc.devs.imtq import ImtqSetIds
|
||||
from tmtccmd.pus.obj_id import ObjectId, ObjectIdDictT
|
||||
from config.object_ids import (
|
||||
@ -23,7 +24,7 @@ from config.object_ids import (
|
||||
BPX_HANDLER_ID,
|
||||
CORE_CONTROLLER_ID,
|
||||
P60_DOCK_HANDLER,
|
||||
PL_PCDU_ID
|
||||
PL_PCDU_ID,
|
||||
)
|
||||
|
||||
LOGGER = get_console_logger()
|
||||
@ -429,133 +430,142 @@ P60_INDEX_LIST = [
|
||||
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
|
||||
|
||||
|
||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, hk_data: bytes):
|
||||
current_idx = 0
|
||||
current_list = []
|
||||
for idx in range(13):
|
||||
current_list.append(
|
||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
||||
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_list = []
|
||||
for idx in range(13):
|
||||
current_list.append(
|
||||
struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
current_idx += 2
|
||||
voltage_list = []
|
||||
for idx in range(13):
|
||||
voltage_list.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
)
|
||||
current_idx += 2
|
||||
out_enb_list = []
|
||||
for idx in range(13):
|
||||
out_enb_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
header_str = f"{'Name'.ljust(24)} | OutEnb | U [mV] | I [mA]"
|
||||
print(header_str)
|
||||
printer.file_logger.info(header_str)
|
||||
for idx in range(13):
|
||||
out_enb = f"{out_enb_list[idx]}".ljust(6)
|
||||
content_line = (
|
||||
f"{P60_INDEX_LIST[idx].ljust(24)} | {out_enb} | "
|
||||
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
||||
)
|
||||
log_to_both(printer, content_line)
|
||||
fmt_str = "!IBhHhh"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
boot_count,
|
||||
batt_mode,
|
||||
batt_current,
|
||||
batt_voltage,
|
||||
temp_0,
|
||||
temp_1,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
batt_info = (
|
||||
f"Batt Mode {batt_mode} | Boot Count {boot_count} | "
|
||||
f"Batt: Current {batt_current} | Volt {batt_voltage}"
|
||||
)
|
||||
current_idx += 2
|
||||
voltage_list = []
|
||||
for idx in range(13):
|
||||
voltage_list.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
temps = f"In C: Temp 0 {temp_0 / 10.0} | Temp 1 {temp_1 / 10.0} | "
|
||||
log_to_both(printer, temps)
|
||||
log_to_both(printer, batt_info)
|
||||
printer.print_validity_buffer(validity_buffer=hk_data[current_idx:], num_vars=9)
|
||||
if set_id == SetIds.P60_AUX:
|
||||
log_to_both(printer, "P60 AUX HK")
|
||||
current_idx = 0
|
||||
latchup_list = []
|
||||
for idx in range(0, 13):
|
||||
latchup_list.append(
|
||||
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
|
||||
fmt_str = "!IIHBBHHhhB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
boot_cause,
|
||||
uptime,
|
||||
reset_cause,
|
||||
heater_on,
|
||||
conv_5v_on,
|
||||
dock_vbat,
|
||||
dock_vcc_c,
|
||||
batt_temp_0,
|
||||
batt_temp_1,
|
||||
dearm_status,
|
||||
) = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||
current_idx += inc_len
|
||||
wdt_reboots_list = []
|
||||
for idx in range(5):
|
||||
wdt_reboots_list.append(
|
||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
time_pings_left_list = []
|
||||
for idx in range(3):
|
||||
time_pings_left_list.append(
|
||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
)
|
||||
current_idx += 4
|
||||
for idx in range(2):
|
||||
time_pings_left_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
fmt_str = "!hhbb"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
batt_charge_current,
|
||||
batt_discharge_current,
|
||||
ant6_depl,
|
||||
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
|
||||
for idx in range(8):
|
||||
device_statuses.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
util_info = (
|
||||
f"Reset Cause {reset_cause} | Boot Cause {boot_cause} | Uptime {uptime}"
|
||||
)
|
||||
current_idx += 2
|
||||
out_enb_list = []
|
||||
for idx in range(13):
|
||||
out_enb_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
header_str = f"{'Name'.ljust(24)} | OutEnb | U [mV] | I [mA]"
|
||||
print(header_str)
|
||||
printer.file_logger.info(header_str)
|
||||
for idx in range(13):
|
||||
out_enb = f"{out_enb_list[idx]}".ljust(6)
|
||||
content_line = (
|
||||
f"{P60_INDEX_LIST[idx].ljust(24)} | {out_enb} | "
|
||||
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
||||
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}"
|
||||
)
|
||||
print(content_line)
|
||||
printer.file_logger.info(content_line)
|
||||
fmt_str = "!hhIIIhBBB"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
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}"
|
||||
)
|
||||
util_info2 = (
|
||||
f"Reset Cause {reset_cause} | Boot Cause {boot_cause} | Uptime {uptime} | "
|
||||
f"Conv 5V on {conv_5v_on}"
|
||||
)
|
||||
print(util_info)
|
||||
print(util_info2)
|
||||
printer.file_logger.info(util_info)
|
||||
printer.file_logger.info(util_info2)
|
||||
latchup_list = []
|
||||
for idx in range(0, 13):
|
||||
latchup_list.append(
|
||||
struct.unpack("!H", hk_data[current_idx : current_idx + 2])[0]
|
||||
log_to_both(printer, util_info)
|
||||
log_to_both(printer, util_info_2)
|
||||
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}",
|
||||
)
|
||||
misc_info = (
|
||||
f"Dearm {dearm_status} | ANT6 Depl {ant6_depl} | AR6 Deply {ar6_depl}"
|
||||
)
|
||||
current_idx += 2
|
||||
fmt_str = "!HhhHhh"
|
||||
inc_len = struct.calcsize(fmt_str)
|
||||
(
|
||||
dock_vbat,
|
||||
dock_vcc_current,
|
||||
batt_current,
|
||||
batt_voltage,
|
||||
batt_temp_0,
|
||||
batt_temp_1,
|
||||
) = 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
|
||||
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 = []
|
||||
for idx in range(5):
|
||||
wdt_reboots_list.append(
|
||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
log_to_both(printer, misc_info)
|
||||
batt_info = (
|
||||
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}"
|
||||
)
|
||||
current_idx += 4
|
||||
time_pings_left_list = []
|
||||
for idx in range(3):
|
||||
time_pings_left_list.append(
|
||||
struct.unpack("!I", hk_data[current_idx : current_idx + 4])[0]
|
||||
log_to_both(printer, batt_info)
|
||||
printer.print_validity_buffer(
|
||||
validity_buffer=hk_data[current_idx:], num_vars=27
|
||||
)
|
||||
current_idx += 4
|
||||
for idx in range(2):
|
||||
time_pings_left_list.append(hk_data[current_idx])
|
||||
current_idx += 1
|
||||
batt_charge_current = struct.unpack("!h", hk_data[current_idx : current_idx + 2])[0]
|
||||
current_idx += 2
|
||||
batt_discharge_current = struct.unpack(
|
||||
"!h", hk_data[current_idx : current_idx + 2]
|
||||
)[0]
|
||||
current_idx += 2
|
||||
ant6_depl_status = struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
||||
current_idx += 1
|
||||
ar6_depl_status = struct.unpack("!b", hk_data[current_idx : current_idx + 1])[0]
|
||||
current_idx += 1
|
||||
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):
|
||||
|
Loading…
Reference in New Issue
Block a user