Power Command Updates #110
@ -464,6 +464,8 @@ def handle_get_param_data_reply(
|
||||
pdu_config_table_handler(pw, custom_data)
|
||||
elif obj_id.as_bytes == ACU_HANDLER_ID:
|
||||
acu_config_table_handler(pw, custom_data)
|
||||
elif obj_id.as_bytes == P60_DOCK_HANDLER:
|
||||
p60_dock_config_table_handler(pw, custom_data)
|
||||
|
||||
|
||||
def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
@ -512,6 +514,42 @@ def acu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
pw.dlog(f"{'ov_mode'.ljust(15)}: {ov_mode}")
|
||||
|
||||
|
||||
def p60_dock_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||
ch_names = parse_name_list(custom_data[0:0x68], 13)
|
||||
out_on_cnt = unpack_array_in_data(custom_data, 0x76, 2, 13, "H")
|
||||
out_off_cnt = unpack_array_in_data(custom_data, 0x90, 2, 13, "H")
|
||||
init_out_norm = unpack_array_in_data(custom_data, 0xAA, 1, 13, "B")
|
||||
init_out_safe = unpack_array_in_data(custom_data, 0xB7, 1, 13, "B")
|
||||
init_on_dly = unpack_array_in_data(custom_data, 0xC4, 2, 13, "H")
|
||||
init_off_dly = unpack_array_in_data(custom_data, 0xDE, 2, 13, "H")
|
||||
pw.dlog(f"Ch Names: {ch_names}")
|
||||
pw.dlog(f"{'out_on_cnt'.ljust(15)}: {out_on_cnt}")
|
||||
pw.dlog(f"{'out_off_cnt'.ljust(15)}: {out_off_cnt}")
|
||||
pw.dlog(f"{'init_out_norm'.ljust(15)}: {init_out_norm}")
|
||||
pw.dlog(f"{'init_out_safe'.ljust(15)}: {init_out_safe}")
|
||||
pw.dlog(f"{'init_on_dly'.ljust(15)}: {init_on_dly}")
|
||||
pw.dlog(f"{'init_off_dly'.ljust(15)}: {init_off_dly}")
|
||||
|
||||
|
||||
def parse_name_list(data: bytes, name_len: int):
|
||||
ch_list = []
|
||||
idx = 0
|
||||
while len(ch_list) < name_len:
|
||||
next_byte = data[idx]
|
||||
if next_byte != 0:
|
||||
string_end_found = False
|
||||
string_end_idx = idx
|
||||
while not string_end_found:
|
||||
string_end_idx += 1
|
||||
if data[string_end_idx] == 0:
|
||||
string_end_found = True
|
||||
name = data[idx:string_end_idx].decode()
|
||||
ch_list.append(name)
|
||||
idx += len(name)
|
||||
idx += 1
|
||||
return ch_list
|
||||
|
||||
|
||||
def unpack_array_in_data(
|
||||
data: bytes, start_addr: int, width: int, entries: int, struct_spec: str
|
||||
) -> List:
|
||||
|
Loading…
Reference in New Issue
Block a user