continued pdu1 pdu2 handling
This commit is contained in:
parent
a966471fe5
commit
259cd25b6e
@ -37,11 +37,13 @@ class Info:
|
|||||||
|
|
||||||
|
|
||||||
class SetIds:
|
class SetIds:
|
||||||
PDU_1 = 1
|
PDU_1_CORE = 1
|
||||||
PDU_2 = 2
|
PDU_1_AUX = 2
|
||||||
P60_CORE = 3
|
PDU_2_CORE = 3
|
||||||
P60_AUX = 4
|
PDU_2_AUX = 4
|
||||||
ACU = 5
|
P60_CORE = 5
|
||||||
|
P60_AUX = 6
|
||||||
|
ACU = 7
|
||||||
|
|
||||||
|
|
||||||
class TableIds:
|
class TableIds:
|
||||||
|
@ -425,9 +425,78 @@ P60_INDEX_LIST = [
|
|||||||
|
|
||||||
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
|
WDT_LIST = ["GND", "I2C", "CAN", "CSP0", "CSP1"]
|
||||||
|
|
||||||
|
PDU1_CHANNELS_NAMES = [
|
||||||
|
"TCS Board",
|
||||||
|
"Syrlinks",
|
||||||
|
"Startracker",
|
||||||
|
"MGT",
|
||||||
|
"SUS Nominal",
|
||||||
|
"SCEX",
|
||||||
|
"PLOC",
|
||||||
|
"ACS A Side",
|
||||||
|
"Unused Channel 8"
|
||||||
|
]
|
||||||
|
|
||||||
def handle_pdu_data(printer: FsfwTmTcPrinter, pdu_idx: int, hk_data: bytes):
|
PDU2_CHANNELS_NAMES = [
|
||||||
|
"Q7S",
|
||||||
|
"Payload PCDU CH1",
|
||||||
|
"RW",
|
||||||
|
"TCS Heater In",
|
||||||
|
"SUS Redundant",
|
||||||
|
"Deployment Mechanism",
|
||||||
|
"Payload PCDU CH6",
|
||||||
|
"ACS B Side",
|
||||||
|
"Payload Camera"
|
||||||
|
]
|
||||||
|
|
||||||
|
PDU_CHANNEL_NAMES = [
|
||||||
|
PDU1_CHANNELS_NAMES,
|
||||||
|
PDU2_CHANNELS_NAMES
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def handle_pdu_data(printer: FsfwTmTcPrinter, pdu_idx: int, set_id: int, hk_data: bytes):
|
||||||
|
if set_id == SetIds.PDU_1_AUX or set_id == SetIds.PDU_2_AUX:
|
||||||
|
log_to_both(printer, "PDU AUX HK TODO")
|
||||||
|
if set_id == SetIds.PDU_1_CORE or set_id == SetIds.PDU_2_CORE:
|
||||||
log_to_both(printer, f"Received PDU HK from PDU {pdu_idx}")
|
log_to_both(printer, f"Received PDU HK from PDU {pdu_idx}")
|
||||||
|
current_list = []
|
||||||
|
current_idx = 0
|
||||||
|
priv_idx = pdu_idx - 1
|
||||||
|
for idx in range(len(PDU1_CHANNELS_NAMES)):
|
||||||
|
current_list.append(
|
||||||
|
struct.unpack("!h", hk_data[current_idx: current_idx + 2])[0]
|
||||||
|
)
|
||||||
|
current_idx += 2
|
||||||
|
voltage_list = []
|
||||||
|
for idx in range(len(PDU1_CHANNELS_NAMES)):
|
||||||
|
voltage_list.append(
|
||||||
|
struct.unpack("!H", hk_data[current_idx: current_idx + 2])[0]
|
||||||
|
)
|
||||||
|
current_idx += 2
|
||||||
|
output_enb_list = []
|
||||||
|
for idx in range(len(PDU1_CHANNELS_NAMES)):
|
||||||
|
output_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(len(PDU1_CHANNELS_NAMES)):
|
||||||
|
out_enb = f"{output_enb_list[idx]}".ljust(6)
|
||||||
|
content_line = (
|
||||||
|
f"{PDU_CHANNEL_NAMES[priv_idx][idx].ljust(24)} | {out_enb} | "
|
||||||
|
f"{voltage_list[idx]:05} | {current_list[idx]:04}"
|
||||||
|
)
|
||||||
|
log_to_both(printer, content_line)
|
||||||
|
fmt_str = "!IBh"
|
||||||
|
inc_len = struct.calcsize(fmt_str)
|
||||||
|
(
|
||||||
|
boot_count,
|
||||||
|
batt_mode,
|
||||||
|
temperature
|
||||||
|
) = struct.unpack(fmt_str, hk_data[current_idx: current_idx + inc_len])
|
||||||
|
info = f"Boot Count {boot_count} | Battery Mode {batt_mode} | Temperature {temperature}"
|
||||||
|
log_to_both(printer, info)
|
||||||
|
|
||||||
|
|
||||||
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_p60_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user