From 4620fc6984ee22ab13d9b8b83e5e9964d365d09d Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 31 Jan 2025 15:29:57 +0300 Subject: [PATCH] add attenuathion --- PRD_MP550.tscn | 274 +++++++++++++++++++++++-------------------- scripts/PRD.gd | 58 ++++----- scripts/constants.gd | 8 +- scripts/network.gd | 2 +- 4 files changed, 180 insertions(+), 162 deletions(-) diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 8430853..c86d972 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -95,6 +95,18 @@ bg_color = Color(0.356863, 0.278431, 0.356863, 1) [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7u7p7"] +[sub_resource type="Gradient" id="Gradient_jlp41"] +colors = PackedColorArray(0, 0.647059, 0, 1, 0, 0.266667, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_u3yy8"] +gradient = SubResource("Gradient_jlp41") +fill = 1 +fill_from = Vector2(0.5, 0.5) +fill_to = Vector2(1.145, 0) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_otisn"] +texture = SubResource("GradientTexture2D_u3yy8") + [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_723du"] size = Vector2(1600, 1200) @@ -122,18 +134,6 @@ shader = ExtResource("8_12mng") shader_parameter/color_signal = Color(0.588242, 0.466356, 0, 1) shader_parameter/turn = 0.735 -[sub_resource type="Gradient" id="Gradient_jlp41"] -colors = PackedColorArray(0, 0.647059, 0, 1, 0, 0.266667, 0, 1) - -[sub_resource type="GradientTexture2D" id="GradientTexture2D_u3yy8"] -gradient = SubResource("Gradient_jlp41") -fill = 1 -fill_from = Vector2(0.5, 0.5) -fill_to = Vector2(1.145, 0) - -[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_otisn"] -texture = SubResource("GradientTexture2D_u3yy8") - [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tn8m6"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ooo4i"] @@ -271,42 +271,74 @@ theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7") metadata/_tab_index = 0 metadata/_edit_lock_ = true -[node name="select_dev" type="GridContainer" parent="TabContainer/PRD"] +[node name="body_grid" type="GridContainer" parent="TabContainer/PRD"] +layout_mode = 0 +offset_left = 827.0 +offset_top = -14.0 +offset_right = 1633.0 +offset_bottom = 690.0 + +[node name="litera_2_4_6" type="GridContainer" parent="TabContainer/PRD/body_grid"] +clip_contents = true +custom_minimum_size = Vector2(500, 300) +layout_mode = 2 +size_flags_horizontal = 3 +columns = 3 + +[node name="yau_07b" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_2_4_6"] +custom_minimum_size = Vector2(250, 200) +layout_mode = 2 + +[node name="LABEL" type="Label" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 +text = "ЛИТЕРА 2! ПРД-Н!" + +[node name="Zapret" type="Button" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true +text = " Запрет СИ2" +metadata/dev_num = 48 + +[node name="Modul_um_1" type="Button" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true +text = " Модуляция УМ 2" +metadata/dev_num = 51 + +[node name="Label_ray" type="Label" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 +text = "Номер и направление луча" + +[node name="Ray_set_1" type="OptionButton" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 + +[node name="att_set_1" type="OptionButton" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 + +[node name="DKM2" type="Label" parent="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b"] +layout_mode = 2 +text = "ДКМ ДОУ 2" + +[node name="table_ukp_1" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_2_4_6"] layout_mode = 2 -offset_left = 12.0 -offset_top = 64.0 -offset_right = 12.0 -offset_bottom = 64.0 script = ExtResource("2_vmbyo") metadata/_edit_lock_ = true -[node name="table_ukp_1" type="GridContainer" parent="TabContainer/PRD"] -layout_mode = 2 -offset_left = 969.0 -offset_top = 27.0 -offset_right = 969.0 -offset_bottom = 27.0 -script = ExtResource("2_vmbyo") -metadata/_edit_lock_ = true - -[node name="table_ukp_2" type="GridContainer" parent="TabContainer/PRD"] -layout_mode = 2 -offset_left = 969.0 -offset_top = 331.0 -offset_right = 969.0 -offset_bottom = 331.0 -script = ExtResource("2_vmbyo") -metadata/_edit_lock_ = true - -[node name="PSK" type="Sprite2D" parent="TabContainer/PRD"] +[node name="PSK" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_2_4_6"] material = ExtResource("3_3syd3") -position = Vector2(1276.25, 29) +position = Vector2(367, 11) scale = Vector2(0.247968, 0.234167) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") -[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/PSK"] +[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/body_grid/litera_2_4_6/PSK"] modulate = Color(1, 1, 0.941176, 0.784314) material = SubResource("ShaderMaterial_o7txs") offset_left = 554.954 @@ -317,22 +349,77 @@ texture = ExtResource("5_i3nvb") expand_mode = 1 metadata/_edit_lock_ = true -[node name="ray_1" type="Sprite2D" parent="TabContainer/PRD/PSK"] +[node name="ray_1" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_2_4_6/PSK"] material = SubResource("ShaderMaterial_dgiai") position = Vector2(549.221, 560.705) scale = Vector2(21.8765, 21.6782) texture = SubResource("GradientTexture2D_0pk2o") metadata/_edit_lock_ = true -[node name="PSK2" type="Sprite2D" parent="TabContainer/PRD"] +[node name="litera_3_5_7_1" type="GridContainer" parent="TabContainer/PRD/body_grid"] +custom_minimum_size = Vector2(500, 350) +layout_mode = 2 +columns = 3 + +[node name="yau_07b" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_3_5_7_1"] +custom_minimum_size = Vector2(250, 200) +layout_mode = 2 + +[node name="LABEL2" type="Label" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b"] +layout_mode = 2 +text = "ЛИТЕРА 3! ПРД-Н!" + +[node name="Zapret2" type="Button" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b"] +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 = 49 + +[node name="Modul_um_2" type="Button" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b"] +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 = 52 + +[node name="fgos_2" type="Button" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b"] +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/body_grid/litera_3_5_7_1/yau_07b"] +layout_mode = 2 +text = "ДКМ ДОУ 3" + +[node name="Ray_set_2" type="OptionButton" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b"] +layout_mode = 2 + +[node name="att_set_2" type="OptionButton" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b"] +layout_mode = 2 + +[node name="table_ukp_2" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_3_5_7_1"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="PSK2" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_3_5_7_1"] material = ExtResource("3_3syd3") -position = Vector2(1276, 326) +position = Vector2(368, 10) scale = Vector2(0.247968, 0.234167) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") -[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/PSK2"] +[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/PSK2"] modulate = Color(1, 1, 0.941176, 0.784314) show_behind_parent = true material = SubResource("ShaderMaterial_o7txs") @@ -344,93 +431,19 @@ texture = ExtResource("5_i3nvb") expand_mode = 1 metadata/_edit_lock_ = true -[node name="ray_2" type="Sprite2D" parent="TabContainer/PRD/PSK2"] +[node name="ray_2" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_3_5_7_1/PSK2"] material = SubResource("ShaderMaterial_2pxu2") position = Vector2(549.221, 560.705) scale = Vector2(21.8765, 21.6782) texture = SubResource("GradientTexture2D_0pk2o") metadata/_edit_lock_ = true -[node name="Grid" type="GridContainer" parent="TabContainer/PRD"] -layout_mode = 0 -offset_left = 616.0 -offset_top = 34.0 -offset_right = 949.0 -offset_bottom = 612.0 - -[node name="LABEL" type="Label" parent="TabContainer/PRD/Grid"] -layout_mode = 2 -text = "ЛИТЕРА 2! ПРД-Н!" - -[node name="Zapret" 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 = " Запрет СИ2" -metadata/dev_num = 48 - -[node name="Modul_um_1" 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 = " Модуляция УМ 2" -metadata/dev_num = 51 - -[node name="Label_ray" type="Label" parent="TabContainer/PRD/Grid"] -layout_mode = 2 -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="LABEL2" type="Label" parent="TabContainer/PRD/Grid"] -layout_mode = 2 -text = "ЛИТЕРА 3! ПРД-Н!" - -[node name="Zapret2" 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 = 49 - -[node name="Modul_um_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 = 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" - -[node name="Ray_set2" type="OptionButton" parent="TabContainer/PRD/Grid"] +[node name="select_dev" type="GridContainer" parent="TabContainer/PRD"] layout_mode = 2 +offset_top = 195.0 +offset_bottom = 195.0 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true [node name="ControlPanel" type="Panel" parent="TabContainer"] visible = false @@ -999,14 +1012,15 @@ text = "Темп" [connection signal="pressed" from="Background/side_panel/select_ems_g" to="." method="_on_emsg_select"] [connection signal="pressed" from="Background/side_panel/select_fs" to="." method="_on_mfs_select"] [connection signal="pressed" from="read_isa" to="." method="_on_read_isa_pressed"] -[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/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="toggled" from="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Zapret" to="." method="_on_zapret1"] +[connection signal="toggled" from="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Modul_um_1" to="." method="_on_modul_um_1"] +[connection signal="item_selected" from="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Ray_set_1" to="." method="_on_btn_ray_1"] +[connection signal="item_selected" from="TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/att_set_1" to="." method="_on_attenuator_1"] +[connection signal="toggled" from="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Zapret2" to="." method="_on_zapret2"] +[connection signal="toggled" from="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Modul_um_2" to="." method="_on_modul_um_2"] +[connection signal="toggled" from="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/fgos_2" to="." method="_on_fgos_2"] +[connection signal="item_selected" from="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Ray_set_2" to="." method="_on_btn_ray_2"] +[connection signal="item_selected" from="TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/att_set_2" to="." method="_on_attenuator_2"] [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"] [connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/con" to="TabContainer/Modul_fs" method="_on_start"] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index bd3b8ae..0ac86f5 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -14,14 +14,14 @@ var isa_from_yau07b: Dictionary = {} func _ready() -> void: # Таблица УКП_1 - node_select1 = $TabContainer/PRD/table_ukp_1 + node_select1 = $TabContainer/PRD/body_grid/litera_2_4_6/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/table_ukp_2 + node_select2 = $TabContainer/PRD/body_grid/litera_3_5_7_1/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, 'Мощность') @@ -42,16 +42,16 @@ func _ready() -> void: ## Заполненение списка направления луча for key in Constants.RAY_DICT: - $TabContainer/PRD/Grid/Ray_set.add_item(key) - $TabContainer/PRD/Grid/Ray_set2.add_item(key) + $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Ray_set_1.add_item(key) + $TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Ray_set_2.add_item(key) ## Заполненение списка аттенюатора for key in Constants.ATT_DICT: - $TabContainer/PRD/Grid/att_set_1.add_item(key) - - + $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/att_set_1.add_item(key) + $TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/att_set_2.add_item(key) + draw_control_panel_prd(Constants.ADDRESSES[0][3]) - + 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')) @@ -75,7 +75,7 @@ func _on_yau_status(yau_status: bool) -> void: func _on_read_isa(unit_isa_ports: Dictionary) -> void: - isa_from_yau07b=unit_isa_ports + isa_from_yau07b = unit_isa_ports var isa_data: Dictionary = {} for key in unit_isa_ports.keys(): isa_data[key] = unit_isa_ports[key] @@ -97,10 +97,9 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: $ISA.text = 'ISA: ' + str(len(Constants.EMS_G_PORT_DATA_HOLDER)) 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]) - + $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[0x106] & 0x7)) 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]) + $TabContainer/PRD/body_grid/litera_3_5_7_1/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[0x108] & 0x7)) ## Рисует таблицу @@ -194,35 +193,35 @@ func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: i func _on_zapret1(toggled_on: bool) -> void: - var meta = $TabContainer/PRD/Grid/Zapret.get_meta('dev_num') + var meta = $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Zapret.get_meta('dev_num') Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var zapret_mode = 0x4000 if toggled_on else 0x0 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode) func _on_zapret2(toggled_on: bool) -> void: - var meta = $TabContainer/PRD/Grid/Zapret2.get_meta('dev_num') + var meta = $TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Zapret2.get_meta('dev_num') Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var zapret_mode = 0x4000 if toggled_on else 0x0 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode) func _on_modul_um_1(toggled_on: bool): - var meta = $TabContainer/PRD/Grid/Modul_um_1.get_meta('dev_num') + var meta = $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Modul_um_1.get_meta('dev_num') Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var modul_um = 0x2000 if toggled_on else 0x0 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) func _on_modul_um_2(toggled_on: bool): - var meta = $TabContainer/PRD/Grid/Modul_um_2.get_meta('dev_num') + var meta = $TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Modul_um_2.get_meta('dev_num') Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var modul_um = 0x2000 if toggled_on else 0x0 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) func _on_fgos_2(toggled_on: bool): - var meta = $TabContainer/PRD/Grid/fgos_2.get_meta('dev_num') + var meta = $TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/fgos_2.get_meta('dev_num') Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var modul_um = 0x2000 if toggled_on else 0x0 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) @@ -234,15 +233,26 @@ func _on_fgos_2(toggled_on: bool): #var modul_um = 0x2000 if toggled_on else 0x0 #Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) + ## Регулировка положением луча 1 -func _on_btn_ray(item_from_ray: int) -> void: - Network.write_port_isa(Constants.BASE_PORTS.UG+6, item_from_ray) +func _on_btn_ray_1(item_from_ray_1: int) -> void: + Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_ray_1, 7)) Network.read_port_isa([Constants.BASE_PORTS.UG+6]) ## Регулировка положением луча 2 -func _on_btn_ray2(item_from_ray: int) -> void: - Network.write_port_isa(Constants.BASE_PORTS.UG+8, item_from_ray) +func _on_btn_ray_2(item_from_ray_2: int) -> void: + Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_ray_2, 7)) + Network.read_port_isa([Constants.BASE_PORTS.UG+8]) + + +func _on_attenuator_1(item_from_att_1: int) -> void: + Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_att_1 << 3, 0x38)) + Network.read_port_isa([Constants.BASE_PORTS.UG+6]) + + +func _on_attenuator_2(item_from_att_1: int) -> void: + Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_att_1 << 3, 0x38)) Network.read_port_isa([Constants.BASE_PORTS.UG+8]) @@ -250,12 +260,6 @@ 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] - Прежние значения бит ## [param a] - Новые значения бит diff --git a/scripts/constants.gd b/scripts/constants.gd index 97891ca..29cf5a2 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -185,10 +185,10 @@ const SIGNS_PRD: Array = [ ], ] var NODE_MAP = { - 'TabContainer/PRD/Grid/Zapret': 0, - 'TabContainer/PRD/Grid/Zapret2': 1, - 'TabContainer/PRD/Grid/LABEL': 3, - 'TabContainer/PRD/Grid/LABEL2': 4, + 'TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Zapret': 0, + 'TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/Zapret2': 1, + 'TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/LABEL': 3, + 'TabContainer/PRD/body_grid/litera_3_5_7_1/yau_07b/LABEL2': 4, 'TabContainer/ControlPanel/Signal_EMS_G/ref_A22': 5, 'TabContainer/ControlPanel/Signal_EMS_G/ref_A23': 6, 'TabContainer/ControlPanel/Signal_EMS_G/ref_A26': 7, diff --git a/scripts/network.gd b/scripts/network.gd index 1fc2bed..f613950 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -92,7 +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]) + read_port_isa([0x106, 0x108]) func _process(delta: float) -> void: