acu hk parsing
This commit is contained in:
parent
ce837353ca
commit
cd21267796
@ -461,40 +461,55 @@ def handle_get_param_data_reply(
|
|||||||
elif action_id == GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE:
|
elif action_id == GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE:
|
||||||
print(f"Received config table with size {len(custom_data)} for object {obj_id}")
|
print(f"Received config table with size {len(custom_data)} for object {obj_id}")
|
||||||
if obj_id.as_bytes == PDU_1_HANDLER_ID or obj_id.as_bytes == PDU_2_HANDLER_ID:
|
if obj_id.as_bytes == PDU_1_HANDLER_ID or obj_id.as_bytes == PDU_2_HANDLER_ID:
|
||||||
out_on_cnt = unpack_array_in_data(custom_data, 0x52, 2, 9, "H")
|
pdu_config_table_handler(pw, custom_data)
|
||||||
out_off_cnt = unpack_array_in_data(custom_data, 0x64, 2, 9, "H")
|
elif obj_id.as_bytes == ACU_HANDLER_ID:
|
||||||
init_out_norm = unpack_array_in_data(custom_data, 0x76, 1, 9, "B")
|
acu_config_table_handler(pw, custom_data)
|
||||||
init_out_safe = unpack_array_in_data(custom_data, 0x80, 1, 9, "B")
|
|
||||||
init_on_dly = unpack_array_in_data(custom_data, 0x8A, 2, 9, "H")
|
|
||||||
init_off_dly = unpack_array_in_data(custom_data, 0x9C, 2, 9, "H")
|
def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||||
safe_off_dly = unpack_array_in_data(custom_data, 0xAE, 1, 9, "B")
|
out_on_cnt = unpack_array_in_data(custom_data, 0x52, 2, 9, "H")
|
||||||
batt_hwmax = struct.unpack(
|
out_off_cnt = unpack_array_in_data(custom_data, 0x64, 2, 9, "H")
|
||||||
f"{OBC_ENDIANNESS}H", custom_data[0x11C : 0x11C + 2]
|
init_out_norm = unpack_array_in_data(custom_data, 0x76, 1, 9, "B")
|
||||||
)[0]
|
init_out_safe = unpack_array_in_data(custom_data, 0x80, 1, 9, "B")
|
||||||
batt_max = struct.unpack(
|
init_on_dly = unpack_array_in_data(custom_data, 0x8A, 2, 9, "H")
|
||||||
f"{OBC_ENDIANNESS}H", custom_data[0x11E : 0x11E + 2]
|
init_off_dly = unpack_array_in_data(custom_data, 0x9C, 2, 9, "H")
|
||||||
)[0]
|
safe_off_dly = unpack_array_in_data(custom_data, 0xAE, 1, 9, "B")
|
||||||
batt_norm = struct.unpack(
|
batt_hwmax = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x11C : 0x11C + 2])[0]
|
||||||
f"{OBC_ENDIANNESS}H", custom_data[0x120 : 0x120 + 2]
|
batt_max = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x11E : 0x11E + 2])[0]
|
||||||
)[0]
|
batt_norm = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x120 : 0x120 + 2])[0]
|
||||||
batt_safe = struct.unpack(
|
batt_safe = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x122 : 0x122 + 2])[0]
|
||||||
f"{OBC_ENDIANNESS}H", custom_data[0x122 : 0x122 + 2]
|
batt_crit = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x124 : 0x124 + 2])[0]
|
||||||
)[0]
|
pw.dlog(f"{'out_on_cnt'.ljust(15)}: {out_on_cnt}")
|
||||||
batt_crit = struct.unpack(
|
pw.dlog(f"{'out_off_cnt'.ljust(15)}: {out_off_cnt}")
|
||||||
f"{OBC_ENDIANNESS}H", custom_data[0x124 : 0x124 + 2]
|
pw.dlog(f"{'init_out_norm'.ljust(15)}: {init_out_norm}")
|
||||||
)[0]
|
pw.dlog(f"{'init_out_safe'.ljust(15)}: {init_out_safe}")
|
||||||
pw.dlog(f"{'out_on_cnt'.ljust(15)}: {out_on_cnt}")
|
pw.dlog(f"{'init_on_dly'.ljust(15)}: {init_on_dly}")
|
||||||
pw.dlog(f"{'out_off_cnt'.ljust(15)}: {out_off_cnt}")
|
pw.dlog(f"{'init_off_dly'.ljust(15)}: {init_off_dly}")
|
||||||
pw.dlog(f"{'init_out_norm'.ljust(15)}: {init_out_norm}")
|
pw.dlog(f"{'safe_off_dly'.ljust(15)}: {safe_off_dly}")
|
||||||
pw.dlog(f"{'init_out_safe'.ljust(15)}: {init_out_safe}")
|
pw.dlog(f"{'batt_hwmax'.ljust(15)}: {batt_hwmax}")
|
||||||
pw.dlog(f"{'init_on_dly'.ljust(15)}: {init_on_dly}")
|
pw.dlog(f"{'batt_max'.ljust(15)}: {batt_max}")
|
||||||
pw.dlog(f"{'init_off_dly'.ljust(15)}: {init_off_dly}")
|
pw.dlog(f"{'batt_norm'.ljust(15)}: {batt_norm}")
|
||||||
pw.dlog(f"{'safe_off_dly'.ljust(15)}: {safe_off_dly}")
|
pw.dlog(f"{'batt_safe'.ljust(15)}: {batt_safe}")
|
||||||
pw.dlog(f"{'batt_hwmax'.ljust(15)}: {batt_hwmax}")
|
pw.dlog(f"{'batt_crit'.ljust(15)}: {batt_crit}")
|
||||||
pw.dlog(f"{'batt_max'.ljust(15)}: {batt_max}")
|
|
||||||
pw.dlog(f"{'batt_norm'.ljust(15)}: {batt_norm}")
|
|
||||||
pw.dlog(f"{'batt_safe'.ljust(15)}: {batt_safe}")
|
def acu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
|
||||||
pw.dlog(f"{'batt_crit'.ljust(15)}: {batt_crit}")
|
mppt_mode = custom_data[0]
|
||||||
|
mppt_delta_mode = custom_data[1]
|
||||||
|
vboost_list = unpack_array_in_data(custom_data, 0x02, 2, 6, "H")
|
||||||
|
vbat_max_hi = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x10 : 0x10 + 2])[0]
|
||||||
|
vbat_max_lo = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x12 : 0x12 + 2])[0]
|
||||||
|
mppt_period = struct.unpack(f"{OBC_ENDIANNESS}I", custom_data[0x14 : 0x14 + 4])[0]
|
||||||
|
max_dv = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x18 : 0x18 + 2])[0]
|
||||||
|
ov_mode = custom_data[0x1A]
|
||||||
|
pw.dlog(f"{'mppt_mode'.ljust(15)}: {mppt_mode}")
|
||||||
|
pw.dlog(f"{'mppt_delta_mode'.ljust(15)}: {mppt_delta_mode}")
|
||||||
|
pw.dlog(f"{'vboost_list'.ljust(15)}: {vboost_list}")
|
||||||
|
pw.dlog(f"{'vbat_max_hi'.ljust(15)}: {vbat_max_hi}")
|
||||||
|
pw.dlog(f"{'vbat_max_lo'.ljust(15)}: {vbat_max_lo}")
|
||||||
|
pw.dlog(f"{'mppt_period'.ljust(15)}: {mppt_period}")
|
||||||
|
pw.dlog(f"{'max_dv'.ljust(15)}: {max_dv}")
|
||||||
|
pw.dlog(f"{'ov_mode'.ljust(15)}: {ov_mode}")
|
||||||
|
|
||||||
|
|
||||||
def unpack_array_in_data(
|
def unpack_array_in_data(
|
||||||
|
Loading…
Reference in New Issue
Block a user