add module fs
This commit is contained in:
@@ -14,41 +14,62 @@ var isa: Array = []
|
||||
|
||||
func _ready() -> void:
|
||||
# Таблица УКП_1
|
||||
node_select1 = $TabContainer/PRD/scroll1/table1
|
||||
node_select1 = $TabContainer/PRD/table_ukp_1
|
||||
draw_tabl(node_select1, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
|
||||
node_select1.set_columns_min_size([120, 120])
|
||||
node_select1.set_node_text(0, 0, 'Мощность')
|
||||
node_select1.set_node_text(1, 0, 'Температура')
|
||||
|
||||
# Таблица УКП_2
|
||||
node_select2 = $TabContainer/PRD/scroll2/table2
|
||||
node_select2 = $TabContainer/PRD/table_ukp_2
|
||||
draw_tabl(node_select2, Constants.ROWS_UKP2_DATA, Constants.ROWS_UKP2_DATA.size())
|
||||
node_select2.set_columns_min_size([120, 120])
|
||||
node_select2.set_node_text(0, 0, 'Мощность')
|
||||
node_select2.set_node_text(1, 0, 'Температура')
|
||||
|
||||
# Выбор прибора для подключения
|
||||
var node_select_device = $TabContainer/PRD/select_dev/select_dev
|
||||
var node_select_device = $TabContainer/PRD/select_dev
|
||||
draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size())
|
||||
var get_select_device = node_select_device.get_node2(1, 0)
|
||||
|
||||
# Заполнение адресов
|
||||
for i_addr in Constants.ADDRESSES.size():
|
||||
get_select_device.add_item(Constants.ADDRESSES[i_addr][0])
|
||||
get_select_device.set_item_metadata(i_addr, Constants.ADDRESSES[i_addr].slice(1,4))
|
||||
get_select_device.set_item_metadata(i_addr, Constants.ADDRESSES[i_addr].slice(1,7))
|
||||
get_select_device.connect('item_selected', Callable(self, 'on_btn_select'))
|
||||
node_select_device.get_node2(0,0).text = 'ПРИБОР'
|
||||
node_select_device.set_columns_min_size([100, 100])
|
||||
|
||||
$TabContainer/PRD/Zapret.connect('toggled', Callable(self, '_on_zapret').bind($TabContainer/PRD/Zapret))
|
||||
$TabContainer/PRD/Zapret2.connect('toggled', Callable(self, '_on_zapret').bind($TabContainer/PRD/Zapret2))
|
||||
## Заполненение списка направления луча
|
||||
for key in Constants.RAY_DICT:
|
||||
$TabContainer/PRD/Grid/Ray_set.add_item(key)
|
||||
$TabContainer/PRD/Grid/Ray_set2.add_item(key)
|
||||
|
||||
draw_panel_prd(Constants.ADDRESSES[0][3])
|
||||
|
||||
$TabContainer/PRD/Grid/Zapret.connect('toggled', Callable(self, '_on_zapret').bind($TabContainer/PRD/Grid/Zapret))
|
||||
$TabContainer/PRD/Grid/Zapret2.connect('toggled', Callable(self, '_on_zapret').bind($TabContainer/PRD/Grid/Zapret2))
|
||||
$TabContainer/PRD/Grid/Ray_set.connect('item_selected', Callable(self, '_on_btn_ray'))
|
||||
$TabContainer/PRD/Grid/Ray_set2.connect('item_selected', Callable(self, '_on_btn_ray2'))
|
||||
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
Network.connect('yau_read_isa', Callable(self, '_on_read_isa'))
|
||||
|
||||
|
||||
func draw_panel_prd(mode) -> void:
|
||||
for node_path in Constants.NODE_MAP:
|
||||
var index = Constants.NODE_MAP[node_path]
|
||||
var node = get_node(node_path)
|
||||
if node:
|
||||
var value = node.get("text")
|
||||
if value != null:
|
||||
node.text = Constants.SIGNS_PRD[mode][index]
|
||||
else:
|
||||
node.fname = Constants.SIGNS_PRD[mode][index]
|
||||
|
||||
|
||||
## From Network status about yau-07
|
||||
func _on_yau_status(yau_status):
|
||||
func _on_yau_status(yau_status: bool) -> void:
|
||||
if yau_status:
|
||||
$TabContainer/ControlPanel/sockets/ref_A26/light_ind.button_pressed = true
|
||||
$TabContainer/ControlPanel/sockets/ref_A26/light_ind.disabled = false
|
||||
@@ -61,14 +82,14 @@ func _on_yau_status(yau_status):
|
||||
flag_yau_control = false
|
||||
|
||||
|
||||
func _on_read_isa(unit_isa_ports):
|
||||
func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
var isa_data: Dictionary = {}
|
||||
for key in unit_isa_ports.keys():
|
||||
isa_data[key] = unit_isa_ports[key]
|
||||
|
||||
if isa_data.has(290):
|
||||
var tmp = isa_data[290]
|
||||
isa_data.erase(290)
|
||||
if isa_data.has(0x122):
|
||||
var tmp = isa_data[0x122]
|
||||
isa_data.erase(0x122)
|
||||
|
||||
var found = false
|
||||
for i in range(Constants.EMS_G_PORT_DATA_HOLDER.size()):
|
||||
@@ -81,10 +102,16 @@ func _on_read_isa(unit_isa_ports):
|
||||
if len(Constants.EMS_G_PORT_DATA_HOLDER) == 32:
|
||||
emit_signal('read_ems_g_finish')
|
||||
$ISA.text = 'ISA: ' + str(len(Constants.EMS_G_PORT_DATA_HOLDER))
|
||||
|
||||
if isa_data.has(0x106):
|
||||
$TabContainer/PRD/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * isa_data[0x106])
|
||||
|
||||
if isa_data.has(0x108):
|
||||
$TabContainer/PRD/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * isa_data[0x108])
|
||||
|
||||
|
||||
## Рисует таблицу
|
||||
func draw_tabl(tbl, row: Array, count_row: int):
|
||||
func draw_tabl(tbl: Node, row: Array, count_row: int):
|
||||
for i_row in count_row:
|
||||
tbl.add_row(row[i_row])
|
||||
|
||||
@@ -101,6 +128,7 @@ func _on_data_received(data_from_yau_07):
|
||||
|
||||
## УГ
|
||||
#node_select1.set_node_text(2, 0, '%d' % dry_contact)
|
||||
#node_select1.set_node_text(3, 0, '%d' % DKM)
|
||||
|
||||
## SOCKETS BOARDS
|
||||
for i in 4:
|
||||
@@ -133,7 +161,6 @@ func _on_data_received(data_from_yau_07):
|
||||
else:
|
||||
node_power_ind[i].button_pressed = false
|
||||
node_power_ind[i].disabled = true
|
||||
#node_select1.set_node_text(3, 0, '%d' % DKM)
|
||||
|
||||
## УКП
|
||||
for i in range(8): ## Мощность от УКП_1
|
||||
@@ -172,6 +199,10 @@ func _on_emsg_select() -> void:
|
||||
set_tab_and_buttons(2, 'select_ems_g')
|
||||
|
||||
|
||||
func _on_mfs_select() -> void:
|
||||
set_tab_and_buttons(3, 'select_fs')
|
||||
|
||||
|
||||
func set_tab_and_buttons(tab_index: int, button_name: String) -> void:
|
||||
$TabContainer.current_tab = tab_index
|
||||
var side_panel = $Background/side_panel
|
||||
@@ -181,15 +212,16 @@ func set_tab_and_buttons(tab_index: int, button_name: String) -> void:
|
||||
button.button_pressed = (button.name == button_name)
|
||||
|
||||
|
||||
func on_btn_select(intem_from_sector):
|
||||
var node_select_device = $TabContainer/PRD/select_dev/select_dev
|
||||
func on_btn_select(intem_from_sector: int) -> void:
|
||||
var node_select_device = $TabContainer/PRD/select_dev
|
||||
var get_select_device = node_select_device.get_node2(1, 0)
|
||||
var meta = get_select_device.get_item_metadata(intem_from_sector)
|
||||
Network.on_command_change_device(meta)
|
||||
flag_mode = meta[2]
|
||||
draw_panel_prd(flag_mode)
|
||||
|
||||
|
||||
func fill_item(node, i_column: int, i_row: int, arr: Dictionary, select: int = 0):
|
||||
func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: int = 0) -> void:
|
||||
var optionbutton = node.get_node2(i_column, i_row) as OptionButton
|
||||
for key in arr.keys():
|
||||
var item_text = key + " - " + str(arr[key])
|
||||
@@ -206,3 +238,13 @@ func _on_zapret(toggled_on: bool, meta) -> void:
|
||||
|
||||
func _on_read_isa_pressed() -> void:
|
||||
Network.read_port_isa([0x122, 0x124, 0x128])
|
||||
|
||||
|
||||
## Регулировка положением луча
|
||||
func _on_btn_ray(item_from_ray: int) -> void:
|
||||
Network.write_port_isa(0x106, item_from_ray)
|
||||
Network.read_port_isa([0x106])
|
||||
|
||||
func _on_btn_ray2(item_from_ray: int) -> void:
|
||||
Network.write_port_isa(0x108, item_from_ray)
|
||||
Network.read_port_isa([0x108])
|
||||
|
||||
Reference in New Issue
Block a user