diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 0b919ea..eb1a1d3 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -217,6 +217,7 @@ toggle_mode = true text = "Модуль ФС" [node name="save_config" type="Button" parent="Background/side_panel"] +layout_mode = 0 offset_top = 832.0 offset_right = 216.0 offset_bottom = 868.0 @@ -227,6 +228,7 @@ theme_override_styles/pressed = SubResource("StyleBoxFlat_p247y") text = "Сохранить" [node name="load_config" type="Button" parent="Background/side_panel"] +layout_mode = 0 offset_top = 872.0 offset_right = 216.0 offset_bottom = 908.0 @@ -270,7 +272,7 @@ text = "Прочитать ISA" offset_left = 216.0 offset_top = 39.0 offset_right = 2420.0 -offset_bottom = 917.0 +offset_bottom = 940.0 theme = SubResource("Theme_k5ur4") theme_override_colors/font_unselected_color = Color(0, 0, 0, 0.0392157) theme_override_colors/font_selected_color = Color(0, 0, 0, 0) @@ -282,10 +284,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 = 0 +current_tab = 1 tab_focus_mode = 0 [node name="PRD" type="Panel" parent="TabContainer"] +visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7") metadata/_tab_index = 0 @@ -569,19 +572,18 @@ 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") metadata/_tab_index = 1 metadata/_edit_lock_ = true -[node name="lbl_control" type="Label" parent="TabContainer/ControlPanel"] +[node name="label_control_PRD" type="Label" parent="TabContainer/ControlPanel"] layout_mode = 0 offset_left = 4.0 -offset_top = 21.0 +offset_top = -44.0 offset_right = 624.0 -offset_bottom = 52.0 +offset_bottom = -13.0 theme_override_font_sizes/font_size = 22 text = "Контроль исправности прибора ПРД-Н" horizontal_alignment = 1 @@ -590,36 +592,36 @@ vertical_alignment = 1 [node name="soc_y5" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 offset_left = 199.0 -offset_top = 103.0 +offset_top = 8.0 offset_right = 516.0 -offset_bottom = 293.0 +offset_bottom = 198.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="ref_A24" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] +[node name="IP5_25" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] offset_left = 9.0 offset_top = 34.0 offset_right = 59.0 offset_bottom = 184.0 textures = Array[Texture]([]) -fname = "ИП-25" +fname = "ИП5-25" rname = "A24" metadata/_edit_lock_ = true -[node name="ref_A30" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] +[node name="ay07" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] offset_left = 59.0 offset_top = 34.0 offset_right = 109.0 offset_bottom = 184.0 textures = Array[Texture]([]) -fname = "ЯУ-07" +fname = "ЯУ-07Б" rname = "A30" metadata/_edit_lock_ = true -[node name="ref_A26" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] +[node name="ems_g" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] offset_left = 109.0 offset_top = 34.0 offset_right = 159.0 @@ -629,7 +631,7 @@ fname = "ЭМС-Г" rname = "A26" metadata/_edit_lock_ = true -[node name="ref_A27" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] +[node name="ug" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] offset_left = 159.0 offset_top = 34.0 offset_right = 209.0 @@ -639,7 +641,7 @@ fname = "УГ" rname = "A27" metadata/_edit_lock_ = true -[node name="ref_A28" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] +[node name="ukp_1" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] offset_left = 209.0 offset_top = 34.0 offset_right = 259.0 @@ -650,7 +652,7 @@ fname = "УКП-1" rname = "A28" metadata/_edit_lock_ = true -[node name="ref_A29" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] +[node name="ukp_2" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")] offset_left = 259.0 offset_top = 34.0 offset_right = 309.0 @@ -660,7 +662,7 @@ fname = "УКП-2" rname = "A29" metadata/_edit_lock_ = true -[node name="lbl_fname" type="Label" parent="TabContainer/ControlPanel/soc_y5"] +[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/soc_y5"] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 offset_left = 7.0 @@ -671,15 +673,15 @@ text = "Кассета У5" horizontal_alignment = 1 vertical_alignment = 1 -[node name="soc_fs-nkvd" parent="TabContainer/ControlPanel" instance=ExtResource("10_tdh2s")] +[node name="Kasseta_FS" parent="TabContainer/ControlPanel" instance=ExtResource("10_tdh2s")] layout_mode = 0 -offset_left = 198.0 -offset_top = 311.0 -offset_right = 516.0 -offset_bottom = 538.0 +offset_left = 200.0 +offset_top = 201.0 +offset_right = 518.0 +offset_bottom = 420.0 script = null -[node name="lbl_fname" type="Label" parent="TabContainer/ControlPanel/soc_fs-nkvd"] +[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/Kasseta_FS"] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 offset_left = 7.0 @@ -691,150 +693,188 @@ horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_lock_ = true -[node name="ref_A3" parent="TabContainer/ControlPanel/soc_fs-nkvd" instance=ExtResource("11_fg7ul")] +[node name="ref_A3" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")] offset_left = 109.0 -offset_top = 68.0 +offset_top = 41.0 offset_right = 159.0 -offset_bottom = 218.0 +offset_bottom = 211.0 textures = Array[Texture]([]) -fname = "ФС-2" +self_size = Vector2i(50, 170) +fname = "БЛОК ФС-2" rname = "A3" -metadata/_edit_lock_ = true -[node name="ref_A1" parent="TabContainer/ControlPanel/soc_fs-nkvd" instance=ExtResource("11_fg7ul")] +[node name="ref_A1" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")] offset_left = 159.0 -offset_top = 68.0 +offset_top = 41.0 offset_right = 209.0 -offset_bottom = 218.0 +offset_bottom = 211.0 textures = Array[Texture]([]) -fname = "Модуль" +self_size = Vector2i(50, 170) +fname = "Модуль ФС" rname = "A1" -metadata/_edit_lock_ = true -[node name="ref_A2" parent="TabContainer/ControlPanel/soc_fs-nkvd" instance=ExtResource("11_fg7ul")] +[node name="ref_A2" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")] offset_left = 209.0 -offset_top = 68.0 +offset_top = 41.0 offset_right = 259.0 -offset_bottom = 217.0 +offset_bottom = 211.0 textures = Array[Texture]([]) -self_size = Vector2i(50, 149) -fname = "Модуль" +self_size = Vector2i(50, 170) +fname = "Модуль ФС" rname = "A2" -metadata/_edit_lock_ = true -[node name="ref_A4" parent="TabContainer/ControlPanel/soc_fs-nkvd" instance=ExtResource("11_fg7ul")] +[node name="ref_A4" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")] offset_left = 259.0 -offset_top = 68.0 +offset_top = 41.0 offset_right = 309.0 -offset_bottom = 218.0 +offset_bottom = 211.0 textures = Array[Texture]([]) -fname = "ФС-3" +self_size = Vector2i(50, 170) +fname = "БЛОК ФС-3" rname = "A4" -metadata/_edit_lock_ = true + +[node name="Block_FS_PRD_K" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")] +offset_left = 12.0 +offset_top = 41.0 +offset_right = 62.0 +offset_bottom = 211.0 +textures = Array[Texture]([]) +self_size = Vector2i(50, 170) +fname = "БЛОК ФС-1" +rname = "A4" + +[node name="FS_PRD_K" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")] +offset_left = 61.0 +offset_top = 41.0 +offset_right = 111.0 +offset_bottom = 211.0 +textures = Array[Texture]([]) +self_size = Vector2i(50, 170) +fname = "Модуль ФС" +rname = "A1" [node name="soc_P1" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 96.0 -offset_top = 560.0 -offset_right = 516.0 -offset_bottom = 776.0 +offset_left = 259.0 +offset_top = 427.0 +offset_right = 447.0 +offset_bottom = 643.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="lbl_fname" type="Label" parent="TabContainer/ControlPanel/soc_P1"] +[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/soc_P1"] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 offset_left = 7.0 offset_top = 8.0 -offset_right = 409.0 +offset_right = 181.0 offset_bottom = 33.0 text = "Кассета П-1" horizontal_alignment = 1 vertical_alignment = 1 -metadata/_edit_lock_ = true -[node name="ref_A23" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 9.0 -offset_top = 34.0 -offset_right = 59.0 -offset_bottom = 208.0 +[node name="MAA_1" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] +offset_left = -63.0 +offset_top = 36.0 +offset_right = -13.0 +offset_bottom = 210.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true +fname = "МАА2000" +rname = "А22" -[node name="ref_A24" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 59.0 -offset_top = 34.0 -offset_right = 109.0 -offset_bottom = 208.0 +[node name="MAA_2" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] +offset_left = 199.0 +offset_top = 37.0 +offset_right = 249.0 +offset_bottom = 211.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true +fname = "МАА2000" +rname = "А23" -[node name="ref_A25" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 109.0 -offset_top = 34.0 -offset_right = 159.0 -offset_bottom = 208.0 +[node name="IP9_50_2" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] +offset_left = 129.0 +offset_top = 37.0 +offset_right = 179.0 +offset_bottom = 211.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true +fname = "ИП9-50" +rname = "А19" -[node name="ref_A26" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 159.0 -offset_top = 34.0 -offset_right = 209.0 -offset_bottom = 208.0 +[node name="IP9_50_1" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] +offset_left = 73.0 +offset_top = 37.0 +offset_right = 123.0 +offset_bottom = 211.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true +fname = "ИП9-50" +rname = "А20" -[node name="ref_A27" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 209.0 -offset_top = 34.0 -offset_right = 259.0 -offset_bottom = 208.0 +[node name="IP12_50" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] +offset_left = 16.0 +offset_top = 37.0 +offset_right = 66.0 +offset_bottom = 211.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true +fname = "ИП12-50" +rname = "A21" -[node name="ref_A28" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 259.0 -offset_top = 34.0 -offset_right = 309.0 -offset_bottom = 208.0 +[node name="soc_P2" type="NinePatchRect" parent="TabContainer/ControlPanel"] +layout_mode = 0 +offset_left = 258.0 +offset_top = 649.0 +offset_right = 446.0 +offset_bottom = 865.0 +texture = ExtResource("9_0r2qk") +patch_margin_left = 16 +patch_margin_top = 16 +patch_margin_right = 16 +patch_margin_bottom = 16 + +[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/soc_P2"] +self_modulate = Color(1, 1, 1, 0.62) +layout_mode = 0 +offset_left = 7.0 +offset_top = 8.0 +offset_right = 181.0 +offset_bottom = 33.0 +text = "Кассета П-2" +horizontal_alignment = 1 +vertical_alignment = 1 + +[node name="IP9_50" parent="TabContainer/ControlPanel/soc_P2" instance=ExtResource("11_fg7ul")] +offset_left = 73.0 +offset_top = 36.0 +offset_right = 123.0 +offset_bottom = 210.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true +fname = "ИП9-50" +rname = "А22" -[node name="ref_A29" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 309.0 -offset_top = 34.0 -offset_right = 359.0 -offset_bottom = 208.0 +[node name="IP12_50" parent="TabContainer/ControlPanel/soc_P2" instance=ExtResource("11_fg7ul")] +offset_left = 128.0 +offset_top = 36.0 +offset_right = 178.0 +offset_bottom = 210.0 textures = Array[Texture]([]) self_size = Vector2i(50, 174) -metadata/_edit_lock_ = true - -[node name="ref_A30" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 359.0 -offset_top = 34.0 -offset_right = 409.0 -offset_bottom = 208.0 -textures = Array[Texture]([]) -self_size = Vector2i(50, 174) -rname = "A30" -metadata/_edit_lock_ = true +fname = "ИП12-50" +rname = "A25" [node name="Signal_EMS_G" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 536.0 -offset_top = 550.0 -offset_right = 1055.0 -offset_bottom = 777.0 +offset_left = 592.0 +offset_top = 193.0 +offset_right = 1111.0 +offset_bottom = 420.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 @@ -943,6 +983,13 @@ self_size = Vector2i(50, 178) rname = "A33" metadata/_edit_lock_ = true +[node name="device" type="Label" parent="TabContainer/ControlPanel"] +layout_mode = 0 +offset_left = 1451.0 +offset_top = 792.0 +offset_right = 1616.0 +offset_bottom = 847.0 + [node name="EMS_G" type="Panel" parent="TabContainer"] visible = false layout_mode = 2 diff --git a/scripts/PRD.gd b/scripts/PRD.gd index e7067b1..016a85a 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -3,7 +3,6 @@ extends Node2D signal read_ems_g_start() signal read_ems_g_finish() -var flag_mode = Constants.ADDRESSES[0][3] var broadcast_packet: PackedByteArray var node_select1: Node var node_select2: Node @@ -19,19 +18,19 @@ func _ready() -> void: 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/body_grid/litera_3_5_7/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 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]) @@ -39,34 +38,114 @@ func _ready() -> void: 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]) - + ## Заполненение списка направления луча for key in Constants.RAY_DICT: $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Ray_set_1.add_item(key) $TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/Ray_set_2.add_item(key) - + ## Заполненение списка аттенюатора for key in Constants.ATT_DICT: $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/att_set_1.add_item(key) $TabContainer/PRD/body_grid/litera_3_5_7/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')) -func draw_control_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] +func draw_control_panel_prd(pribor) -> void: + if pribor == Constants.MODE.PRD_H: + # Кассета У5 + $TabContainer/ControlPanel/soc_y5/IP5_25.rname = 'А24' + $TabContainer/ControlPanel/soc_y5/ay07.rname = 'А30' + $TabContainer/ControlPanel/soc_y5/ems_g.rname = 'А26' + $TabContainer/ControlPanel/soc_y5/ug.rname = 'А27' + $TabContainer/ControlPanel/soc_y5/ukp_1.rname = 'А28' + $TabContainer/ControlPanel/soc_y5/ukp_2.rname = 'А29' + # Кассета ФС + $TabContainer/ControlPanel/Kasseta_FS/Kasseta.text = 'Кассета ФС-НД' + $TabContainer/ControlPanel/Kasseta_FS/Block_FS_PRD_K.visible = false + $TabContainer/ControlPanel/Kasseta_FS/FS_PRD_K.visible = false + $TabContainer/ControlPanel/Kasseta_FS/ref_A1.rname = 'А1' + $TabContainer/ControlPanel/Kasseta_FS/ref_A1.fname = 'Модуль ФС' + $TabContainer/ControlPanel/Kasseta_FS/ref_A3.rname = 'А3' + $TabContainer/ControlPanel/Kasseta_FS/ref_A3.fname = 'БЛОК ФС-2' + $TabContainer/ControlPanel/Kasseta_FS/ref_A2.rname = 'А2' + $TabContainer/ControlPanel/Kasseta_FS/ref_A2.fname = 'Модуль ФС' + $TabContainer/ControlPanel/Kasseta_FS/ref_A4.rname = 'А4' + $TabContainer/ControlPanel/Kasseta_FS/ref_A4.fname = 'БЛОК ФС-3' + # Кассета П-1 + $TabContainer/ControlPanel/soc_P1/IP12_50.rname = 'А21' + $TabContainer/ControlPanel/soc_P1/IP9_50_1.rname = 'А20' + $TabContainer/ControlPanel/soc_P1/IP9_50_2.rname = 'А19' + $TabContainer/ControlPanel/soc_P1/MAA_1.rname = 'А22' + $TabContainer/ControlPanel/soc_P1/MAA_2.rname = 'А23' + # Кассета П-2 + $TabContainer/ControlPanel/soc_P2.visible = false + + elif pribor == Constants.MODE.PRD_B: + # Кассета У5 + $TabContainer/ControlPanel/soc_y5/IP5_25.rname = 'А24' + $TabContainer/ControlPanel/soc_y5/ay07.rname = 'А30' + $TabContainer/ControlPanel/soc_y5/ems_g.rname = 'А26' + $TabContainer/ControlPanel/soc_y5/ug.rname = 'А27' + $TabContainer/ControlPanel/soc_y5/ukp_1.rname = 'А28' + $TabContainer/ControlPanel/soc_y5/ukp_2.rname = 'А29' + # Кассета ФС + $TabContainer/ControlPanel/Kasseta_FS/Kasseta.text = 'Кассета ФС-ВД' + $TabContainer/ControlPanel/Kasseta_FS/Block_FS_PRD_K.visible = false + $TabContainer/ControlPanel/Kasseta_FS/FS_PRD_K.visible = false + $TabContainer/ControlPanel/Kasseta_FS/ref_A1.rname = 'А1' + $TabContainer/ControlPanel/Kasseta_FS/ref_A1.fname = 'Модуль ФС' + $TabContainer/ControlPanel/Kasseta_FS/ref_A3.rname = 'А3' + $TabContainer/ControlPanel/Kasseta_FS/ref_A3.fname = 'БЛОК ФС-4' + $TabContainer/ControlPanel/Kasseta_FS/ref_A2.rname = 'А2' + $TabContainer/ControlPanel/Kasseta_FS/ref_A2.fname = 'Модуль ФС' + $TabContainer/ControlPanel/Kasseta_FS/ref_A4.rname = 'А4' + $TabContainer/ControlPanel/Kasseta_FS/ref_A4.fname = 'БЛОК ФС-5' + # Кассета П-1 + $TabContainer/ControlPanel/soc_P1/IP12_50.rname = 'А21' + $TabContainer/ControlPanel/soc_P1/IP9_50_1.rname = 'А20' + $TabContainer/ControlPanel/soc_P1/IP9_50_2.rname = 'А19' + $TabContainer/ControlPanel/soc_P1/MAA_1.rname = 'А22' + $TabContainer/ControlPanel/soc_P1/MAA_2.rname = 'А23' + # Кассета П-2 + $TabContainer/ControlPanel/soc_P2.visible = false + + elif pribor == Constants.MODE.PRD_K: + # Кассета У5 + $TabContainer/ControlPanel/soc_y5/IP5_25.rname = 'А31' + $TabContainer/ControlPanel/soc_y5/ay07.rname = 'А37' + $TabContainer/ControlPanel/soc_y5/ems_g.rname = 'А33' + $TabContainer/ControlPanel/soc_y5/ug.rname = 'А34' + $TabContainer/ControlPanel/soc_y5/ukp_1.rname = 'А35' + $TabContainer/ControlPanel/soc_y5/ukp_2.rname = 'А36' + # Кассета ФС + $TabContainer/ControlPanel/Kasseta_FS/Kasseta.text = 'Кассета ФС-КД' + $TabContainer/ControlPanel/Kasseta_FS/Block_FS_PRD_K.visible = true + $TabContainer/ControlPanel/Kasseta_FS/FS_PRD_K.visible = true + $TabContainer/ControlPanel/Kasseta_FS/ref_A1.rname = 'А3' + $TabContainer/ControlPanel/Kasseta_FS/ref_A1.fname = 'Модуль ФС' + $TabContainer/ControlPanel/Kasseta_FS/ref_A3.rname = 'А6' + $TabContainer/ControlPanel/Kasseta_FS/ref_A3.fname = 'БЛОК ФС-6' + $TabContainer/ControlPanel/Kasseta_FS/ref_A2.rname = 'А2' + $TabContainer/ControlPanel/Kasseta_FS/ref_A2.fname = 'Модуль ФС' + $TabContainer/ControlPanel/Kasseta_FS/ref_A4.rname = 'А5' + $TabContainer/ControlPanel/Kasseta_FS/ref_A4.fname = 'БЛОК ФС-7' + # Кассета П-1 + $TabContainer/ControlPanel/soc_P1/IP12_50.rname = 'А23' + $TabContainer/ControlPanel/soc_P1/IP12_50.fname = 'ИП9-50' + $TabContainer/ControlPanel/soc_P1/IP9_50_1.rname = 'А24' + $TabContainer/ControlPanel/soc_P1/IP9_50_1.fname = 'ИП9-50' + $TabContainer/ControlPanel/soc_P1/IP9_50_2.rname = 'А26' + $TabContainer/ControlPanel/soc_P1/IP9_50_2.fname = 'ИП12-50' + + $TabContainer/ControlPanel/soc_P1/MAA_1.rname = 'А27' + $TabContainer/ControlPanel/soc_P1/MAA_2.rname = 'А28' + # Кассета П-2 + $TabContainer/ControlPanel/soc_P2.visible = true ## From Network status about yau-07 @@ -79,7 +158,7 @@ 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(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) @@ -95,7 +174,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: 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(Constants.BASE_PORTS.UG+6): $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): @@ -121,23 +200,23 @@ func _on_data_received(data_from_yau_07): var _DKM: int = data_from_yau_07.decode_u16(Constants.DataIndices.DKM) # ДКМ от УГ #node_select1.set_node_text(2, 0, '%d' % dry_contact) #node_select1.set_node_text(3, 0, '%d' % DKM) - - + + ## УКП for i in range(8): ## Мощность от УКП_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 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 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 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) @@ -167,17 +246,17 @@ func _on_mfs_select() -> void: func _on_save_config(): print('Тебе сюда') - + func _on_load_config(): print('тебе сюда') - + func set_tab_and_buttons(tab_index: int, button_name: String) -> void: $TabContainer.current_tab = tab_index var side_panel = $Background/side_panel - + for button in side_panel.get_children(): if button is Button: button.button_pressed = (button.name == button_name) @@ -188,8 +267,8 @@ func on_btn_select(intem_from_sector: int) -> void: 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_control_panel_prd(flag_mode) + Constants.CURRENT_MODE = meta[2] + draw_control_panel_prd(Constants.CURRENT_MODE) func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: int = 0) -> void: diff --git a/scripts/constants.gd b/scripts/constants.gd index f3ad916..e250744 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -46,6 +46,9 @@ const ADDRESSES: Array = [ ['ПРД-К2', '10.1.1.23', 50023, MODE.PRD_K, '10.1.2.38', '10.1.2.39', '10.1.2.33'], ['ПРД-К3', '10.1.1.33', 50033, MODE.PRD_K, '10.1.2.54', '10.1.2.55', '10.1.2.49'], ['ПРД-К4', '10.1.1.43', 50043, MODE.PRD_K, '10.1.2.70', '10.1.2.71', '10.1.2.65']] + +var CURRENT_MODE = ADDRESSES[0][3] + const INPUT_EMS_G: Array = [ '01 :34', '02 :35', @@ -157,7 +160,7 @@ const SIGNS_PRD: Array = [ '-', 'ИП5-25', ], - ## ПРК-Н + ## ПРД-Н [ ' Запрет СИ2', ' Запрет СИ3', @@ -184,37 +187,14 @@ const SIGNS_PRD: Array = [ 'ИП5-25', ], ] -var NODE_MAP = { - 'TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Zapret': 0, - 'TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/Zapret2': 1, - 'TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/LABEL': 3, - 'TabContainer/PRD/body_grid/litera_3_5_7/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, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A27': 8, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A28': 9, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A29': 10, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A31': 11, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A32': 12, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A33': 13, - 'TabContainer/ControlPanel/Signal_EMS_G/ref_A34': 14, - 'TabContainer/ControlPanel/soc_P1/ref_A23': 15, - 'TabContainer/ControlPanel/soc_P1/ref_A24': 16, - 'TabContainer/ControlPanel/soc_P1/ref_A25': 17, - 'TabContainer/ControlPanel/soc_P1/ref_A26': 18, - 'TabContainer/ControlPanel/soc_P1/ref_A27': 19, - 'TabContainer/ControlPanel/soc_P1/ref_A28': 20, - 'TabContainer/ControlPanel/soc_P1/ref_A29': 21, - 'TabContainer/ControlPanel/soc_P1/ref_A30': 22, - } + enum BASE_PORTS { UG = 0x100, EMS_G = 0x120, UKP_1 = 0x130, UKP_2 = 0x140, } - + enum MODE { PRD_K, PRD_B, @@ -246,7 +226,7 @@ enum STATE { DONE, IDLE, SEND, -} +} var EMS_G_PORT_DATA_HOLDER: Array = [] diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 2f15fea..961f9cf 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -1,31 +1,36 @@ extends Panel var unit_yau07 = Yau07.YaU07.new('ЯУ07') +var sockets_ind: Array +var node_power_ind: Array func _ready() -> void: Network.connect('yau_receive', Callable(self, '_on_data_received')) Network.connect('yau_status_line', Callable(self, '_on_yau_status')) + sockets_ind = [ + $soc_y5/ems_g/light_ind, + $soc_y5/ug/light_ind, + $soc_y5/ukp_1/light_ind, + $soc_y5/ukp_2/light_ind] + + node_power_ind = [ + $soc_P1/MAA_1/light_ind, + $soc_P1/MAA_2/light_ind, + $soc_P1/IP9_50_2/light_ind, + $soc_P1/IP9_50_1/light_ind, + $soc_P1/IP12_50/light_ind, + $soc_P2/IP9_50/light_ind, + $soc_P2/IP12_50/light_ind, + $soc_y5/IP5_25/light_ind] + func lose_connect_yau(): for i in 4: - var sockets_ind = [$soc_y5/ref_A26/light_ind, - $soc_y5/ref_A27/light_ind, - $soc_y5/ref_A28/light_ind, - $soc_y5/ref_A29/light_ind] sockets_ind[i].button_pressed = false sockets_ind[i].disabled = true - for i in 8: - var node_power_ind = [$soc_P1/ref_A23/light_ind, - $soc_P1/ref_A24/light_ind, - $soc_P1/ref_A25/light_ind, - $soc_P1/ref_A26/light_ind, - $soc_P1/ref_A27/light_ind, - $soc_P1/ref_A28/light_ind, - $soc_P1/ref_A29/light_ind, - $soc_y5/ref_A24/light_ind] node_power_ind[i].button_pressed = false node_power_ind[i].disabled = true @@ -33,13 +38,9 @@ func lose_connect_yau(): 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) # Контроль сухих контактов (УГ) - + ## SOCKETS BOARDS for i in 4: - var sockets_ind = [$soc_y5/ref_A26/light_ind, - $soc_y5/ref_A27/light_ind, - $soc_y5/ref_A28/light_ind, - $soc_y5/ref_A29/light_ind] var j = int(status_board & (1 << i) == 0) if j == 0: sockets_ind[i].button_pressed = true @@ -47,27 +48,21 @@ func _on_data_received(data_from_yau_07): else: sockets_ind[i].button_pressed = false sockets_ind[i].disabled = true - + ## Блок ИП for i in 8: - var node_power_ind = [$soc_P1/ref_A23/light_ind, - $soc_P1/ref_A24/light_ind, - $soc_P1/ref_A25/light_ind, - $soc_P1/ref_A26/light_ind, - $soc_P1/ref_A27/light_ind, - $soc_P1/ref_A28/light_ind, - $soc_P1/ref_A29/light_ind, - $soc_y5/ref_A24/light_ind] var j = int(not(dry_contact & (1 << i) == 0)) + var a = node_power_ind[i] if j == 0: node_power_ind[i].button_pressed = true node_power_ind[i].disabled = false else: node_power_ind[i].button_pressed = false - node_power_ind[i].disabled = true + node_power_ind[i].disabled = true ## From Network status about yau-07 func _on_yau_status(yau_status:bool) -> void: - $soc_y5/ref_A30/light_ind.button_pressed = yau_status - $soc_y5/ref_A30/light_ind.disabled = not yau_status + $device.text = str(Constants.CURRENT_MODE) + $soc_y5/ay07/light_ind.button_pressed = yau_status + $soc_y5/ay07/light_ind.disabled = not yau_status