commit before merge
This commit is contained in:
@@ -62,8 +62,21 @@ func _ready() -> void:
|
||||
node_select_fs_1.get_node2(1, 3).editable = true
|
||||
node_select_fs_1.set_node_text(0, 4, 'Генератор')
|
||||
node_select_fs_1.set_node_text(0, 5, 'fpga')
|
||||
node_select_fs_1.set_node_text(0, 6, 'ВЧ тракт')
|
||||
node_select_fs_1.set_node_text(0, 7, 'Пр. питания')
|
||||
node_select_fs_1.set_node_text(0, 6, 'СИ 2 ОТ ФС')
|
||||
|
||||
var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
|
||||
draw_tabl(node_select_fs_2, Constants.ROWS_FS, Constants.ROWS_FS.size())
|
||||
node_select_fs_2.set_columns_min_size([120, 120, 150])
|
||||
node_select_fs_2.set_node_text(0, 0, 'ПРД-Н')
|
||||
node_select_fs_2.set_node_text(1, 0, 'Литера_3')
|
||||
node_select_fs_2.set_node_text(0, 1, 'Состояние')
|
||||
node_select_fs_2.set_node_text(0, 2, 'Частота')
|
||||
node_select_fs_2.get_node2(1, 2).placeholder_text = '500'
|
||||
node_select_fs_2.set_node_text(0, 3, 'Аттенюатор')
|
||||
node_select_fs_2.get_node2(1, 3).editable = true
|
||||
node_select_fs_2.set_node_text(0, 4, 'Генератор')
|
||||
node_select_fs_2.set_node_text(0, 5, 'fpga')
|
||||
node_select_fs_2.set_node_text(0, 6, 'СИ 3 ОТ ФС')
|
||||
|
||||
# Выбор прибора для подключения
|
||||
var node_select_device = $TabContainer/PRD/select_dev
|
||||
@@ -99,6 +112,7 @@ func _ready() -> void:
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
Network.connect('yau_read_isa', Callable(self, '_on_read_isa'))
|
||||
Network.connect('data_from_fs_1', Callable(self, '_on_data_fs_1'))
|
||||
Network.connect('data_from_fs_2', Callable(self, '_on_data_fs_2'))
|
||||
|
||||
node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret1'))
|
||||
node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_1'))
|
||||
@@ -111,7 +125,8 @@ func _ready() -> void:
|
||||
node_select_yau_07b_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_2'))
|
||||
node_select_yau_07b_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_fgos_2'))
|
||||
|
||||
node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status'))
|
||||
node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_1'))
|
||||
node_select_fs_2.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_2'))
|
||||
|
||||
func draw_control_panel_prd(mode) -> void:
|
||||
for node_path in Constants.NODE_MAP:
|
||||
@@ -182,11 +197,34 @@ func _on_data_fs_1(fs_1_data):
|
||||
Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_1.set_node_text(1, 5, '%.2f' % fs_1_data.decode_float(0xC) + ' °C')
|
||||
node_select_fs_1.set_node_text(1, 6, str(fs_1_data.decode_float(0x10)) + ' °C')
|
||||
node_select_fs_1.set_node_text(1, 7, str(fs_1_data.decode_float(0x14)) + ' °C')
|
||||
#$read.text = str(fs_1_data.hex_encode())
|
||||
|
||||
|
||||
|
||||
func _on_data_fs_2(fs_2_data):
|
||||
var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
|
||||
var GRP = fs_2_data.decode_u8(0x0)
|
||||
var CMD = fs_2_data.decode_u8(0x1)
|
||||
match CMD:
|
||||
Constants.CMD.READ_CARRIER:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_2.set_node_text(2, 2, str(fs_2_data.decode_u64(0xC)) + ' Гц')
|
||||
Constants.CMD.READ_ATT:
|
||||
if GRP == Constants.GROUP.RF:
|
||||
node_select_fs_2.set_node_text(2, 3, '-' + str(fs_2_data.decode_float(0x18)) + ' dB')
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_2_data.decode_u32(0xC) == 0:
|
||||
node_select_fs_2.set_node_text(2, 4, 'Включен')
|
||||
node_select_fs_2.get_node2(2, 4).modulate = Color.AQUAMARINE
|
||||
else:
|
||||
node_select_fs_2.set_node_text(2, 4, 'Выключен')
|
||||
node_select_fs_2.get_node2(2, 4).modulate = Color.CRIMSON
|
||||
Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_2.set_node_text(1, 5, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
|
||||
|
||||
|
||||
## Рисует таблицу
|
||||
func draw_tabl(tbl: Node, row: Array, count_row: int):
|
||||
for i_row in count_row:
|
||||
@@ -209,21 +247,21 @@ func _on_data_received(data_from_yau_07):
|
||||
|
||||
|
||||
## УКП
|
||||
for i in range(8): ## Мощность от УКП_1
|
||||
for i in range(6): ## Мощность от УКП_1
|
||||
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
|
||||
node_select1.set_node_text(0, i+1, '%d' % power_ukp_1)
|
||||
|
||||
for i in range(8): ## Температура от УКП_1
|
||||
for i in range(6): ## Температура от УКП_1
|
||||
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP
|
||||
node_select1.set_node_text(1, i+1, '%d °С' % TMP)
|
||||
|
||||
for i_pow in range(8): ## Мощность от УКП_2
|
||||
for i_pow in range(6): ## Мощность от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.POWER_UKP_2 + 2 * i_pow:
|
||||
var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i_pow)
|
||||
node_select2.set_node_text(0, i_pow+1, '%d' % power_ukp_2)
|
||||
|
||||
for row in range(8): ## Температура от УКП_2
|
||||
for row in range(6): ## Температура от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row:
|
||||
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP
|
||||
@@ -275,7 +313,8 @@ func on_btn_select(intem_from_sector: int) -> void:
|
||||
Network.on_command_change_device(meta)
|
||||
flag_mode = meta[2]
|
||||
draw_control_panel_prd(flag_mode)
|
||||
_on_start_fs()
|
||||
_on_start_fs_1()
|
||||
_on_start_fs_2()
|
||||
|
||||
|
||||
func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: int = 0) -> void:
|
||||
@@ -382,12 +421,23 @@ func set_bits(v, a, m):
|
||||
return (~m) & v | a & m
|
||||
|
||||
|
||||
func _on_start_fs():
|
||||
func _on_start_fs_1():
|
||||
unit_fs.start_session()
|
||||
unit_fs.base_get_current_temp()
|
||||
|
||||
|
||||
func _on_get_status(toggled_btn):
|
||||
func _on_start_fs_2():
|
||||
unit_fs.start_session()
|
||||
unit_fs.base_get_current_temp()
|
||||
|
||||
|
||||
func _on_get_status_1(toggled_btn):
|
||||
var inverted_state = not toggled_btn
|
||||
unit_fs.set_gen_state(inverted_state)
|
||||
unit_fs.get_gen_state()
|
||||
|
||||
|
||||
func _on_get_status_2(toggled_btn):
|
||||
var inverted_state = not toggled_btn
|
||||
unit_fs.set_gen_state(inverted_state)
|
||||
unit_fs.get_gen_state()
|
||||
|
||||
@@ -20,8 +20,6 @@ const ROWS_REGS_DATA: Array = [
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode]]
|
||||
const ROWS_YAU_07B: Array = [
|
||||
[TableNode, TableNode],
|
||||
@@ -30,9 +28,7 @@ const ROWS_YAU_07B: Array = [
|
||||
[TableNode, TableList],
|
||||
[TableNode, TableList],
|
||||
[TableNode, Switch],
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode],
|
||||
[TableNode, TableNode],]
|
||||
[TableNode, TableNode]]
|
||||
const ROWS_FS: Array = [
|
||||
[TableNode, TableNode, TableNode],
|
||||
[TableNode, TableNode, TableNode],
|
||||
@@ -40,9 +36,7 @@ const ROWS_FS: Array = [
|
||||
[TableNode, TableNode, TableNode],
|
||||
[TableNode, Switch, TableNode],
|
||||
[TableNode, TableNode, TableNode],
|
||||
[TableNode, TableNode, TableNode],
|
||||
[TableNode, TableNode, TableNode],
|
||||
[TableNode, TableNode, TableNode]]
|
||||
[TableNode, SocketStatus, TableNode]]
|
||||
const ADDRESSES: Array = [
|
||||
['ПРД-Н1', '10.1.1.11', 50011, MODE.PRD_H, '10.1.2.18', '10.1.2.19', ''],
|
||||
['ПРД-Н2', '10.1.1.21', 50021, MODE.PRD_H, '10.1.2.34', '10.1.2.35', ''],
|
||||
|
||||
@@ -143,6 +143,8 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
|
||||
set_frame(get_specific_node(parent_node2, 2), frame_type)
|
||||
if i == 9:
|
||||
set_frame(get_specific_node(parent_node2, 3), frame_type)
|
||||
var CI_2 = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1)
|
||||
set_frame(CI_2, frame_type)
|
||||
if i == 10:
|
||||
set_frame(get_specific_node(parent_node2, 4), frame_type)
|
||||
|
||||
@@ -151,17 +153,9 @@ func get_specific_node(parent_node2: Node, child_index: int)-> Node:
|
||||
return parent_node2.get_child(3, false).get_child(1).get_child(4).get_child(child_index).get_child(3)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
|
||||
|
||||
func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
|
||||
|
||||
func set_init():
|
||||
pass
|
||||
|
||||
|
||||
## Создает связь между кнопками
|
||||
func create_link_button(node, count_rows_sart: int, count_rows_end: int, coln_start: int, coln_end: int):
|
||||
## META_EMS_G[[Номер входа, Номер выхода]]
|
||||
|
||||
@@ -18,15 +18,24 @@ var ip_fs_1: String = Constants.ADDRESSES[0][4]
|
||||
var command_stack: Array
|
||||
var state_fs = Constants.STATE.IDLE
|
||||
var client_fs_1: StreamPeer
|
||||
var peerstream: PacketPeer
|
||||
var peerstream_fs_1: PacketPeer
|
||||
|
||||
var ip_fs_2: String = Constants.ADDRESSES[0][5]
|
||||
var command_stack_fs_2: Array
|
||||
var state_fs_2 = Constants.STATE.IDLE
|
||||
var client_fs_2: StreamPeer
|
||||
var peerstream_fs_2: PacketPeer
|
||||
|
||||
signal yau_status_line(_status) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
signal yau_receive(_data_from_yau)
|
||||
signal yau_read_isa(_unit_isa_ports)
|
||||
|
||||
signal data_send()
|
||||
signal data_send_2()
|
||||
signal data_from_fs_1(data:PackedByteArray)
|
||||
signal data_from_fs_2(data:PackedByteArray)
|
||||
signal port_opened(port_name: String)
|
||||
signal port_opened_2(port_name: String)
|
||||
signal port_closed(port_name: String)
|
||||
signal port_error(error_str: String)
|
||||
|
||||
@@ -58,7 +67,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
|
||||
func poll_receive_fs(client: StreamPeerTCP):
|
||||
client.poll()
|
||||
var peer = peerstream.get_stream_peer()
|
||||
var peer = peerstream_fs_1.get_stream_peer()
|
||||
# Проверяем, существует ли соединение
|
||||
if not peer:
|
||||
emit_signal("port_error", ip_fs_1)
|
||||
@@ -77,6 +86,27 @@ func poll_receive_fs(client: StreamPeerTCP):
|
||||
state_fs = Constants.STATE.DONE
|
||||
|
||||
|
||||
func poll_receive_fs_2(client: StreamPeerTCP):
|
||||
client.poll()
|
||||
var peer = peerstream_fs_2.get_stream_peer()
|
||||
# Проверяем, существует ли соединение
|
||||
if not peer:
|
||||
emit_signal("port_fs_2_error", ip_fs_2)
|
||||
return
|
||||
# Проверяем состояние подключения
|
||||
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
|
||||
emit_signal("port_closed_fs_2", ip_fs_2)
|
||||
return
|
||||
|
||||
if peer.get_available_bytes() > 0:
|
||||
var rx_data: PackedByteArray
|
||||
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
|
||||
emit_signal("data_from_fs_2", rx_data)
|
||||
emit_signal("port_opened_fs_2", ip_fs_2)
|
||||
if state_fs_2 == Constants.STATE.SEND:
|
||||
state_fs_2 = Constants.STATE.DONE
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Привязка для принятия широковещательного канала
|
||||
soc_brodcast = Socket.new()
|
||||
@@ -102,6 +132,8 @@ func _process(delta: float) -> void:
|
||||
|
||||
if client_fs_1:
|
||||
poll_receive_fs(client_fs_1)
|
||||
if client_fs_2:
|
||||
poll_receive_fs_2(client_fs_2)
|
||||
|
||||
poll_receive_yau07(soc_brodcast)
|
||||
poll_receive_yau07(soc_unicast)
|
||||
@@ -164,9 +196,10 @@ func on_command_change_device(meta_device):
|
||||
ip_address_yau = meta_device[0]
|
||||
ip_port_yau = meta_device[1]
|
||||
ip_fs_1 = meta_device[3]
|
||||
#ip_fs_2 = meta_device[4]
|
||||
ip_fs_2 = meta_device[4]
|
||||
#ip_fs_3 = meta_device[5]
|
||||
connect_fs()
|
||||
connect_fs_2()
|
||||
|
||||
|
||||
func state_machine_fs():
|
||||
@@ -185,18 +218,18 @@ func connect_fs():
|
||||
disconnect_fs(client_fs_1)
|
||||
|
||||
client_fs_1 = StreamPeerTCP.new()
|
||||
peerstream = PacketPeerStream.new()
|
||||
peerstream_fs_1 = PacketPeerStream.new()
|
||||
var rc = client_fs_1.connect_to_host(ip_fs_1, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_1)
|
||||
else:
|
||||
peerstream.set_stream_peer(client_fs_1)
|
||||
peerstream_fs_1.set_stream_peer(client_fs_1)
|
||||
|
||||
|
||||
# Отправить команду для ФС
|
||||
func send_data(data_to_sand: PackedByteArray):
|
||||
if client_fs_1.get_status() == 2:
|
||||
var peer = peerstream.get_stream_peer()
|
||||
var peer = peerstream_fs_1.get_stream_peer()
|
||||
if peer:
|
||||
peer.put_data(data_to_sand)
|
||||
emit_signal("data_send")
|
||||
@@ -208,3 +241,43 @@ func disconnect_fs(client_for_leave):
|
||||
state_fs = Constants.STATE.IDLE
|
||||
command_stack = []
|
||||
|
||||
|
||||
|
||||
func state_machine_fs_2():
|
||||
if client_fs_2:
|
||||
## State fs machine
|
||||
if (state_fs_2 == Constants.STATE.IDLE) or (state_fs_2 == Constants.STATE.DONE):
|
||||
if command_stack_fs_2:
|
||||
var pack: Array = command_stack_fs_2.pop_front()
|
||||
send_data_fs_2(pack)
|
||||
state_fs_2 = Constants.STATE.SEND
|
||||
|
||||
|
||||
# Подключится к модулю ФС
|
||||
func connect_fs_2():
|
||||
if client_fs_2:
|
||||
disconnect_fs_2(client_fs_2)
|
||||
|
||||
client_fs_2 = StreamPeerTCP.new()
|
||||
peerstream_fs_2 = PacketPeerStream.new()
|
||||
var rc = client_fs_2.connect_to_host(ip_fs_2, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_2)
|
||||
else:
|
||||
peerstream_fs_2.set_stream_peer(client_fs_2)
|
||||
|
||||
|
||||
# Отправить команду для ФС
|
||||
func send_data_fs_2(data_to_sand: PackedByteArray):
|
||||
if client_fs_2.get_status() == 2:
|
||||
var peer = peerstream_fs_2.get_stream_peer()
|
||||
if peer:
|
||||
peer.put_data(data_to_sand)
|
||||
emit_signal("data_send_2")
|
||||
|
||||
|
||||
# Разорвать соединение с ФС
|
||||
func disconnect_fs_2(client_for_leave):
|
||||
client_for_leave.disconnect_from_host()
|
||||
state_fs_2 = Constants.STATE.IDLE
|
||||
command_stack = []
|
||||
|
||||
Reference in New Issue
Block a user