bugfix for acu hk parsing
This commit is contained in:
parent
3586b541c1
commit
7f03dcb3a6
@ -104,10 +104,31 @@ class DevicesInfoParser:
|
|||||||
current_idx += 1
|
current_idx += 1
|
||||||
return current_idx
|
return current_idx
|
||||||
|
|
||||||
|
def map_idx_to_type(self, devtype: int) -> str:
|
||||||
|
if devtype == 0:
|
||||||
|
return "Reserved"
|
||||||
|
if devtype == 1:
|
||||||
|
return "ADC"
|
||||||
|
if devtype == 2:
|
||||||
|
return "ADC"
|
||||||
|
if devtype == 3:
|
||||||
|
return "DAC"
|
||||||
|
if devtype == 4:
|
||||||
|
return "Temperature Sensor"
|
||||||
|
if devtype == 5:
|
||||||
|
return "Temperature Sensor (Bat Pack)"
|
||||||
|
if devtype == 6:
|
||||||
|
return "RTC"
|
||||||
|
if devtype == 7:
|
||||||
|
return "FRAM"
|
||||||
|
return "Unknown Type"
|
||||||
|
|
||||||
def print(self, pw: PrintWrapper):
|
def print(self, pw: PrintWrapper):
|
||||||
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
|
pw.dlog(f"Device Type | Device State (0:None | 1:OK | 3:ERROR | 4:NOT FOUND)")
|
||||||
for i in range(len(self.dev_types)):
|
for i in range(len(self.dev_types)):
|
||||||
pw.dlog(f"{self.dev_types} | {self.dev_statuses}")
|
pw.dlog(
|
||||||
|
f"{self.map_idx_to_type(self.dev_types[i])} | {self.dev_statuses[i]}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def handle_pdu_data(
|
def handle_pdu_data(
|
||||||
@ -321,13 +342,8 @@ def gen_six_entry_u16_list(hk_data: bytes, current_idx: int) -> Tuple[int, List[
|
|||||||
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
||||||
pw = PrintWrapper(printer=printer)
|
pw = PrintWrapper(printer=printer)
|
||||||
if set_id == SetIds.ACU_CORE:
|
if set_id == SetIds.ACU_CORE:
|
||||||
current_idx = 0
|
mppt_mode = hk_data[0]
|
||||||
fmt_str = "!B"
|
current_idx = 1
|
||||||
inc_len = struct.calcsize(fmt_str)
|
|
||||||
mppt_mode = struct.unpack(
|
|
||||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
|
||||||
)[0]
|
|
||||||
current_idx += inc_len
|
|
||||||
current_idx, currents = gen_six_entry_u16_list(
|
current_idx, currents = gen_six_entry_u16_list(
|
||||||
hk_data=hk_data, current_idx=current_idx
|
hk_data=hk_data, current_idx=current_idx
|
||||||
)
|
)
|
||||||
@ -373,11 +389,11 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
)
|
)
|
||||||
if set_id == SetIds.ACU_AUX:
|
if set_id == SetIds.ACU_AUX:
|
||||||
current_idx = 0
|
current_idx = 0
|
||||||
fmt_str = "!HHH"
|
fmt_str = "!BBB"
|
||||||
inc_len = struct.calcsize(fmt_str)
|
inc_len = struct.calcsize(fmt_str)
|
||||||
(dac_enb0, dac_enb1, dac_enb2) = struct.unpack(
|
enb_tuple = struct.unpack(fmt_str, hk_data[current_idx : current_idx + inc_len])
|
||||||
fmt_str, hk_data[current_idx : current_idx + inc_len]
|
(dac_enb0, dac_enb1, dac_enb2) = enb_tuple
|
||||||
)
|
dac_enb_str = ["on" if entry == 1 else "off" for entry in enb_tuple]
|
||||||
current_idx += inc_len
|
current_idx += inc_len
|
||||||
current_idx, dac_channels_raw = gen_six_entry_u16_list(
|
current_idx, dac_channels_raw = gen_six_entry_u16_list(
|
||||||
hk_data=hk_data, current_idx=current_idx
|
hk_data=hk_data, current_idx=current_idx
|
||||||
@ -391,8 +407,9 @@ def handle_acu_hk_data(printer: FsfwTmTcPrinter, set_id: int, hk_data: bytes):
|
|||||||
dev_parser = DevicesInfoParser()
|
dev_parser = DevicesInfoParser()
|
||||||
current_idx = dev_parser.parse(hk_data=hk_data, current_idx=current_idx)
|
current_idx = dev_parser.parse(hk_data=hk_data, current_idx=current_idx)
|
||||||
pw.dlog("Received ACU Aux HK. Voltages in mV, currents in mA")
|
pw.dlog("Received ACU Aux HK. Voltages in mV, currents in mA")
|
||||||
|
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
f"DAC Enable States: DAC 0 {dac_enb0} | DAC 1 {dac_enb1} | DAC 2 {dac_enb2}"
|
f"DAC Enable States: DAC 0 {dac_enb_str[0]} | DAC 1 {dac_enb_str[1]} | DAC 2 {dac_enb_str[2]}"
|
||||||
)
|
)
|
||||||
pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}")
|
pw.dlog(f"Boot Cause {boot_cause} | Reset Cause {reset_cause}")
|
||||||
pw.dlog(
|
pw.dlog(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user