From a3e03c7da1298907ea621a59b40e93110f6e80a2 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 7 Feb 2025 06:39:02 +0300 Subject: [PATCH 1/2] module fs half-stable --- scripts/FS.gd | 2 -- scripts/PRD.gd | 13 +++++++++---- scripts/network.gd | 8 ++++++-- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/scripts/FS.gd b/scripts/FS.gd index 4fa8390..dddf9a2 100644 --- a/scripts/FS.gd +++ b/scripts/FS.gd @@ -119,8 +119,6 @@ class FGOS: var peer = peerstream_fs.get_stream_peer() if peer: peer.put_data(data_to_sand) - else: - print_debug('client_fs.get_status != 2 !!!') #func _parse(rx_data: PackedByteArray): diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 75d86b9..66df434 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -137,8 +137,10 @@ func _ready() -> void: 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')) - Network.connect('port_fs_opened_1', _on_port_changed_fs_1.bind(Color.GREEN)) - Network.connect('port_fs_opened_2', _on_port_changed_fs_2.bind(Color.GREEN)) + Network.connect('port_fs_opened_1', _on_port_changed_fs_1.bind(Color.AQUAMARINE)) + Network.connect('port_fs_closed_1', _on_port_changed_fs_1.bind(Color.CRIMSON)) + Network.connect('port_fs_opened_2', _on_port_changed_fs_2.bind(Color.AQUAMARINE)) + Network.connect('port_fs_closed_2', _on_port_changed_fs_2.bind(Color.CRIMSON)) Network.connect('data_from_fs_1', _on_data_fs_1) Network.connect('data_from_fs_2', _on_data_fs_2) @@ -528,8 +530,9 @@ func set_bits(v, a, m): ## 1 ФС -func _on_port_changed_fs_1(port_name: String, _color: Color) -> void: +func _on_port_changed_fs_1(port_name: String, color: Color) -> void: $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, port_name) + $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = color func _on_start_fs_1(): @@ -550,8 +553,10 @@ func _on_set_att_1(att: String): ## 2 ФС -func _on_port_changed_fs_2(port_name: String, _color: Color) -> void: +func _on_port_changed_fs_2(port_name: String, color: Color) -> void: $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, port_name) + $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 1).modulate = color + func _on_start_fs_2(): Network.start_work_fs_2() diff --git a/scripts/network.gd b/scripts/network.gd index d90588b..69f5199 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -40,7 +40,8 @@ signal data_from_fs_1(data:PackedByteArray) signal data_from_fs_2(data:PackedByteArray) signal port_fs_opened_1(port_name: String) signal port_fs_opened_2(port_name: String) -signal port_closed(port_name: String) +signal port_fs_closed_1(port_name: String) +signal port_fs_closed_2(port_name: String) signal port_error(error_str: String) @@ -78,7 +79,10 @@ func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: Strin return # Проверяем состояние подключения if client.get_status() != StreamPeerTCP.STATUS_CONNECTED: - emit_signal("port_closed", ip_fs) + if client == client_fs_1: + emit_signal("port_fs_closed_1", ip_fs) + elif client == client_fs_2: + emit_signal("port_fs_closed_2", ip_fs) return if peer.get_available_bytes() > 0: From a84ed1d3a21f1061a8f6b69bcf03910fab58bcc0 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 7 Feb 2025 06:55:00 +0300 Subject: [PATCH 2/2] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D1=80=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D1=80=D0=B4=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PRD_MP550.tscn | 20 ++------------------ scripts/control_panel.gd | 11 +++-------- scripts/ems_g.gd | 40 ++++++++++++++++------------------------ 3 files changed, 21 insertions(+), 50 deletions(-) diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 8b4f25f..3860e19 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -232,22 +232,6 @@ theme_override_font_sizes/font_size = 14 theme_override_styles/pressed = SubResource("StyleBoxFlat_p247y") text = "Загрузить" -[node name="Litera_3_5_7" type="ColorRect" parent="Background"] -visible = false -layout_mode = 0 -offset_top = 48.0 -offset_right = 1941.0 -offset_bottom = 352.0 -color = Color(0.669446, 0.567301, 0.66881, 1) - -[node name="Litera_1" type="ColorRect" parent="Background"] -visible = false -layout_mode = 0 -offset_top = 359.0 -offset_right = 2182.0 -offset_bottom = 638.0 -color = Color(0.669446, 0.567301, 0.66881, 1) - [node name="ISA" type="Label" parent="."] offset_left = 225.0 offset_top = 11.0 @@ -280,12 +264,11 @@ theme_override_styles/tab_selected = SubResource("StyleBoxTexture_k08q3") theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6") theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6") tab_alignment = 2 -current_tab = 1 +current_tab = 0 tab_focus_mode = 0 metadata/_edit_lock_ = true [node name="PRD" type="Panel" parent="TabContainer"] -visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7") metadata/_tab_index = 0 @@ -429,6 +412,7 @@ script = ExtResource("2_vmbyo") node_gap = Vector2(100, 50) [node name="ControlPanel" type="Panel" parent="TabContainer"] +visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6") script = ExtResource("9_akagi") diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 0bf2e4b..36e72bb 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -7,11 +7,6 @@ func _ready() -> void: Network.connect('yau_receive', Callable(self, '_on_data_received')) Network.connect('yau_status_line', Callable(self, '_control_pribor')) - var timer = Timer.new() - self.add_child(timer) - timer.connect('timeout', Callable(self, 'on_timer')) - timer.start(1) - '''sockets_ind = [ $soc_y5/ems_g/light_ind, $soc_y5/ug/light_ind, @@ -32,11 +27,11 @@ func on_timer(unit): print(unit) func _on_data_received(data_from_yau_07): - var status_board = data_from_yau_07.decode_u8(Constants.DataIndices.STATUS_BOARD) - var dry_contact: int = data_from_yau_07.decode_u16(Constants.DataIndices.DRY_CONTACT) # Контроль сухих контактов (УГ) + var _status_board = data_from_yau_07.decode_u8(Constants.DataIndices.STATUS_BOARD) + var _dry_contact: int = data_from_yau_07.decode_u16(Constants.DataIndices.DRY_CONTACT) # Контроль сухих контактов (УГ) ## From Network status about yau-07 -func _control_pribor(yau_status:bool) -> void: +func _control_pribor(_yau_status:bool) -> void: #$device.text = str(Constants.CURRENT_MODE) $soc_y5/ay07.state = Constants.STATE_VAL.GOOD diff --git a/scripts/ems_g.gd b/scripts/ems_g.gd index 2634ad0..6985a88 100644 --- a/scripts/ems_g.gd +++ b/scripts/ems_g.gd @@ -97,8 +97,8 @@ func _on_data_received(data_from_yau_07): 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): @@ -113,20 +113,18 @@ func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_ set_frame(socket_status, frame_type) - if i == 1: - set_frame(get_specific_node(parent_node2, 5), frame_type) + if i == 1: # СИ_2_в_УФ 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) set_frame(CI_2_UF, frame_type) - if i == 2: - set_frame(get_specific_node(parent_node2, 6), frame_type) + if i == 2: # СИ_3_в_УФ var CI_3_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 6).get_child(1) set_frame(CI_3_UF, frame_type) - if i == 4: - set_frame(get_specific_node(parent_node2, 7), frame_type) - if i == 5: - set_frame(get_specific_node(parent_node2, 8), frame_type) - if i == 9: - set_frame(get_specific_node(parent_node2, 9), frame_type) + if i == 4: # Модуляция_УМ_2 + pass + if i == 5: # Модуляция_УМ_3 + pass + if i == 9: # ФГОЗ_3 + pass func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_node2: Node): @@ -141,24 +139,18 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod set_frame(socket_status, frame_type) - if i == 1: - set_frame(get_specific_node(parent_node2, 1), frame_type) - if i == 2: - set_frame(get_specific_node(parent_node2, 2), frame_type) - if i == 9: - set_frame(get_specific_node(parent_node2, 3), frame_type) + if i == 1: # СЗИ_2_от_УФ + pass + if i == 2: # СЗИ_3_от_УФ + pass + if i == 9: # СИ_2_от_ФС var CI_2_FS = 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_FS, frame_type) - if i == 10: - set_frame(get_specific_node(parent_node2, 4), frame_type) + if i == 10: # СИ_3_от_ФС var CI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1) set_frame(CI_3_FS, frame_type) -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 set_frame(node: Node, val: int): node.set_frame(val)