From ed850de9723a217aea24cf218bb85830196248ab Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 14 Feb 2025 23:58:31 +0300 Subject: [PATCH] =?UTF-8?q?=D0=BD=D0=B0=D1=81=D1=82=D1=80=D0=BE=D0=B9?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BC=D0=B8=D0=BC=D0=B8=D0=BA=D1=80=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PRD_MP550.tscn | 4 +- export_presets.cfg | 8 +- scripts/PRD.gd | 246 +++++++++++++++++++---------------- scripts/constants.gd | 273 +++++++++++++++++++++++++++++++-------- scripts/control_panel.gd | 1 + scripts/network.gd | 10 +- 6 files changed, 372 insertions(+), 170 deletions(-) diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 80d75f1..9be30b5 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -312,12 +312,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 @@ -461,6 +460,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/export_presets.cfg b/export_presets.cfg index 5d06ac2..8e8a837 100644 --- a/export_presets.cfg +++ b/export_presets.cfg @@ -9,7 +9,7 @@ custom_features="" export_filter="all_resources" include_filter="" exclude_filter="" -export_path="" +export_path="bin/testPRD.exe" encryption_include_filters="" encryption_exclude_filters="" encrypt_pck=false @@ -19,9 +19,9 @@ script_export_mode=2 [preset.0.options] custom_template/debug="" -custom_template/release="" -debug/export_console_wrapper=1 -binary_format/embed_pck=false +custom_template/release="E:/Folder_for_Maxim/Maxim_work/template_release/godot.windows.template_release.x86_64.exe" +debug/export_console_wrapper=0 +binary_format/embed_pck=true texture_format/s3tc_bptc=true texture_format/etc2_astc=false binary_format/architecture="x86_64" diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 7d3d71f..51ea406 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -3,11 +3,12 @@ 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 -var CONTROL_TABLE: Array +var node_select_yau_07b: Node +var node_select_yau_07b_2: Node +var node_select_fs_1: Node +var node_select_fs_2: Node var isa_from_yau07b: Dictionary = {} var JSOON = JSON.new() var status_pribor = null @@ -27,111 +28,55 @@ func _ready() -> void: if args[i] == "testsave-path" and i + 1 < args.size(): save_path = args[i + 1] break - - # Таблица УКП_1 + + # Таблица УКП-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 + + # Таблица УКП-2 (Температура, Мощность) node_select2 = $TabContainer/PRD/body_grid/litera_3_5_7/table_ukp_2 draw_tabl(node_select2, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size()) node_select2.set_columns_min_size([120, 120]) - node_select2.set_node_text(0, 0, 'Мощность') - node_select2.set_node_text(1, 0, 'Температура') - - # Таблица ЯУ-07б - var node_select_yau_07b = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control + + # Таблица ЯУ-07б-1 + node_select_yau_07b = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control draw_tabl(node_select_yau_07b, Constants.ROWS_YAU_07B_1, Constants.ROWS_YAU_07B_1.size()) node_select_yau_07b.set_columns_min_size([160, 120]) - node_select_yau_07b.set_node_text(0, 0, 'ПРД-Н') - node_select_yau_07b.set_node_text(1, 0, 'Литера 2') - node_select_yau_07b.set_node_text(0, 1, 'Запрет СИ 2') - node_select_yau_07b.set_node_text(0, 2, 'Модуляция УМ') - node_select_yau_07b.set_node_text(0, 3, 'Положение луча') - node_select_yau_07b.set_node_text(0, 4, 'Аттенюатор УМ') - node_select_yau_07b.set_node_text(0, 6, 'СИ 2 в УФ') - node_select_yau_07b.set_node_text(0, 7, 'СЗИ 2 от УФ') - - var node_select_yau_07b_2 = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control + + # Таблица ЯУ-07б-2 + node_select_yau_07b_2 = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control draw_tabl(node_select_yau_07b_2, Constants.ROWS_YAU_07B_2, Constants.ROWS_YAU_07B_2.size()) node_select_yau_07b_2.set_columns_min_size([160, 120]) - node_select_yau_07b_2.set_node_text(0, 0, 'ПРД-Н') - node_select_yau_07b_2.set_node_text(1, 0, 'Литера 3') - node_select_yau_07b_2.set_node_text(0, 1, 'Запрет СИ 3') - node_select_yau_07b_2.set_node_text(0, 2, 'Модуляция УМ') - node_select_yau_07b_2.set_node_text(0, 3, 'Положение луча') - node_select_yau_07b_2.set_node_text(0, 4, 'Аттенюатор УМ') - node_select_yau_07b_2.set_node_text(0, 5, 'ФГОЗ 3') - node_select_yau_07b_2.set_node_text(0, 6, 'СИ 3 в УФ') - node_select_yau_07b_2.set_node_text(0, 7, 'СЗИ 3 от УФ') - - #Таблица ФС - var node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control + + #Таблица ФС-2 + node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control draw_tabl(node_select_fs_1, Constants.ROWS_FS, Constants.ROWS_FS.size()) node_select_fs_1.set_columns_min_size([150, 120, 150]) - node_select_fs_1.set_node_text(0, 0, 'Модуль ФС') - node_select_fs_1.set_node_text(1, 0, 'Литера 2') - node_select_fs_1.set_node_text(0, 1, 'Состояние') - node_select_fs_1.set_node_text(0, 2, 'Частота') - node_select_fs_1.get_node2(1, 2).placeholder_text = 'в МГц' - node_select_fs_1.get_node2(1, 2).editable = true - node_select_fs_1.set_node_text(0, 3, 'Аттенюатор') - node_select_fs_1.get_node2(1, 3).placeholder_text = 'в dB' - node_select_fs_1.get_node2(1, 3).editable = true - node_select_fs_1.set_node_text(0, 4, 'Модуляция') - node_select_fs_1.get_node2(1, 4).add_item('Const') - node_select_fs_1.get_node2(1, 4).add_item('MSK') - node_select_fs_1.set_node_text(0, 5, 'Генератор ФС') - node_select_fs_1.set_node_text(0, 6, 'СИ 2 от ФС') - node_select_fs_1.set_node_text(0, 7, 'Фильтр CAN') - node_select_fs_1.get_node2(1, 7).placeholder_text = 'в МГц' - node_select_fs_1.get_node2(1, 7).editable = true - node_select_fs_1.set_node_text(0, 8, 'Статус CAN') - - var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control + + #Таблица ФС-2 + 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([150, 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 = 'в МГц' - node_select_fs_2.get_node2(1, 2).editable = true - node_select_fs_2.set_node_text(0, 3, 'Аттенюатор ФС') - node_select_fs_2.get_node2(1, 3).placeholder_text = 'в dB' - node_select_fs_2.get_node2(1, 3).editable = true - node_select_fs_2.set_node_text(0, 4, 'Модуляция') - node_select_fs_2.get_node2(1, 4).add_item('Const') - node_select_fs_2.get_node2(1, 4).add_item('MSK') - node_select_fs_2.set_node_text(0, 5, 'Генератор ФС') - node_select_fs_2.set_node_text(0, 6, 'СИ 3 от ФС') - node_select_fs_2.set_node_text(0, 7, 'Фильтр CAN') - node_select_fs_2.get_node2(1, 7).placeholder_text = 'в МГц' - node_select_fs_2.get_node2(1, 7).editable = true - node_select_fs_2.set_node_text(0, 8, 'Статус CAN') - + # Выбор прибора для подключения 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) - get_select_device.connect('item_selected', Callable(self, 'on_device_selected')) # Заполнение адресов for i_addr in Constants.ADDRESSES.size(): get_select_device.add_item(Constants.ADDRESSES[i_addr][0]) get_select_device.set_item_metadata(i_addr, Constants.ADDRESSES[i_addr].slice(1,7)) - get_select_device.connect('item_selected', Callable(self, 'on_btn_select')) + get_select_device.connect('item_selected', Callable(self, 'on_mode_select')) node_select_device.get_node2(0,0).text = 'ПРИБОР' node_select_device.set_columns_min_size([100, 100]) # Получение выбранного прибора при загрузке - if Constants.ADDRESSES.size() > 0: - get_select_device.select(0) - status_pribor = get_select_device.get_item_text(0).strip_edges().substr(4) + status_pribor = Constants.CURRENT_MODE + add_signs_scene() + ## Заполненение списка модуляции УМ for key in Constants.OUT_x128: node_select_yau_07b.get_node2(1, 2).add_item(key) @@ -146,25 +91,15 @@ func _ready() -> void: for key in Constants.ATT_DICT: node_select_yau_07b.get_node2(1, 4).add_item(key) node_select_yau_07b_2.get_node2(1, 4).add_item(key) - - 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.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) - + ## Yau-07b 1 - 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')) + node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret_2')) + node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_2')) node_select_yau_07b.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_1')) node_select_yau_07b.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_1')) ## Yau-07b 2 - node_select_yau_07b_2.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret2')) - node_select_yau_07b_2.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_2')) + node_select_yau_07b_2.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret_3')) + node_select_yau_07b_2.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_3')) node_select_yau_07b_2.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_2')) 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')) @@ -182,12 +117,88 @@ func _ready() -> void: node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_2')) node_select_fs_2.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro_2')) node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_2')) + + 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.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) -func on_device_selected(selected_index: int) -> void: - var get_select_device = $TabContainer/PRD/select_dev.get_node2(1, 0) - status_pribor = get_select_device.get_item_text(selected_index).strip_edges().substr(4) +func add_signs_scene(): + # Таблица УКП-1 + node_select1.set_node_text(0, 0, 'Мощность') + node_select1.set_node_text(1, 0, 'Температура') + # Таблица УКП-2 + node_select2.set_node_text(0, 0, 'Мощность') + node_select2.set_node_text(1, 0, 'Температура') + + # Таблица ЯУ-07б-1 + node_select_yau_07b.set_node_text(0, 0, Constants.SIGNS[Constants.CURRENT_MODE][0]) # 'ПРД-Н' + node_select_yau_07b.set_node_text(1, 0, Constants.SIGNS[Constants.CURRENT_MODE][1]) # 'Литера 2' + node_select_yau_07b.set_node_text(0, 1, Constants.SIGNS[Constants.CURRENT_MODE][2]) # 'Запрет СИ 2' + node_select_yau_07b.set_node_text(0, 2, Constants.SIGNS[Constants.CURRENT_MODE][3]) # 'Модуляция УМ' + node_select_yau_07b.set_node_text(0, 3, Constants.SIGNS[Constants.CURRENT_MODE][4]) # 'Положение луча' + node_select_yau_07b.set_node_text(0, 4, Constants.SIGNS[Constants.CURRENT_MODE][5]) # 'Аттенюатор УМ' + node_select_yau_07b.set_node_text(0, 6, Constants.SIGNS[Constants.CURRENT_MODE][6]) # 'СИ 2 в УФ' + node_select_yau_07b.set_node_text(0, 7, Constants.SIGNS[Constants.CURRENT_MODE][7]) # 'СЗИ 2 от УФ' + + # Таблица ЯУ-07б-2 + node_select_yau_07b_2.set_node_text(0, 0, Constants.SIGNS[Constants.CURRENT_MODE][8]) # 'ПРД-Н' + node_select_yau_07b_2.set_node_text(1, 0, Constants.SIGNS[Constants.CURRENT_MODE][9]) # 'Литера 3', + node_select_yau_07b_2.set_node_text(0, 1, Constants.SIGNS[Constants.CURRENT_MODE][10]) # 'Запрет СИ 3' + node_select_yau_07b_2.set_node_text(0, 2, Constants.SIGNS[Constants.CURRENT_MODE][11]) # 'Модуляция УМ' + node_select_yau_07b_2.set_node_text(0, 3, Constants.SIGNS[Constants.CURRENT_MODE][12]) # 'Положение луча' + node_select_yau_07b_2.set_node_text(0, 4, Constants.SIGNS[Constants.CURRENT_MODE][13]) # 'Аттенюатор УМ' + node_select_yau_07b_2.set_node_text(0, 5, Constants.SIGNS[Constants.CURRENT_MODE][14]) # 'ФГОЗ 3' + node_select_yau_07b_2.set_node_text(0, 6, Constants.SIGNS[Constants.CURRENT_MODE][15]) # 'СИ 3 в УФ' + node_select_yau_07b_2.set_node_text(0, 7, Constants.SIGNS[Constants.CURRENT_MODE][16]) # 'СЗИ 3 от УФ' + + #Таблица ФС-1 + node_select_fs_1.set_node_text(0, 0, Constants.SIGNS[Constants.CURRENT_MODE][17]) # 'Модуль ФС' + node_select_fs_1.set_node_text(1, 0, Constants.SIGNS[Constants.CURRENT_MODE][18]) # 'Литера 2' + node_select_fs_1.set_node_text(0, 1, Constants.SIGNS[Constants.CURRENT_MODE][19]) # 'Состояние' + node_select_fs_1.set_node_text(0, 2, Constants.SIGNS[Constants.CURRENT_MODE][20]) # 'Частота' + node_select_fs_1.get_node2(1, 2).placeholder_text = 'в МГц' + node_select_fs_1.get_node2(1, 2).editable = true + node_select_fs_1.set_node_text(0, 3, Constants.SIGNS[Constants.CURRENT_MODE][21]) # 'Аттенюатор' + node_select_fs_1.get_node2(1, 3).placeholder_text = 'в dB' + node_select_fs_1.get_node2(1, 3).editable = true + node_select_fs_1.set_node_text(0, 4, Constants.SIGNS[Constants.CURRENT_MODE][22]) # 'Модуляция' + node_select_fs_1.get_node2(1, 4).add_item('Const') + node_select_fs_1.get_node2(1, 4).add_item('MSK') + node_select_fs_1.set_node_text(0, 5, Constants.SIGNS[Constants.CURRENT_MODE][23]) # 'Генератор ФС' + node_select_fs_1.set_node_text(0, 6, Constants.SIGNS[Constants.CURRENT_MODE][24]) # 'СИ 2 от ФС' + node_select_fs_1.set_node_text(0, 7, Constants.SIGNS[Constants.CURRENT_MODE][25]) # 'Фильтр CAN' + node_select_fs_1.get_node2(1, 7).placeholder_text = 'в МГц' + node_select_fs_1.get_node2(1, 7).editable = true + node_select_fs_1.set_node_text(0, 8, Constants.SIGNS[Constants.CURRENT_MODE][26]) # 'Статус CAN' + + #Таблица ФС-2 + node_select_fs_2.set_node_text(0, 0, Constants.SIGNS[Constants.CURRENT_MODE][27]) # 'Модуль ФС' + node_select_fs_2.set_node_text(1, 0, Constants.SIGNS[Constants.CURRENT_MODE][28]) # 'Литера 3' + node_select_fs_2.set_node_text(0, 1, Constants.SIGNS[Constants.CURRENT_MODE][29]) # 'Состояние' + node_select_fs_2.set_node_text(0, 2, Constants.SIGNS[Constants.CURRENT_MODE][30]) # 'Частота ФС' + node_select_fs_2.get_node2(1, 2).placeholder_text = 'в МГц' + node_select_fs_2.get_node2(1, 2).editable = true + node_select_fs_2.set_node_text(0, 3, Constants.SIGNS[Constants.CURRENT_MODE][31]) # 'Аттенюатор ФС' + node_select_fs_2.get_node2(1, 3).placeholder_text = 'в dB' + node_select_fs_2.get_node2(1, 3).editable = true + node_select_fs_2.set_node_text(0, 4, Constants.SIGNS[Constants.CURRENT_MODE][32]) # 'Модуляция' + node_select_fs_2.get_node2(1, 4).add_item('Const') + node_select_fs_2.get_node2(1, 4).add_item('MSK') + node_select_fs_2.set_node_text(0, 5, Constants.SIGNS[Constants.CURRENT_MODE][33]) # 'Генератор ФС' + node_select_fs_2.set_node_text(0, 6, Constants.SIGNS[Constants.CURRENT_MODE][34]) # 'СИ 3 от ФС' + node_select_fs_2.set_node_text(0, 7, Constants.SIGNS[Constants.CURRENT_MODE][35]) # 'Фильтр CAN' + node_select_fs_2.get_node2(1, 7).placeholder_text = 'в МГц' + node_select_fs_2.get_node2(1, 7).editable = true + node_select_fs_2.set_node_text(0, 8, Constants.SIGNS[Constants.CURRENT_MODE][36]) # 'Статус CAN') + func _on_read_isa(unit_isa_ports: Dictionary) -> void: isa_from_yau07b = unit_isa_ports @@ -253,7 +264,6 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: func _on_data_fs_1(fs_1_data): - var node_select_fs_1: GDTable = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control var GRP = fs_1_data.decode_u8(0x0) var CMD = fs_1_data.decode_u8(0x1) match CMD: @@ -284,7 +294,6 @@ func _on_data_fs_1(fs_1_data): func _on_data_fs_2(fs_2_data): - var node_select_fs_2: GDTable = $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: @@ -457,34 +466,42 @@ func set_tab_and_buttons(tab_index: int, button_name: String) -> void: button.button_pressed = (button.name == button_name) -func on_btn_select(intem_from_sector: int) -> void: +func on_mode_select(intem_from_sector: int) -> void: Network.send_array = [] var node_select_device: GDTable = $TabContainer/PRD/select_dev var get_select_device = node_select_device.get_node2(1, 0) var meta = get_select_device.get_item_metadata(intem_from_sector) Constants.CURRENT_MODE = meta[2] + add_signs_scene() Network.on_command_change_device(meta) Network.read_port_isa([Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.UG+6]) _on_start_fs_1() _on_start_fs_2() -func _on_zapret1(toggled_on: bool) -> void: - var meta = 48 +func _on_zapret_1(toggled_on: bool) -> void: + var meta = Constants.META.CI_1_B_UF + 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_zapret_2(toggled_on: bool) -> void: + var meta = Constants.META.CI_2_B_UF 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 = 49 +func _on_zapret_3(toggled_on: bool) -> void: + var meta = Constants.META.CI_3_B_UF 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(item_from_ray_1: int): - var meta = 51 + var meta = Constants.META.MODUL_UM_1 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var modul_um_values = { 1: 0x2000, @@ -497,7 +514,20 @@ func _on_modul_um_1(item_from_ray_1: int): func _on_modul_um_2(item_from_ray_1: int): - var meta = 52 + var meta = Constants.META.MODUL_UM_2 + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) + var modul_um_values = { + 1: 0x2000, + 2: 0x4000, + 3: 0x8000 + } + + var modul_um = modul_um_values.get(item_from_ray_1, 0) + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) + + +func _on_modul_um_3(item_from_ray_1: int): + var meta = Constants.META.MODUL_UM_3 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var modul_um_values = { 1: 0x2000, @@ -510,7 +540,7 @@ func _on_modul_um_2(item_from_ray_1: int): ## Включение/отключение сигнала ФГОЗ func _on_fgos_2(toggled_on: bool): - var meta = 56 + var meta = Constants.META.FGOZ_3 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) diff --git a/scripts/constants.gd b/scripts/constants.gd index 7a4ec75..14b3477 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -1,6 +1,6 @@ extends Node -const UNICAST_PORT: int = 50014 -const UNICAST_ADDRESS: String = '10.1.1.14' +const UNICAST_PORT: int = 50003 +const UNICAST_ADDRESS: String = '10.1.1.3' const BROADCAST_PORT: int = 50000 const DEFAULT_ADDRESS: String = '10.1.1.11' const DEFAULT_PORT: String = '50011' @@ -8,11 +8,14 @@ const CONST_MIN_TEMP: int = -25 const MAXIMUM_CODE_ADC: int = 3796 const MINIMUM_CODE_AD: int = 2660 const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD) +const PORT_FS = 1201 const TableNode = preload("res://table/node.tscn") const TableList = preload("res://table/node_list.tscn") const Switch = preload("res://table/switch.tscn") const SocketStatus = preload("res://table/socket_status.tscn") const Header = preload("res://table/header.tscn") +var EMS_G_PORT_DATA_HOLDER: Array = [] +var CURRENT_MODE: int = ADDRESSES[0][3] const SELECT_DEVICE: Array = [[TableNode, TableList]] const ROWS_REGS_DATA: Array = [ [Header, Header], @@ -63,9 +66,6 @@ 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', @@ -84,57 +84,199 @@ const INPUT_EMS_G: Array = [ '24 :40', '25 :41',] const OUT_EMS_G: Array = [ - [47, '10 :43'], - [48, '11 :44'], - [49, '12 :45'], - [50, '13 :46'], - [51, '14 :47'], - [52, '15 :48'], - [53, '16 :49'], - [54, '17 :50'], - [55, '26 :43'], - [56, '27 :44'], - [57, '28 :45'], - [58, '29 :46'], - [59, '30 :47'], - [60, '31 :48'], - [61, '32 :49'], - [62, '33 :50']] + [47, '10 :43'], + [48, '11 :44'], + [49, '12 :45'], + [50, '13 :46'], + [51, '14 :47'], + [52, '15 :48'], + [53, '16 :49'], + [54, '17 :50'], + [55, '26 :43'], + [56, '27 :44'], + [57, '28 :45'], + [58, '29 :46'], + [59, '30 :47'], + [60, '31 :48'], + [61, '32 :49'], + [62, '33 :50'], +] const OUT_x128: Array = [ - 'Р', - 'К', - 'Откл', - '1' - ] + 'Р', + 'К', + 'Откл', + '1' +] const RAY_DICT: Array = [ - ' -5°', - ' 5°', - ' 15°', - ' 25°', - ' 35°', - ' 45°', - ' Контроль', - ] + ' -5°', + ' 5°', + ' 15°', + ' 25°', + ' 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', - ] + ' 0 dB', + ' 0.5 dB', + ' 2 dB', + ' 2.5 dB', + ' 8 dB', + ' 8.5 dB', + ' 10 dB', + ' 10.5 dB', +] +const SIGNS: Dictionary = { + MODE.PRD_H: [ + # ЯУ-07б-1 + 'ПРД-Н', + 'Литера 2', + 'Запрет СИ 2', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + 'СИ 2 в УФ', + 'СЗИ 2 от УФ', + + # ЯУ-07б-2 + 'ПРД-Н', + 'Литера 3', + 'Запрет СИ 3', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + 'ФГОЗ 3', + 'СИ 3 в УФ', + 'СЗИ 3 от УФ', + + # ФС-1 + 'Модуль ФС', + 'Литера 2', + 'Состояние', + 'Частота', + 'Аттенюатор', + 'Модуляция', + 'Генератор ФС', + 'СИ 2 от ФС', + 'Фильтр CAN', + 'Статус CAN', + + # ФС-2 + 'Модуль ФС', + 'Литера 3', + 'Состояние', + 'Частота ФС', + 'Аттенюатор ФС', + 'Модуляция', + 'Генератор ФС', + 'СИ 3 от ФС', + 'Фильтр CAN', + 'Статус CAN', + ], + MODE.PRD_B: [ + # ЯУ-07б-1 + 'ПРД-В', + 'Литера 4', + 'Запрет СИ 4', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + 'СИ 4 в УФ', + 'СЗИ 4 от УФ', + + # ЯУ-07б-2 + 'ПРД-В', + 'Литера 5', + 'Запрет СИ 5', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + 'ФГОЗ 5', + 'СИ 5 в УФ', + 'СЗИ 5 от УФ', + + # ФС-1 + 'Модуль ФС', + 'Литера 4', + 'Состояние', + 'Частота', + 'Аттенюатор', + 'Модуляция', + 'Генератор ФС', + 'СИ 4 от ФС', + 'Фильтр CAN', + 'Статус CAN', + + # ФС-2 + 'Модуль ФС', + 'Литера 5', + 'Состояние', + 'Частота ФС', + 'Аттенюатор ФС', + 'Модуляция', + 'Генератор ФС', + 'СИ 5 от ФС', + 'Фильтр CAN', + 'Статус CAN', + ], + MODE.PRD_K: [ + # ЯУ-07б-1 + 'ПРД-К', + 'Литера 6', + 'Запрет СИ 6', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + 'СИ 6 в УФ', + 'СЗИ 6 от УФ', + + # ЯУ-07б-2 + 'ПРД-К', + 'Литера 7', + 'Запрет СИ 7', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + 'ФГОЗ 7', + 'СИ 7 в УФ', + 'СЗИ 7 от УФ', + + # ФС-1 + 'Модуль ФС', + 'Литера 6', + 'Состояние', + 'Частота', + 'Аттенюатор', + 'Модуляция', + 'Генератор ФС', + 'СИ 6 от ФС', + 'Фильтр CAN', + 'Статус CAN', + + # ФС-2 + 'Модуль ФС', + 'Литера 7', + 'Состояние', + 'Частота ФС', + 'Аттенюатор ФС', + 'Модуляция', + 'Генератор ФС', + 'СИ 7 от ФС', + 'Фильтр CAN', + 'Статус CAN', + ], +} + enum BASE_PORTS { - UG = 0x100, + UG = 0x100, EMS_G = 0x120, UKP_1 = 0x130, UKP_2 = 0x140, } enum MODE { - PRD_K, - PRD_B, PRD_H, + PRD_B, + PRD_K, } enum Frame { WORK, ## В работе @@ -168,16 +310,11 @@ enum STATE_VAL { GOOD = 1, ERROR = 2 } -var EMS_G_PORT_DATA_HOLDER: Array = [] - -const PORT_FS = 1201 - enum GROUP { BASE = 0x00, GENERATOR = 0x03, RF = 0x06, } - enum CMD { START_SESSION = 0x0, READ_CARRIER = 0x1F, @@ -189,3 +326,37 @@ enum CMD { BASE_GET_CURRENT_TEMP = 0x36, BASE_CAN_MACRO_READ = 0x33, } +enum META { + CZI_1 = 1, + CZI_2 = 2, + CZI_3 = 3, + CZI_4 = 4, + CZI_5 = 5, + CZI_6 = 6, + CZI_7 = 7, + CI_1_OT_FS = 9, + CI_2_OT_FS = 10, + CI_3_OT_FS = 11, + CI_4_OT_FS = 12, + CI_5_OT_FS = 13, + CI_6_OT_FS = 14, + CI_7_OT_FS = 15, + CI_1_B_UF = 47, + CI_2_B_UF = 48, + CI_3_B_UF = 49, + CI_4_B_UF = 48, + CI_5_B_UF = 49, + CI_6_B_UF = 48, + CI_7_B_UF = 49, + MODUL_UM_1 = 50, + MODUL_UM_2 = 51, + MODUL_UM_3 = 52, + MODUL_UM_4 = 51, + MODUL_UM_5 = 52, + MODUL_UM_6 = 51, + MODUL_UM_7 = 52, + FGOZ_4 = 55, + FGOZ_6 = 55, + FGOZ_3 = 56, + FGOZ_5 = 56, +} diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 4c7ca6c..9b012be 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -43,6 +43,7 @@ func _ready() -> void: $Kasseta_FS/Block_FS_PRD_K, $Kasseta_FS/FS_PRD_K] count_cell = len(node_cell_ind) + _draw_control_panel_prd(Constants.CURRENT_MODE) func _on_timer(pribor_prd): diff --git a/scripts/network.gd b/scripts/network.gd index 42d427c..793e72a 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -114,15 +114,15 @@ func _ready() -> void: unit.connect('line_changed', Callable(self, 'on_line_changed')) unit.connect('command_fail', Callable(self, 'on_command_fail')) - write_port_isa(Constants.BASE_PORTS.EMS_G+2, 48) + write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CI_2_B_UF) read_port_isa([Constants.BASE_PORTS.EMS_G+8]) - write_port_isa(Constants.BASE_PORTS.EMS_G+2, 49) + write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CI_3_B_UF) read_port_isa([Constants.BASE_PORTS.EMS_G+8]) - write_port_isa(Constants.BASE_PORTS.EMS_G+2, 51) + write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_2) read_port_isa([Constants.BASE_PORTS.EMS_G+8]) - write_port_isa(Constants.BASE_PORTS.EMS_G+2, 52) + write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3) read_port_isa([Constants.BASE_PORTS.EMS_G+8]) - write_port_isa(Constants.BASE_PORTS.EMS_G+2, 56) + write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.FGOZ_3) read_port_isa([Constants.BASE_PORTS.EMS_G+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+8]) connect_fs_1() start_work_fs()