scex continued
This commit is contained in:
parent
1df9b0a91a
commit
dbae41cb58
@ -16,10 +16,10 @@ class OpCodes:
|
|||||||
PING = ["0", "ping"]
|
PING = ["0", "ping"]
|
||||||
ION_CMD = ["1", "ion"]
|
ION_CMD = ["1", "ion"]
|
||||||
TEMP_CMD = ["2", "temp"]
|
TEMP_CMD = ["2", "temp"]
|
||||||
EXP_STATUS_CMD = ["3", "expStatus"]
|
EXP_STATUS_CMD = ["3", "expstatus"]
|
||||||
|
|
||||||
ONE_CELLS_CMD = ["4", "oneCell"]
|
ONE_CELLS_CMD = ["4", "onecell"]
|
||||||
ALL_CELLS_CMD = ["5", "allCells"]
|
ALL_CELLS_CMD = ["5", "allcells"]
|
||||||
FRAM = ["6", "fram"]
|
FRAM = ["6", "fram"]
|
||||||
|
|
||||||
|
|
||||||
@ -131,7 +131,6 @@ def pack_scex_cmds(tc_queue: TcQueueT, op_code: str):
|
|||||||
if USE_SCEX_CONF_FILE:
|
if USE_SCEX_CONF_FILE:
|
||||||
with open("template/scex_conf.json") as json_file:
|
with open("template/scex_conf.json") as json_file:
|
||||||
json_data = json.load(json_file)
|
json_data = json.load(json_file)
|
||||||
# print(json_data)
|
|
||||||
first_dac = json_data["first_dac"]
|
first_dac = json_data["first_dac"]
|
||||||
last_dac = json_data["last_dac"]
|
last_dac = json_data["last_dac"]
|
||||||
res_switch1 = json_data["res_switch1"]
|
res_switch1 = json_data["res_switch1"]
|
||||||
@ -141,7 +140,7 @@ def pack_scex_cmds(tc_queue: TcQueueT, op_code: str):
|
|||||||
dac_weight3 = json_data["dac_weight3"]
|
dac_weight3 = json_data["dac_weight3"]
|
||||||
|
|
||||||
# in app_data
|
# in app_data
|
||||||
app_data.extend(struct.pack("!H", first_dac))
|
# app_data.extend(struct.pack("!H", first_dac))
|
||||||
append_16_bit_val(packet=app_data, val=first_dac[cn])
|
append_16_bit_val(packet=app_data, val=first_dac[cn])
|
||||||
append_16_bit_val(packet=app_data, val=last_dac[cn])
|
append_16_bit_val(packet=app_data, val=last_dac[cn])
|
||||||
append_16_bit_val(packet=app_data, val=res_switch1[cn])
|
append_16_bit_val(packet=app_data, val=res_switch1[cn])
|
||||||
@ -154,6 +153,42 @@ def pack_scex_cmds(tc_queue: TcQueueT, op_code: str):
|
|||||||
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ONE_CELLS_CMD, app_data)
|
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ONE_CELLS_CMD, app_data)
|
||||||
tc_queue.appendleft(command.pack_command_tuple())
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
|
||||||
|
if op_code in OpCodes.ALL_CELLS_CMD:
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, Info.ALL_CELLS_CMD))
|
||||||
|
app_data = bytearray()
|
||||||
|
|
||||||
|
# cell number
|
||||||
|
cn = 0
|
||||||
|
if USE_SCEX_CONF_FILE:
|
||||||
|
with open("template/scex_conf.json") as json_file:
|
||||||
|
json_data = json.load(json_file)
|
||||||
|
first_dac = json_data["first_dac"]
|
||||||
|
last_dac = json_data["last_dac"]
|
||||||
|
res_switch1 = json_data["res_switch1"]
|
||||||
|
res_switch2 = json_data["res_switch2"]
|
||||||
|
dac_weight1 = json_data["dac_weight1"]
|
||||||
|
dac_weight2 = json_data["dac_weight2"]
|
||||||
|
dac_weight3 = json_data["dac_weight3"]
|
||||||
|
|
||||||
|
# in app_data
|
||||||
|
# app_data.extend(struct.pack("!H", first_dac))
|
||||||
|
append_16_bit_val(packet=app_data, val=first_dac[cn])
|
||||||
|
append_16_bit_val(packet=app_data, val=last_dac[cn])
|
||||||
|
append_16_bit_val(packet=app_data, val=res_switch1[cn])
|
||||||
|
append_16_bit_val(packet=app_data, val=res_switch2[cn])
|
||||||
|
|
||||||
|
app_data.append(dac_weight1[cn])
|
||||||
|
app_data.append(dac_weight2[cn])
|
||||||
|
app_data.append(dac_weight3[cn])
|
||||||
|
|
||||||
|
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.ALL_CELLS_CMD, app_data)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
|
||||||
|
if op_code in OpCodes.FRAM:
|
||||||
|
tc_queue.appendleft((QueueCommands.PRINT, Info.FRAM))
|
||||||
|
app_data = bytes([0])
|
||||||
|
command = generate_action_command(SCEX_HANDLER_ID, ActionIds.FRAM, app_data)
|
||||||
|
tc_queue.appendleft(command.pack_command_tuple())
|
||||||
|
|
||||||
def append_16_bit_val(packet: bytearray, val: int):
|
def append_16_bit_val(packet: bytearray, val: int):
|
||||||
packet.append((val >> 8) & 0xFF)
|
packet.append((val >> 8) & 0xFF)
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
"res_switch2": [15650, 15650, 15650, 13400, 15650, 13400, 13400, 13400, 13400, 13400],
|
"res_switch2": [15650, 15650, 15650, 13400, 15650, 13400, 13400, 13400, 13400, 13400],
|
||||||
"dac_weight1": [35, 35, 35, 35, 35, 37, 37, 37, 37, 37],
|
"dac_weight1": [35, 35, 35, 35, 35, 37, 37, 37, 37, 37],
|
||||||
"dac_weight2": [30, 30, 30, 50, 30, 28, 28, 28, 28, 28],
|
"dac_weight2": [30, 30, 30, 50, 30, 28, 28, 28, 28, 28],
|
||||||
"dac_weight3": [35, 35, 35, 35, 35, 35, 35, 35, 35, 35],
|
"dac_weight3": [35, 35, 35, 35, 35, 35, 35, 35, 35, 35]
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user