New SCEX commands #103

Merged
muellerr merged 21 commits from irini into main 2022-07-13 15:34:00 +02:00
2 changed files with 34 additions and 2 deletions
Showing only changes of commit d7ee5a2229 - Show all commits

View File

@ -13,6 +13,7 @@ class OpCodes:
class ActionIds(enum.IntEnum): class ActionIds(enum.IntEnum):
PING = 7 PING = 7
ION_CMD = 4
class Info: class Info:
@ -24,6 +25,13 @@ def add_scex_cmds(cmd_dict: ServiceOpCodeDictT):
add_op_code_entry( add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.PING, info=Info.PING op_code_dict=op_code_dict, keys=OpCodes.PING, info=Info.PING
) )
# ion
op_code_dict = dict()
add_op_code_entry(
op_code_dict=op_code_dict, keys=OpCodes.ION, info=Info.ION
)
add_service_op_code_entry( add_service_op_code_entry(
srv_op_code_dict=cmd_dict, srv_op_code_dict=cmd_dict,
name=CustomServiceList.SCEX.value, name=CustomServiceList.SCEX.value,
@ -32,11 +40,35 @@ def add_scex_cmds(cmd_dict: ServiceOpCodeDictT):
) )
"""
#in app_data
app_data.extend(struct.pack("!H", first_dac))
append_16_bit_val(packet=packet, val=CFG.exp_cfg.first_dac[cn])
append_16_bit_val(packet=packet, val=CFG.exp_cfg.last_dac[cn])
append_16_bit_val(packet=packet, val=CFG.exp_cfg.res_switch1[cn])
append_16_bit_val(packet=packet, val=CFG.exp_cfg.res_switch2[cn])
packet.append(CFG.exp_cfg.dac_weight1[cn])
packet.append(CFG.exp_cfg.dac_weight2[cn])
packet.append(CFG.exp_cfg.dac_weight3[cn])
"""
def pack_scex_cmds(tc_queue: TcQueueT, op_code: str): def pack_scex_cmds(tc_queue: TcQueueT, op_code: str):
if op_code in OpCodes.PING: if op_code in OpCodes.PING:
tc_queue.appendleft((QueueCommands.PRINT, Info.PING)) tc_queue.appendleft((QueueCommands.PRINT, Info.PING))
app_data = bytes([0]) app_data = bytes([0])
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.PING, app_data) command = generate_action_command(SCEX_HANDLER_ID, ActionIds.PING, app_data)
tc_queue.appendleft(command.pack_command_tuple()) tc_queue.appendleft(command.pack_command_tuple())
if op_code in OpCodes.ION:
tc_queue.appendleft((QueueCommands.PRINT, Info.ION))
app_data = bytes([0])
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ION, app_data)
tc_queue.appendleft(command.pack_command_tuple())
pass # one cell
if op_code in OpCodes.ION:
tc_queue.appendleft((QueueCommands.PRINT, Info.ION))
app_data = bytearray([0])
#todo cell number
app_data.extend(struct.pack("!H", first_dac)) #aus json holen
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ION, app_data)
tc_queue.appendleft(command.pack_command_tuple())

@ -1 +1 @@
Subproject commit f87032a2d15076641dee71da22752613ce5355dd Subproject commit b8e86ddd7cdecf1348f60d9fff08964493a93356