морда контроля нарисована

This commit is contained in:
danil_tim
2025-02-07 13:16:46 +03:00
parent 179b1ebd05
commit 3524937a90
4 changed files with 93 additions and 277 deletions

View File

@@ -10,7 +10,7 @@ func _on_read_ems_g():
for i_input in 16:
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 1+i_input)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+0xA])
for i_output in range(46, 62):
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 1+i_output)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+4, Constants.BASE_PORTS.EMS_G+8])
@@ -27,7 +27,7 @@ func _on_sync():
port0x124 = Constants.EMS_G_PORT_DATA_HOLDER[index][1][key]
for row in 16:
if (port0x124 & (1 << row)) != 0:
var chk_btn = node_select1.get_node2(tmp_device_mode-45, row+3).get_child(1, false)
var chk_btn = node_select1.get_node2(tmp_device_mode-45, row+3).get_child(1, false)
chk_btn.button_pressed =true
if key == 0x128:
port0x128 = Constants.EMS_G_PORT_DATA_HOLDER[index][1][key]
@@ -52,24 +52,24 @@ func _ready() -> void:
else:
column.append(Constants.TableNode)
EMS_G_TABLE.append(column)
draw_tabl(node_select1, EMS_G_TABLE, EMS_G_TABLE.size())
node_select1.get_node2(1, 1).text = 'x3_ВЫХ:GND'
node_select1.get_node2(0, 2).text = 'x3_ВХ :GND'
for i in Constants.INPUT_EMS_G.size():
node_select1.get_node2(0, i+shift+1).text = Constants.INPUT_EMS_G[i]
for i in Constants.OUT_EMS_G.size():
node_select1.get_node2(i+shift, 1).text = Constants.OUT_EMS_G[i][1]
for i in EMS_G_TABLE[0].size()-shift:
var list = node_select1.get_node2(i+shift, 0)
list.set_meta('device', Constants.OUT_EMS_G[i][0])
list.connect('item_selected', Callable(self, 'on_mode_link').bind(list))
for k in Constants.OUT_x128.size():
list.add_item(Constants.OUT_x128[k])
list.add_item(Constants.OUT_x128[k])
var columns_min_size: Array
for i in EMS_G_TABLE[0].size():
if i < 2:
@@ -77,13 +77,13 @@ func _ready() -> void:
else:
columns_min_size.append(80)
node_select1.set_columns_min_size(columns_min_size)
var parrent_NODE2 = get_parent().get_parent()
parrent_NODE2.connect('read_ems_g_start', Callable(self, '_on_read_ems_g'))
parrent_NODE2.connect('read_ems_g_finish', Callable(self, '_on_sync'))
Network.connect('yau_receive', Callable(self, '_on_data_received'))
create_link_button(node_select1, shift+1, 16+shift+1, shift, 16+shift)
func draw_tabl(tbl, row: Array, count_row: int):
for i_row in count_row:
@@ -96,23 +96,23 @@ func _on_data_received(data_from_yau_07):
var out_blank: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_BLANK_PRD)
var out_imp: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_IMPULS_PRD)
var parent_node2 = get_parent().get_parent()
process_sockets_vert(in_blank, in_imp, 16, 1, parent_node2)
process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2)
#process_sockets_vert(in_blank, in_imp, 16, 1, parent_node2)
#process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2)
func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_node2: Node):
for i in count:
var socket_status = node_select1.get_node2(col+i, shift).get_child(1, false)
var frame_type = Constants.Frame.WORK
if (blank & (1 << i)) != 0:
frame_type = Constants.Frame.CONSTANT
elif (imp & (1 << i)) != 0:
frame_type = Constants.Frame.VARIABLE
set_frame(socket_status, frame_type)
if i == 1:
set_frame(get_specific_node(parent_node2, 5), frame_type)
if i == 2:
@@ -129,14 +129,14 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
for i in count:
var socket_status = node_select1.get_node2(col, i + shift+1).get_child(1, false)
var frame_type = Constants.Frame.WORK
if (blank & (1 << i)) != 0:
frame_type = Constants.Frame.CONSTANT
elif (imp & (1 << i)) != 0:
frame_type = Constants.Frame.VARIABLE
set_frame(socket_status, frame_type)
if i == 1:
set_frame(get_specific_node(parent_node2, 1), frame_type)
var CI_2_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 6).get_child(1)
@@ -170,7 +170,7 @@ func create_link_button(node, count_rows_sart: int, count_rows_end: int, coln_st
for i_colum in 16:
META_EMS_G.append([INPUT+i_row, OUTPUT+i_colum])
button_link_meta[OUTPUT+i_colum] = 0
var count_register = 0
for i_row in range(count_rows_sart, count_rows_end):
for i_col in range (coln_start, coln_end):
@@ -188,7 +188,7 @@ func on_mouse_entered(meta_area):
var device = meta_area.get_meta('device')
var y = device[0] + 1
var x = device[1] - 45
for i_y in 18:
for i_x in 18:
if i_y <= y and i_x <= x and i_y == y:
@@ -207,9 +207,9 @@ func on_mode_link(mode, list):
var meta = list.get_meta('device')
var address_port_wr = Constants.BASE_PORTS.EMS_G+2
Network.write_port_isa(address_port_wr, meta) # Отправка команды
## Формирование команды для отправкы команды на устройство
address_port_wr = Constants.BASE_PORTS.EMS_G+8
address_port_wr = Constants.BASE_PORTS.EMS_G+8
var set_mode = 0x0000 if mode == 0 else 0x2000 if mode == 1 else 0x4000 if mode == 2 else 0x8000
Network.write_port_isa(address_port_wr, set_mode)