From 44ee7a50c88c6e4576a1bd3a71953a1997bf60e2 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 31 Jan 2025 11:27:18 +0300 Subject: [PATCH] trabble --- PRD_MP550.tscn | 32 ++++++++++++++++---------------- scripts/PRD.gd | 23 +++++++++++++++++------ scripts/constants.gd | 10 ++++++++++ scripts/network.gd | 3 ++- 4 files changed, 45 insertions(+), 23 deletions(-) diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 08aae4d..8430853 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -307,7 +307,7 @@ offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") [node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/PSK"] -modulate = Color(1, 1, 0.941176, 1) +modulate = Color(1, 1, 0.941176, 0.784314) material = SubResource("ShaderMaterial_o7txs") offset_left = 554.954 offset_top = -30.0 @@ -333,7 +333,7 @@ offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") [node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/PSK2"] -modulate = Color(1, 1, 0.941176, 1) +modulate = Color(1, 1, 0.941176, 0.784314) show_behind_parent = true material = SubResource("ShaderMaterial_o7txs") offset_left = 554.954 @@ -387,14 +387,13 @@ text = "Номер и направление луча" [node name="Ray_set" type="OptionButton" parent="TabContainer/PRD/Grid"] layout_mode = 2 +[node name="att_set_1" type="OptionButton" parent="TabContainer/PRD/Grid"] +layout_mode = 2 + [node name="DKM2" type="Label" parent="TabContainer/PRD/Grid"] layout_mode = 2 text = "ДКМ ДОУ 2" -[node name="FGOZ2" type="Label" parent="TabContainer/PRD/Grid"] -layout_mode = 2 -text = "ФГОЗ 2" - [node name="LABEL2" type="Label" parent="TabContainer/PRD/Grid"] layout_mode = 2 text = "ЛИТЕРА 3! ПРД-Н!" @@ -408,15 +407,6 @@ toggle_mode = true text = " Запрет СИ3" metadata/dev_num = 49 -[node name="fgos_2" type="Button" parent="TabContainer/PRD/Grid"] -layout_mode = 2 -focus_mode = 0 -mouse_default_cursor_shape = 2 -theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") -toggle_mode = true -text = "ФГОЗ 3" -metadata/dev_num = 56 - [node name="Modul_um_2" type="Button" parent="TabContainer/PRD/Grid"] layout_mode = 2 focus_mode = 0 @@ -426,6 +416,15 @@ toggle_mode = true text = " Модуляция УМ 3" metadata/dev_num = 52 +[node name="fgos_2" type="Button" parent="TabContainer/PRD/Grid"] +layout_mode = 2 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true +text = "ФГОЗ 3" +metadata/dev_num = 56 + [node name="DKM3" type="Label" parent="TabContainer/PRD/Grid"] layout_mode = 2 text = "ДКМ ДОУ 3" @@ -1003,9 +1002,10 @@ text = "Темп" [connection signal="toggled" from="TabContainer/PRD/Grid/Zapret" to="." method="_on_zapret1"] [connection signal="toggled" from="TabContainer/PRD/Grid/Modul_um_1" to="." method="_on_modul_um_1"] [connection signal="item_selected" from="TabContainer/PRD/Grid/Ray_set" to="." method="_on_btn_ray"] +[connection signal="item_selected" from="TabContainer/PRD/Grid/att_set_1" to="." method="_on_attenuator_1"] [connection signal="toggled" from="TabContainer/PRD/Grid/Zapret2" to="." method="_on_zapret2"] -[connection signal="toggled" from="TabContainer/PRD/Grid/fgos_2" to="." method="_on_fgos_2"] [connection signal="toggled" from="TabContainer/PRD/Grid/Modul_um_2" to="." method="_on_modul_um_2"] +[connection signal="toggled" from="TabContainer/PRD/Grid/fgos_2" to="." method="_on_fgos_2"] [connection signal="item_selected" from="TabContainer/PRD/Grid/Ray_set2" to="." method="_on_btn_ray2"] [connection signal="pressed" from="TabContainer/Modul_fs/set_space/set_ferq" to="TabContainer/Modul_fs" method="_on_set_ferq"] [connection signal="pressed" from="TabContainer/Modul_fs/set_space/set_att2" to="TabContainer/Modul_fs" method="_on_set_att"] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 87a0f56..bd3b8ae 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -9,7 +9,7 @@ var node_select1: Node var node_select2: Node var flag_yau_control: bool var CONTROL_TABLE: Array -var isa: Array = [] +var isa_from_yau07b: Dictionary = {} func _ready() -> void: @@ -45,6 +45,11 @@ func _ready() -> void: $TabContainer/PRD/Grid/Ray_set.add_item(key) $TabContainer/PRD/Grid/Ray_set2.add_item(key) + ## Заполненение списка аттенюатора + for key in Constants.ATT_DICT: + $TabContainer/PRD/Grid/att_set_1.add_item(key) + + draw_control_panel_prd(Constants.ADDRESSES[0][3]) Network.connect('yau_status_line', Callable(self, '_on_yau_status')) @@ -70,13 +75,14 @@ func _on_yau_status(yau_status: bool) -> void: func _on_read_isa(unit_isa_ports: Dictionary) -> void: + isa_from_yau07b=unit_isa_ports var isa_data: Dictionary = {} for key in unit_isa_ports.keys(): isa_data[key] = unit_isa_ports[key] - if isa_data.has(0x122): - var tmp = isa_data[0x122] - isa_data.erase(0x122) + if isa_data.has(Constants.BASE_PORTS.EMS_G+2): + var tmp = isa_data[Constants.BASE_PORTS.EMS_G+2] + isa_data.erase(Constants.BASE_PORTS.EMS_G+2) var found = false for i in range(Constants.EMS_G_PORT_DATA_HOLDER.size()): @@ -90,10 +96,10 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: emit_signal('read_ems_g_finish') $ISA.text = 'ISA: ' + str(len(Constants.EMS_G_PORT_DATA_HOLDER)) - if isa_data.has(0x106): + if isa_data.has(Constants.BASE_PORTS.UG+6): $TabContainer/PRD/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * isa_data[0x106]) - if isa_data.has(0x108): + if isa_data.has(Constants.BASE_PORTS.UG+8): $TabContainer/PRD/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * isa_data[0x108]) @@ -244,6 +250,11 @@ func _on_read_isa_pressed() -> void: Network.read_port_isa([Constants.BASE_PORTS.EMS_G+2, Constants.BASE_PORTS.EMS_G+4, Constants.BASE_PORTS.EMS_G+8]) +func _on_attenuator_1(item_from_att_1: int) -> void: + print(isa_from_yau07b) + Network.write_port_isa(Constants.BASE_PORTS.UG+6, item_from_att_1) + #print(item_from_att_1) + ## Устанавливает биты в соответствии с маской ## [param v] - Прежние значения бит diff --git a/scripts/constants.gd b/scripts/constants.gd index 41cbff5..97891ca 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -94,6 +94,16 @@ const RAY_DICT: Array = [ ' 35°', ' 45°', ] +const ATT_DICT: Array = [ + ' 0 db', + ' 0.5 db', + ' 2 db', + ' 2.5 db', + ' 8 db', + ' 8.5 db', + ' 10 db', + ' 10.5 db', +] const SIGNS_PRD: Array = [ ## ПРК-К [ diff --git a/scripts/network.gd b/scripts/network.gd index e2737dd..1fc2bed 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -1,7 +1,7 @@ extends Node # ЯУ-07 Блок -var unit = Yau07.YaU07.new('ЯУ07') +var unit = Yau07.YaU07.new('ЯУ-07Б') var soc_unicast: Socket var soc_brodcast: Socket var ip_address_yau: String = Constants.ADDRESSES[0][1] @@ -92,6 +92,7 @@ func _ready() -> void: unit.connect('line_changed', Callable(self, 'on_line_changed')) unit.connect('command_fail', Callable(self, 'on_command_fail')) connect_fs() + read_port_isa([0x106]) func _process(delta: float) -> void: