update gomspace commands

This commit is contained in:
2022-09-01 16:58:31 +02:00
parent abecbe4401
commit e162e5c51b
16 changed files with 382 additions and 215 deletions

View File

@ -461,14 +461,22 @@ def handle_get_param_data_reply(
elif action_id == GomspaceDeviceActionIds.REQUEST_CONFIG_TABLE:
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:
pdu_config_table_handler(pw, custom_data)
pdu_config_table_handler(pw, custom_data, obj_id)
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):
def pdu_config_table_handler(
pw: PrintWrapper, custom_data: bytes, obj_id: ObjectIdBase
):
if obj_id.as_bytes == PDU_1_HANDLER_ID:
pw.dlog("[tcs, syrlinks, str, mgt, sus-n, scex, ploc, acs-a, unused]")
elif obj_id.as_bytes == PDU_2_HANDLER_ID:
pw.dlog(
"[obc, pl-pcdu-bat-nom, rw, heaters, sus-r, sa-depl, pl-pcdu-bat-red, acs-b, pl-cam]"
)
out_on_cnt = unpack_array_in_data(custom_data, 0x52, 2, 9, "H")
out_off_cnt = unpack_array_in_data(custom_data, 0x64, 2, 9, "H")
init_out_norm = unpack_array_in_data(custom_data, 0x76, 1, 9, "B")
@ -476,6 +484,11 @@ def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
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")
safe_off_dly = unpack_array_in_data(custom_data, 0xAE, 1, 9, "B")
cur_lu_lim = unpack_array_in_data(custom_data, 0xB8, 2, 9, "H")
cur_lim = unpack_array_in_data(custom_data, 0xCA, 2, 9, "H")
cur_ema = unpack_array_in_data(custom_data, 0xDC, 2, 9, "H")
wdt_can_rst = custom_data[0x127]
wdt_can = struct.unpack(f"{OBC_ENDIANNESS}I", custom_data[0x12C : 0x12C + 4])[0]
batt_hwmax = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x11C : 0x11C + 2])[0]
batt_max = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x11E : 0x11E + 2])[0]
batt_norm = struct.unpack(f"{OBC_ENDIANNESS}H", custom_data[0x120 : 0x120 + 2])[0]
@ -488,11 +501,16 @@ def pdu_config_table_handler(pw: PrintWrapper, custom_data: bytes):
pw.dlog(f"{'init_on_dly'.ljust(15)}: {init_on_dly}")
pw.dlog(f"{'init_off_dly'.ljust(15)}: {init_off_dly}")
pw.dlog(f"{'safe_off_dly'.ljust(15)}: {safe_off_dly}")
pw.dlog(f"{'cur_lu_lim'.ljust(15)}: {cur_lu_lim}")
pw.dlog(f"{'cur_lim'.ljust(15)}: {cur_lim}")
pw.dlog(f"{'cur_ema'.ljust(15)}: {cur_ema}")
pw.dlog(f"{'batt_hwmax'.ljust(15)}: {batt_hwmax}")
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}")
pw.dlog(f"{'batt_crit'.ljust(15)}: {batt_crit}")
pw.dlog(f"{'wdt_can_rst'.ljust(15)}: {wdt_can_rst}")
pw.dlog(f"{'wdt_can'.ljust(15)}: {wdt_can}")
def acu_config_table_handler(pw: PrintWrapper, custom_data: bytes):