From de876c9a765c8ec0313686ab355ff1948aaf80b4 Mon Sep 17 00:00:00 2001 From: kira-a-k Date: Mon, 24 Nov 2025 20:01:44 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0.=20=D0=9A=D0=BD=D0=BE=D0=BF=D0=BA=D0=B0=20=D0=BF?= =?UTF-8?q?=D0=BE=D0=BA=D0=B0=D0=B7=D0=B0=20=D1=81=D1=85=D0=B5=D0=BC=D1=8B?= =?UTF-8?q?=20=D0=B8=20=D1=81=D0=BD=D1=8F=D1=82=D0=B8=D0=B5=20=D0=B2=D1=8B?= =?UTF-8?q?=D0=B1=D0=BE=D1=80=D0=B0=20=D0=BF=D1=80=D0=B8=D0=B1=D0=BE=D1=80?= =?UTF-8?q?=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- scenes/diagram/diagram.gd | 4 +- scenes/frame-ecm-list/frm-ecm-list.tscn | 2 +- scenes/frame-ecm-list/scroll-ecm-list.gd | 2 +- scenes/grid-buttons-ecm/grid-buttons-ecm.tscn | 2 +- scenes/pribor-afsp/pribor-afsp-1.tscn | 2 - scenes/pribor-afsp/pribor-afsp-2.tscn | 8 +- scenes/pribor-afsp/pribor-afsp.gd | 2 +- scenes/pribor-afsp/pribor-bpo.tscn | 60 +- scenes/pribor-prd-k/kasseta-fs-kd.tscn | 8 +- scenes/pribor-prd-k/pribor-prd-k.gd | 333 ++-- scenes/pribor-prd-k/pribor-prd-k.tscn | 319 ++-- scenes/pribor-prd-n/pribor-prd-n.gd | 307 ++-- scenes/pribor-prd-n/pribor-prd-n.tscn | 353 ++-- scenes/pribor-prd-v/pribor-prd-v.gd | 311 ++-- scenes/pribor-prd-v/pribor-prd-v.tscn | 345 ++-- scenes/pribor-uf/pribor-uf.gd | 2 +- scenes/pribor-uf/pribor-uf.tscn | 30 +- scenes/pribor-uyep/pribor-uyep.tscn | 32 +- scenes/tabs-switch/lbl_ready.gd | 2 +- scenes/tabs-switch/tab-switch.tscn | 38 +- scenes/tilemap/mark.tscn | 2 +- scenes/tilemap/ship_mark.tscn | 2 +- scenes/tilemap/threat.tscn | 2 +- scenes/tilemap/tilemap.gd | 4 +- scenes/контроль/блок-в.tscn | 22 +- scenes/контроль/кассета-п-2.tscn | 9 +- scenes/контроль/кассета-у-5-нв.tscn | 12 +- scenes/контроль/кнопка-прибора.gd | 78 +- scenes/контроль/контроль.tscn | 807 ++++---- scenes/настройки/настройки.tscn | 20 +- scenes/работа/работа.gd | 43 +- scenes/работа/работа.tscn | 16 +- scenes/эмс2/эмс_тг.gd | 49 +- scripts/interfer.gd | 28 +- scripts/prd.gd | 5 - scripts/pribor-prd.gd | 1618 +++++++---------- scripts/signaller.gd | 9 - settings.json | 25 +- shaders/antenas.tres | 25 +- table/table.gd | 15 +- 41 files changed, 2184 insertions(+), 2771 deletions(-) diff --git a/README.md b/README.md index aa9e039..0f44954 100644 --- a/README.md +++ b/README.md @@ -36,4 +36,4 @@ - После клонирования запустить скрипт `git-hooks-config.sh` - В среде **Windows** запуск скрипта `git-hooks-config.sh` производить из оболочки `git bash` - Нужно обновить `settings.json` -- поиск циклических зависимостей +- поиск циклических зависимостей (не реализованно) diff --git a/scenes/diagram/diagram.gd b/scenes/diagram/diagram.gd index 97d5035..d1ad627 100644 --- a/scenes/diagram/diagram.gd +++ b/scenes/diagram/diagram.gd @@ -35,8 +35,10 @@ func get_radius_outter() -> float: return material.get('shader_parameter/radius func get_radius_inner_0() -> float: return material.get('shader_parameter/radius_inner_0') func get_radius_inner_1() -> float: return material.get('shader_parameter/radius_inner_1') +func get_band_colors(val: Array): return material.get('shader_parameter/ant_band_c') +func get_band_failures(val: Array): return material.get('shader_parameter/ant_band_m') func set_band_colors(val: Array): material.set('shader_parameter/ant_band_c', val) - +func set_band_failures(val: Array): material.set('shader_parameter/ant_band_m', val) ## Добавляет сектор запрета[br] ## [param id] - Индекс сектора запрета.[br] diff --git a/scenes/frame-ecm-list/frm-ecm-list.tscn b/scenes/frame-ecm-list/frm-ecm-list.tscn index db6c658..e008661 100644 --- a/scenes/frame-ecm-list/frm-ecm-list.tscn +++ b/scenes/frame-ecm-list/frm-ecm-list.tscn @@ -65,7 +65,7 @@ layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 strips_rotation = 15.0 -text = "JTIDS" +text = "СПРС" metadata/rfi_name = "sprs" [node name="btn_kupd" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")] diff --git a/scenes/frame-ecm-list/scroll-ecm-list.gd b/scenes/frame-ecm-list/scroll-ecm-list.gd index a9bae1b..8ad0a9f 100644 --- a/scenes/frame-ecm-list/scroll-ecm-list.gd +++ b/scenes/frame-ecm-list/scroll-ecm-list.gd @@ -8,7 +8,7 @@ const TableHeader = preload('res://table/header.tscn') ## Ячейка за const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader , TableHeader ] ## Описание ряда заголовка. const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit , CellLineEdit ] ## Описание ряда. const TABLE_HEADERS_TEXT = ['№', 'Название', 'Пеленг', 'Состояние' ] ## Заголовки таблицы. -const TABLE_COLUMN_SIZE = [ 65, 100, 90, 195 ] ## Ширины колонок. +const TABLE_COLUMN_SIZE = [ 65, 100, 90, 170 ] ## Ширины колонок. ## Состояние выполнения сеанса помехи const INTERFER_STATE = { diff --git a/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn b/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn index d938451..a1b2522 100644 --- a/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn +++ b/scenes/grid-buttons-ecm/grid-buttons-ecm.tscn @@ -147,6 +147,6 @@ layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 strips_rotation = 30.0 -text = "ЕРЛС" +text = "ЕПРЛС" disabled = true metadata/rfi_name = "eprls" diff --git a/scenes/pribor-afsp/pribor-afsp-1.tscn b/scenes/pribor-afsp/pribor-afsp-1.tscn index 1e3e72c..867517f 100644 --- a/scenes/pribor-afsp/pribor-afsp-1.tscn +++ b/scenes/pribor-afsp/pribor-afsp-1.tscn @@ -30,9 +30,7 @@ autostart = true [node name="bort" parent="." instance=ExtResource("3_d7iti")] layout_mode = 0 -offset_left = 24.0 offset_top = 27.7778 -offset_right = 604.0 offset_bottom = 1216.78 metadata/DeviceName = &"Устройство РР левого борта" diff --git a/scenes/pribor-afsp/pribor-afsp-2.tscn b/scenes/pribor-afsp/pribor-afsp-2.tscn index 687a573..51ff32d 100644 --- a/scenes/pribor-afsp/pribor-afsp-2.tscn +++ b/scenes/pribor-afsp/pribor-afsp-2.tscn @@ -7,9 +7,9 @@ [node name="pribor_afsp" type="Control"] layout_mode = 3 anchors_preset = 0 -offset_left = 82.0 +offset_left = 81.0 offset_top = 108.0 -offset_right = 82.0 +offset_right = 81.0 offset_bottom = 108.0 scale = Vector2(1, 0.9) script = ExtResource("1_tfses") @@ -30,9 +30,9 @@ autostart = true [node name="bort" parent="." instance=ExtResource("3_xpxb5")] layout_mode = 0 -offset_left = 12.0 +offset_left = -11.0 offset_top = -59.0 -offset_right = 592.0 +offset_right = 569.0 offset_bottom = 1130.0 metadata/DeviceName = &"Устройство РР правого борта" diff --git a/scenes/pribor-afsp/pribor-afsp.gd b/scenes/pribor-afsp/pribor-afsp.gd index 7437ff9..67a150b 100644 --- a/scenes/pribor-afsp/pribor-afsp.gd +++ b/scenes/pribor-afsp/pribor-afsp.gd @@ -99,4 +99,4 @@ func _on_request_completed(result, _response_code, headers, body: PackedByteArra func _on_item_pressed(block_a: Control): var metas = block_a.get_meta_list() for n in metas: - var _v = block_a.get_meta(n) + var v = block_a.get_meta(n) diff --git a/scenes/pribor-afsp/pribor-bpo.tscn b/scenes/pribor-afsp/pribor-bpo.tscn index 06d13c7..36d5db0 100644 --- a/scenes/pribor-afsp/pribor-bpo.tscn +++ b/scenes/pribor-afsp/pribor-bpo.tscn @@ -9,9 +9,9 @@ layout_mode = 3 anchors_preset = 0 offset_left = 115.0 -offset_top = 148.0 +offset_top = 150.0 offset_right = 115.0 -offset_bottom = 148.0 +offset_bottom = 150.0 script = ExtResource("1_bhc4e") prefix_path = "DeviceDescription[DeviceName]" this_bpo1_name = "Устройство БПО левого борта" @@ -24,10 +24,10 @@ settings_path_to_wait_time = "Период опроса состояния БП [node name="mod_pit_g1" parent="." instance=ExtResource("2_jp6m0")] layout_mode = 2 -offset_left = 9.0 -offset_top = 377.0 -offset_right = 529.0 -offset_bottom = 447.0 +offset_left = 40.0 +offset_top = 535.0 +offset_right = 560.0 +offset_bottom = 605.0 size_flags_horizontal = 7 size_flags_vertical = 7 fname = "Модуль электропитания" @@ -35,20 +35,20 @@ rname = "G1" [node name="blok_bpo_a1" parent="." instance=ExtResource("2_jp6m0")] layout_mode = 0 -offset_left = 9.0 -offset_top = -23.0 -offset_right = 529.0 -offset_bottom = 172.0 +offset_left = 40.0 +offset_top = 135.0 +offset_right = 560.0 +offset_bottom = 330.0 show_state = false fname = "Блок БПО левого борта" rname = "А1" [node name="grid_bpo_a1" type="GridContainer" parent="."] layout_mode = 0 -offset_left = 19.0 -offset_top = 17.0 -offset_right = 467.0 -offset_bottom = 162.0 +offset_left = 50.0 +offset_top = 175.0 +offset_right = 498.0 +offset_bottom = 320.0 columns = 4 [node name="kanal1" parent="grid_bpo_a1" groups=["потребитель-питания"] instance=ExtResource("2_jp6m0")] @@ -108,30 +108,30 @@ fname = "Канал 8" metadata/state = "SelfTest[0].SystemList[0].DevList[7]['TestPassed']" [node name="yas_bpo_a1" parent="." groups=["потребитель-питания"] instance=ExtResource("3_jcpjs")] -offset_left = 469.0 -offset_top = 17.0 -offset_right = 519.0 -offset_bottom = 162.0 +offset_left = 500.0 +offset_top = 175.0 +offset_right = 550.0 +offset_bottom = 320.0 show_rname = false self_size = Vector2i(50, 145) fname = "Яч. связи" [node name="blok_bpo_a2" parent="." instance=ExtResource("2_jp6m0")] layout_mode = 0 -offset_left = 9.0 -offset_top = 177.0 -offset_right = 529.0 -offset_bottom = 372.0 +offset_left = 40.0 +offset_top = 335.0 +offset_right = 560.0 +offset_bottom = 530.0 show_state = false fname = "Блок БПО правого борта" rname = "А2" [node name="grid_bpo_a2" type="GridContainer" parent="."] layout_mode = 0 -offset_left = 19.0 -offset_top = 217.0 -offset_right = 467.0 -offset_bottom = 362.0 +offset_left = 50.0 +offset_top = 375.0 +offset_right = 498.0 +offset_bottom = 520.0 columns = 4 [node name="kanal1" parent="grid_bpo_a2" groups=["потребитель-питания", "управляется-по-шине-2"] instance=ExtResource("2_jp6m0")] @@ -191,10 +191,10 @@ fname = "Канал 8" metadata/state = "SelfTest[0].SystemList[0].DevList[7]['TestPassed']" [node name="yas_bpo_a2" parent="." groups=["потребитель-питания"] instance=ExtResource("3_jcpjs")] -offset_left = 469.0 -offset_top = 217.0 -offset_right = 519.0 -offset_bottom = 362.0 +offset_left = 500.0 +offset_top = 375.0 +offset_right = 550.0 +offset_bottom = 520.0 show_rname = false self_size = Vector2i(50, 145) fname = "Яч. связи" diff --git a/scenes/pribor-prd-k/kasseta-fs-kd.tscn b/scenes/pribor-prd-k/kasseta-fs-kd.tscn index 3fcc635..ac2d952 100644 --- a/scenes/pribor-prd-k/kasseta-fs-kd.tscn +++ b/scenes/pribor-prd-k/kasseta-fs-kd.tscn @@ -49,7 +49,7 @@ offset_top = 33.0 offset_right = 155.0 offset_bottom = 183.0 fname = "Блок ФС-2" -rname = "A6" +rname = "A2" [node name="ref_A6" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")] offset_left = 155.0 @@ -57,7 +57,7 @@ offset_top = 33.0 offset_right = 205.0 offset_bottom = 183.0 fname = "Модуль ФС" -rname = "A3" +rname = "A5" metadata/fs = "fs_6" [node name="ref_A5" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")] @@ -66,7 +66,7 @@ offset_top = 33.0 offset_right = 255.0 offset_bottom = 183.0 fname = "Модуль ФС" -rname = "A2" +rname = "A3" metadata/fs = "fs_7" [node name="ref_A7" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")] @@ -75,4 +75,4 @@ offset_top = 33.0 offset_right = 305.0 offset_bottom = 183.0 fname = "Блок ФС-6" -rname = "A5" +rname = "A6" diff --git a/scenes/pribor-prd-k/pribor-prd-k.gd b/scenes/pribor-prd-k/pribor-prd-k.gd index 6cc1096..12be888 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.gd +++ b/scenes/pribor-prd-k/pribor-prd-k.gd @@ -1,172 +1,252 @@ @tool extends 'res://scenes/контроль/прибор.gd' +const constants_k: Dictionary = { + 'POWER_UKP_1': 31, + 'POWER_UKP_2': 63, + 'DKM_BIT_1': 0, + 'DKM_BIT_6': 5, + 'DKM_BIT_7': 6, + 'BASE_ADDR_EMS_G': 0x120, + 'ADDR_UG_LITERA_1': 0x106, + 'ADDR_UG_LITERA_2': 0x108, + 'ADDR_UG_LITERA_3': 0x10A, + 'TEMP_THRESHOLD': 40, + 'POWER_THRESHOLD': 40, + 'RAY_DOU_NUM': 0x3, + 'ATT_UM_1': 0x0, + 'ATT_UM_6': 0x3, + 'ATT_UM_7': 0x2, + 'POWER_UM': 100, + 'TIMER_DELAY': 10.0, + 'STATE_MASHINE_TIMER': 0.3, +} +# Конфигурация параметров для каждого прибора +const PRIBOR_CONFIG := { + '1к': {'angle': 0.0, 'sectors': [0, 20, 24]}, + '2к': {'angle': 90.0, 'sectors': [3, 23, 27]}, + '3к': {'angle': 180.0, 'sectors': [2, 22, 26]}, + '4к': {'angle': 270.0, 'sectors': [1, 21, 25]}, +} +# Конфигурация частот и ширин для каждого ФС +const FS_PARAMS := { + 1: {'freq': 450.0, 'width': 80.0}, + 6: {'freq': 2450.0, 'width': 110.0}, + 7: {'freq': 4750.0, 'width': 110.0} +} enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 } +var block_ip_config_k := { + 'maa2000_1': [0, false], + 'maa2000_2': [1, false], + 'ip9_50_1': [2, false], + 'ip9_50_2': [3, false], + 'ip12_50_1': [4, false], + 'ip9_50_3': [5, false], + 'ip12_50_2': [6, false], + 'ip5_25': [7, false], +} +var block_kasseta_y5_prd_config_k: = { + 'yau07': false, + 'ems': false, + 'ug': false, + 'ukp1': false, + 'ukp2': false, +} # Основные переменные +var start_litera: int = 1 +var ug_work_1: int = 3 ## Аттенюация усилителей мощности +var ug_work_2: int = 2 ## Аттенюация усилителей мощности +var ug_work_3: int = 0 ## Аттенюация усилителей мощности +var mashine_timer: Timer = Timer.new() +var prd_k_module: Object var unit_prd_k: Object +var control_prd_k: Object +# Результаты контроля +var control_results_k: Dictionary = { + 'block_ip': false, # Проверка касет П1 и ИП МА2000 + 'temperature': true, + 'dkm_1': false, + 'dkm_6': false, + 'dkm_7': false, + 'dou_6': false, + 'dou_7': false, + 'fs_1': 2, + 'fs_6': 2, + 'fs_7': 2, +} + +var test_control_k = preload('res://scripts/pribor-prd.gd') var ctrl_pos = 30 func _ready() -> void: if Engine.is_editor_hint(): return - var unit_name = get_meta('unit_name')[0] - var prd_k_module = prd.prd_dict[unit_name] - unit_prd_k = prd_k_module.unit_control - var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - for temp in power_amplifier: - temp.value1 = -70 - # Подписываемся на сигналы - unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device')) - unit_prd_k.connect('status_updated', Callable(self, '_on_status_updated')) - # Устанавливаем начальный статус - _update_status_text(unit_prd_k.get_current_status()) - on_press_device() - -func _process(_delta: float) -> void: - if Engine.is_editor_hint(): - return - set_frame($input_0, unit_prd_k.ems_g_sock_dic.ems_input_1) - set_frame($input_1, unit_prd_k.ems_g_sock_dic.ems_input_2) - set_frame($input_2, unit_prd_k.ems_g_sock_dic.ems_input_lit_1) - set_frame($output_0, unit_prd_k.ems_g_sock_dic.ems_output_1) - set_frame($output_1, unit_prd_k.ems_g_sock_dic.ems_output_2) - set_frame($output_2, unit_prd_k.ems_g_sock_dic.ems_output_lit_1) - - -func set_frame(node_frame: Node, val: int): node_frame.set_frame(val) - - -func start_control() -> void: - set_default_state(get_tree().get_nodes_in_group('default_reset'), get_tree().get_nodes_in_group('power_amplifier')) + initialize_connections() + setup_timer() + set_default_state() find_labels(self) -static func set_default_state(default_reset_array_node: Array, power_amplifier_arr_node: Array) -> void: - for group in default_reset_array_node: +func on_state_mashine() -> void: + control_prd_k.state_control_machine() + + +func initialize_connections() -> void: + var unit_name = get_meta('unit_name')[0] + prd_k_module = prd.prd_dict[unit_name] + unit_prd_k = prd_k_module.unit_yau07 + + unit_prd_k.connect('line_changed', Callable(self, 'on_line_changed')) + var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier') + var init_data: Dictionary = { + 'control_label': $control_result, + 'power_amplifiers': power_amplifiers, + 'unit_prd': unit_prd_k, + 'module_prd' : prd_k_module, + 'constants': constants_k, + 'prd_config': PRIBOR_CONFIG, + 'fs_params': FS_PARAMS, + 'block_ip_prd_config': block_ip_config_k, + 'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_k, + 'control_results': control_results_k, + 'current_litera': start_litera, + } + control_prd_k = test_control_k.TestPRD.new(init_data) + add_child(control_prd_k) + control_prd_k.connect('control_is_over', Callable(self, 'on_control_result')) + + +func setup_timer() -> void: + add_child(mashine_timer) + mashine_timer.connect('timeout', Callable(self, 'on_state_mashine')) + mashine_timer.wait_time = constants_k.STATE_MASHINE_TIMER + mashine_timer.start() + + +func set_default_state() -> void: + for group in get_tree().get_nodes_in_group('default_reset'): group.state = STATE_VAL.NONE - for group in power_amplifier_arr_node: + for group in get_tree().get_nodes_in_group('power_amplifier'): group.state = STATE_VAL.NONE func _enter_tree() -> void: if Engine.is_editor_hint(): return - if unit_prd_k: - _update_status_text(unit_prd_k.get_current_status()) + $control_result.text = 'Выполняется ...' + $control_result.add_theme_color_override('font_color', Color.ALICE_BLUE) + signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true)) func _exit_tree() -> void: if Engine.is_editor_hint(): return - #prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) + prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) -static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void: - for i_node_temperature in temperature_arr_node: - var temperature_meta: String = i_node_temperature.get_meta('um') - if not temperature_dic.has(temperature_meta): return - i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40 +func on_line_changed(unit_pribor: Object) -> void: + if not unit_pribor.online: + set_default_state() -static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void: - for i_node_temperature in power_amplifier_arr_node: - var powamp_meta: String = i_node_temperature.get_meta('um') - var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE - if not pow_dic.has(powamp_meta): return - # Проверки fs_result - if powamp_meta == 'um_8' and not fs_result.fs_1: return - if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return - if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: return - - if powamp_meta == 'um_8': - i_node_temperature.value0 = [pow_dic[powamp_meta][5]] - status = STATE_VAL.ERROR if pow_dic[powamp_meta][5] < POWER_THRESHOLD else STATE_VAL.GOOD - else: - i_node_temperature.value0 = pow_dic[powamp_meta] - # Проверки 3 значения = исправен - var count_above_threshold = 0 - for i_p in pow_dic[powamp_meta]: - if i_p >= POWER_THRESHOLD: - count_above_threshold += 1 - status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR - i_node_temperature.state = status +func on_mode_changed(in_tree: bool) -> void: + if not in_tree: + mashine_timer.stop() + prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) + signaller.emit_signal('interfer_off_all') + else: + set_default_state() + control_prd_k.state = control_prd_k.STATE_MASHINE.INIT + mashine_timer.start() -func on_press_device() -> void: - var nodes_y5: Array = get_tree().get_nodes_in_group('y-5') - var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') - var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group') +func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: + #if not control_prd_k.block_kasseta_y5_config.yau07 or not control_prd_k.block_kasseta_y5_config.ukp1 or not control_prd_k.block_kasseta_y5_config.ukp2: + #return var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - var default_reset_array_node: Array = get_tree().get_nodes_in_group('default_reset') - var module_fs_1: Node = $kasseta_fs_kd/ref_A2 - var module_fs_6: Node = $kasseta_fs_kd/ref_A4 - var dou_6: Node = $dou6_A7 - var module_fs_7: Node = $kasseta_fs_kd/ref_A7 - var dou_7: Node = $dou7_A8 - var control_data: Dictionary = unit_prd_k.get_control_results() - var for_control_result: Dictionary = { - 'nodes_y5': nodes_y5, - 'node_ip_power_arr': node_ip_power_arr, - 'fs_nodes': fs_nodes, - 'power_amplifier': power_amplifier, - 'default_reset_array_node': default_reset_array_node, - 'module_fs_1': module_fs_1, - 'module_fs_6': module_fs_6, - 'dou_6': dou_6, - 'module_fs_7': module_fs_7, - 'dou_7': dou_7, - } - for_control_result.merge(control_data, true) - on_control_result(for_control_result) + for i_powapm in power_amplifier: + var powamp_meta: String = i_powapm.get_meta('um') + var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE + if pow_dic: + if not pow_dic.has(powamp_meta): + break + if pow_dic[powamp_meta].size() < 6: + status = STATE_VAL.ERROR + else: + if powamp_meta == 'um_7' and not fs_result.fs_1: return + if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return + if powamp_meta in ['um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13'] and not fs_result.fs_7: return + i_powapm.value0 = pow_dic[powamp_meta] + for i_p in pow_dic[powamp_meta]: + if i_p < constants_k.POWER_THRESHOLD: + status = STATE_VAL.ERROR + i_powapm.state = status -static func on_control_result(for_result_dic: Dictionary) -> void: - temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um) - - var block_kasseta_y5_prd_config_k: Dictionary = for_result_dic.block_kasseta_y5_config - var nodes_y5: Array = for_result_dic.nodes_y5 +func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void: + mashine_timer.stop() + block_kasseta_y5_prd_config_k = control_prd_k.block_kasseta_y5_config + var nodes_y5: Array = get_tree().get_nodes_in_group('y-5') for node_y5 in nodes_y5: var meta_y5 = node_y5.get_meta('y5') if block_kasseta_y5_prd_config_k.has(meta_y5): - if not block_kasseta_y5_prd_config_k['yau07']: + if block_kasseta_y5_prd_config_k['yau07'] == false: node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE - else: - node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR + break + node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR - var block_ip_config_k: Dictionary = for_result_dic.block_ip_config - for power_supply in for_result_dic.node_ip_power_arr: + block_ip_config_k = control_prd_k.block_ip_config + var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') + for power_supply in node_ip_power_arr: var meta_ip = power_supply.get_meta('ip') - if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug and block_kasseta_y5_prd_config_k.yau07: + if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug: power_supply.state = STATE_VAL.GOOD if block_ip_config_k[meta_ip][1] else STATE_VAL.ERROR - else: - power_supply.state = STATE_VAL.NONE - if not for_result_dic.control_is_over: - set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier) - return - var result_dic: Dictionary = for_result_dic.result_dic - for f in for_result_dic.fs_nodes: + var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group') + for f in fs_nodes: var fs_meta: String = f.get_meta('fs') if result_dic.has(fs_meta): - f.state = result_dic[fs_meta] + var new_state = result_dic[fs_meta] + f.state = new_state + result_dic[fs_meta] = new_state - if result_dic.fs_1 == 1 and block_kasseta_y5_prd_config_k['yau07']: - for_result_dic.module_fs_1.state = STATE_VAL.GOOD if result_dic.dkm_1 else STATE_VAL.ERROR + if result_dic.fs_1 == 1: + $kasseta_fs_kd/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_1 else STATE_VAL.ERROR + else: + result_dic.fs_1 = false + if result_dic.fs_6 == 1: + $kasseta_fs_kd/ref_A4.state = STATE_VAL.GOOD if result_dic.dkm_6 else STATE_VAL.ERROR + $dou6_A7.state = STATE_VAL.GOOD if result_dic.dou_6 else STATE_VAL.ERROR + else: + result_dic.fs_6 = false + if result_dic.fs_7 == 1: + $kasseta_fs_kd/ref_A7.state = STATE_VAL.GOOD if result_dic.dkm_7 else STATE_VAL.ERROR + $dou7_A8.state = STATE_VAL.GOOD if result_dic.dou_7 else STATE_VAL.ERROR + else: + result_dic.fs_7 = false - if result_dic.fs_6 == 1 and block_kasseta_y5_prd_config_k['yau07']: - for_result_dic.module_fs_6.state = STATE_VAL.GOOD if result_dic.dkm_6 else STATE_VAL.ERROR - for_result_dic.dou_6.state = STATE_VAL.GOOD if result_dic.dou_6 else STATE_VAL.ERROR + power_fill(power_dic, result_dic) - if result_dic.fs_7 == 1 and block_kasseta_y5_prd_config_k['yau07']: - for_result_dic.module_fs_7.state = STATE_VAL.GOOD if result_dic.dkm_7 else STATE_VAL.ERROR - for_result_dic.dou_7.state = STATE_VAL.GOOD if result_dic.dou_7 else STATE_VAL.ERROR - - if block_kasseta_y5_prd_config_k['yau07']: - power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD) + var result = true + for device in result_dic.values(): + if not device: + result = false + + var name_prd = control_prd_k.self_name + if result: + $control_result.text = 'Прибор ПРД-%s исправен' % name_prd + $control_result.add_theme_color_override('font_color', Color.GREEN) + else: + $control_result.text = 'Прибор ПРД-%s неисправен' % name_prd + $control_result.add_theme_color_override('font_color', Color.RED) func find_labels(node1: Node): @@ -183,22 +263,3 @@ func find_labels(node1: Node): node1.set_meta("tooltip_set", true) for child in node1.get_children(): find_labels(child) - - -func _on_status_updated(status_text: String) -> void: - _update_status_text(status_text) - - -func _update_status_text(text: String) -> void: - $control_result.text = text - # Можно добавить смену цвета в зависимости от статуса - if "Ошибка" in text or "неисправен" in text: - $control_result.add_theme_color_override('font_color', Color.RED) - log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_k.self_name]) - elif "Ограничена" in text or "Предупреждение" in text: - $control_result.add_theme_color_override('font_color', Color.YELLOW) - elif "исправен" in text or "завершён" in text: - $control_result.add_theme_color_override('font_color', Color.GREEN) - log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_k.self_name]) - else: - $control_result.add_theme_color_override('font_color', Color.WHITE) diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index 0cf6c46..b56036d 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -1,39 +1,14 @@ -[gd_scene load_steps=16 format=3 uid="uid://m5s87q7m66lj"] +[gd_scene load_steps=10 format=3 uid="uid://m5s87q7m66lj"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"] [ext_resource type="Script" uid="uid://cwvikiygf8b1m" path="res://scenes/pribor-prd-k/pribor-prd-k.gd" id="1_tpdyp"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_14h25"] [ext_resource type="PackedScene" uid="uid://cm5jd4gjrrpba" path="res://scenes/контроль/кассета-у-5-к.tscn" id="2_tb85r"] [ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="5_c7lv8"] -[ext_resource type="PackedScene" uid="uid://ffi1njkjceb5" path="res://scenes/контроль/блок-к.tscn" id="6_wd1vi"] [ext_resource type="PackedScene" uid="uid://bmagw8nd0ulhj" path="res://scenes/pribor-prd-k/kasseta-fs-kd.tscn" id="7_ia27q"] [ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"] [ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"] -[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="10_c7lv8"] -[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="11_wd1vi"] -[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="12_bjebg"] -[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="13_kc77u"] - -[sub_resource type="SpriteFrames" id="SpriteFrames_di0aa"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": ExtResource("10_c7lv8") -}, { -"duration": 1.0, -"texture": ExtResource("11_wd1vi") -}, { -"duration": 1.0, -"texture": ExtResource("12_bjebg") -}, { -"duration": 1.0, -"texture": ExtResource("13_kc77u") -}], -"loop": true, -"name": &"default", -"speed": 5.0 -}] [node name="pribor_prd_k" type="Control"] layout_mode = 3 @@ -46,55 +21,55 @@ script = ExtResource("1_tpdyp") [node name="kasseta_u5" parent="." instance=ExtResource("2_tb85r")] layout_mode = 0 -offset_left = 214.0 -offset_top = 96.0 -offset_right = 524.0 -offset_bottom = 286.0 +offset_left = 175.0 +offset_top = 242.0 +offset_right = 485.0 +offset_bottom = 432.0 -[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("1_8dmgr")] +[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("1_8dmgr")] layout_mode = 0 -offset_left = 524.0 -offset_top = 761.0 -offset_right = 691.0 -offset_bottom = 803.0 +offset_left = 485.0 +offset_top = 907.0 +offset_right = 652.0 +offset_bottom = 949.0 fname = "MAA2000" rname = "A28" metadata/ip = "maa2000_1" [node name="dou6_A7" parent="." groups=["default_reset"] instance=ExtResource("1_8dmgr")] layout_mode = 0 -offset_left = 47.0 -offset_top = 716.0 -offset_right = 214.0 -offset_bottom = 761.0 +offset_left = 8.0 +offset_top = 862.0 +offset_right = 175.0 +offset_bottom = 907.0 fname = "ДОУ-6" rname = "A7" -[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("1_8dmgr")] +[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("1_8dmgr")] layout_mode = 0 -offset_left = 47.0 -offset_top = 761.0 -offset_right = 214.0 -offset_bottom = 803.0 +offset_left = 8.0 +offset_top = 907.0 +offset_right = 175.0 +offset_bottom = 949.0 fname = "MAA2000" rname = "A27" metadata/ip = "maa2000_2" [node name="dou7_A8" parent="." groups=["default_reset"] instance=ExtResource("1_8dmgr")] layout_mode = 0 -offset_left = 47.0 -offset_top = 666.0 -offset_right = 214.0 -offset_bottom = 714.0 +offset_left = 8.0 +offset_top = 812.0 +offset_right = 175.0 +offset_bottom = 860.0 fname = "ДОУ-7" rname = "A8" [node name="ref_ZZ3" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 666.0 -offset_right = 524.0 -offset_bottom = 803.0 +offset_left = 175.0 +offset_top = 812.0 +offset_right = 485.0 +offset_bottom = 949.0 texture = ExtResource("2_14h25") patch_margin_left = 16 patch_margin_top = 16 @@ -115,175 +90,175 @@ vertical_alignment = 1 [node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 96.0 -offset_right = 691.0 -offset_bottom = 191.0 +offset_left = 485.0 +offset_top = 242.0 +offset_right = 652.0 +offset_bottom = 337.0 value0 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0] fname = "УМ1535Б" rname = "A10" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_1" [node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 191.0 -offset_right = 691.0 -offset_bottom = 286.0 +offset_left = 485.0 +offset_top = 337.0 +offset_right = 652.0 +offset_bottom = 432.0 fname = "УМ1535Б" rname = "A11" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_2" [node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 286.0 -offset_right = 691.0 -offset_bottom = 381.0 +offset_left = 485.0 +offset_top = 432.0 +offset_right = 652.0 +offset_bottom = 527.0 fname = "УМ1535Б" rname = "A12" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_3" [node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 381.0 -offset_right = 691.0 -offset_bottom = 476.0 +offset_left = 485.0 +offset_top = 527.0 +offset_right = 652.0 +offset_bottom = 622.0 fname = "УМ1535Б" rname = "A13" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_4" [node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 476.0 -offset_right = 691.0 -offset_bottom = 571.0 +offset_left = 485.0 +offset_top = 622.0 +offset_right = 652.0 +offset_bottom = 717.0 fname = "УМ1535Б" rname = "A14" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_5" [node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 571.0 -offset_right = 691.0 -offset_bottom = 666.0 +offset_left = 485.0 +offset_top = 717.0 +offset_right = 652.0 +offset_bottom = 812.0 fname = "УМ1535Б" rname = "A15" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_6" -[node name="блок-к" parent="." groups=["power_amplifier"] instance=ExtResource("6_wd1vi")] +[node name="utm80_A9" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 524.0 -offset_top = 666.0 -offset_right = 691.0 -offset_bottom = 761.0 +offset_left = 485.0 +offset_top = 812.0 +offset_right = 652.0 +offset_bottom = 907.0 fname = "УТМ80" rname = "A9" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_8" +metadata/um = "um_7" [node name="rm1620m_A16" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 47.0 -offset_top = 96.0 -offset_right = 214.0 -offset_bottom = 191.0 -fname = "РМ16-20М" +offset_left = 8.0 +offset_top = 242.0 +offset_right = 175.0 +offset_bottom = 337.0 +fname = "УМ1535Б" rname = "A16" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_9" +metadata/um = "um_8" [node name="rm1620m_A17" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 47.0 -offset_top = 191.0 -offset_right = 212.0 -offset_bottom = 286.0 -fname = "РМ16-20М" +offset_left = 8.0 +offset_top = 337.0 +offset_right = 173.0 +offset_bottom = 432.0 +fname = "УМ1535Б" rname = "A17" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_10" +metadata/um = "um_9" [node name="rm1620m_A18" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 47.0 -offset_top = 286.0 -offset_right = 214.0 -offset_bottom = 381.0 -fname = "РМ16-20М" +offset_left = 8.0 +offset_top = 432.0 +offset_right = 175.0 +offset_bottom = 527.0 +fname = "УМ1535Б" rname = "A18" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_11" +metadata/um = "um_10" [node name="rm1620m_A19" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 47.0 -offset_top = 381.0 -offset_right = 214.0 -offset_bottom = 476.0 -fname = "РМ16-20М" +offset_left = 8.0 +offset_top = 527.0 +offset_right = 175.0 +offset_bottom = 622.0 +fname = "УМ1535Б" rname = "A19" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_12" +metadata/um = "um_11" [node name="rm1620m_A20" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 47.0 -offset_top = 476.0 -offset_right = 214.0 -offset_bottom = 571.0 -fname = "РМ16-20М" +offset_left = 8.0 +offset_top = 622.0 +offset_right = 175.0 +offset_bottom = 717.0 +fname = "УМ1535Б" rname = "A20" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_13" +metadata/um = "um_12" [node name="rm1620m_A21" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")] layout_mode = 0 -offset_left = 47.0 -offset_top = 571.0 -offset_right = 214.0 -offset_bottom = 666.0 -fname = "РМ16-20М" +offset_left = 8.0 +offset_top = 717.0 +offset_right = 175.0 +offset_bottom = 812.0 +fname = "УМ1535Б" rname = "A21" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_14" +metadata/um = "um_13" [node name="kasseta_fs_kd" parent="." instance=ExtResource("7_ia27q")] layout_mode = 0 -offset_left = 214.0 -offset_top = 286.0 -offset_right = 524.0 -offset_bottom = 476.0 +offset_left = 175.0 +offset_top = 432.0 +offset_right = 485.0 +offset_bottom = 622.0 fname = "Кассета ФС-КД" [node name="kasseta_p_1" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 476.0 -offset_right = 379.0 -offset_bottom = 666.0 +offset_left = 175.0 +offset_top = 622.0 +offset_right = 340.0 +offset_bottom = 812.0 texture = ExtResource("2_14h25") patch_margin_left = 16 patch_margin_top = 16 @@ -292,7 +267,7 @@ patch_margin_bottom = 16 script = ExtResource("7_xpa2n") fname = "Кассета П-1" -[node name="ref_A26" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")] +[node name="ref_A26" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 @@ -301,7 +276,7 @@ fname = "ИП9-50" rname = "A23" metadata/ip = "ip9_50_1" -[node name="ref_A23" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")] +[node name="ref_A23" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -310,7 +285,7 @@ fname = "ИП9-50" rname = "A24" metadata/ip = "ip9_50_2" -[node name="ref_A24" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")] +[node name="ref_A24" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 @@ -322,9 +297,9 @@ metadata/ip = "ip12_50_1" [node name="lbl_fname" type="Label" parent="kasseta_p_1"] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 -offset_left = 2.0 +offset_left = 7.0 offset_top = 8.0 -offset_right = 162.0 +offset_right = 159.0 offset_bottom = 33.0 text = "Кассета П-1" horizontal_alignment = 1 @@ -332,56 +307,18 @@ vertical_alignment = 1 [node name="kasseta_p_2" parent="." instance=ExtResource("8_6fdp7")] layout_mode = 0 -offset_left = 404.0 -offset_top = 476.0 -offset_right = 524.0 -offset_bottom = 666.0 +offset_left = 365.0 +offset_top = 622.0 +offset_right = 485.0 +offset_bottom = 812.0 fname = "Кассета П-2" -[node name="input_0" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(392, 472) -sprite_frames = SubResource("SpriteFrames_di0aa") - -[node name="input_1" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(444, 472) -sprite_frames = SubResource("SpriteFrames_di0aa") - -[node name="input_2" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(294, 473) -sprite_frames = SubResource("SpriteFrames_di0aa") - -[node name="output_0" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(394, 318) -sprite_frames = SubResource("SpriteFrames_di0aa") - -[node name="output_1" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(444, 318) -sprite_frames = SubResource("SpriteFrames_di0aa") - -[node name="output_2" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(294, 318) -sprite_frames = SubResource("SpriteFrames_di0aa") - [node name="control_result" type="Label" parent="."] layout_mode = 0 -offset_left = 49.0 -offset_top = 993.0 -offset_right = 689.0 -offset_bottom = 1036.0 -theme_override_font_sizes/font_size = 22 +offset_left = 9.0 +offset_top = 960.0 +offset_right = 649.0 +offset_bottom = 1003.0 +text = "Прибор ПРД- неисправен" horizontal_alignment = 1 metadata/_edit_lock_ = true - -[node name="line" type="Line2D" parent="."] -position = Vector2(59, 920) -scale = Vector2(1.03548, 1) -points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0) -width = 2.0 -default_color = Color(1, 1, 1, 0.352941) -metadata/_edit_lock_ = true diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd index 1f546d4..c69b553 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -1,159 +1,235 @@ @tool extends 'res://scenes/контроль/прибор.gd' +const constants_n = { + 'POWER_UKP_1': 31, + 'POWER_UKP_2': 63, + 'DKM_BIT_2': 1, + 'DKM_BIT_3': 2, + 'BASE_ADDR_EMS_G': 0x120, + 'ADDR_UG_LITERA_1': 0x106, + 'ADDR_UG_LITERA_2': 0x108, + 'ADDR_UG_LITERA_3': 0x10A, + 'TEMP_THRESHOLD': 70, + 'POWER_THRESHOLD': 40, + 'RAY_DOU_NUM': 0x3, + 'ATT_UM_2': 0x2, + 'ATT_UM_3': 0x3, + 'POWER_UM': 100, + 'TIMER_DELAY': 10.0, + 'STATE_MASHINE_TIMER': 0.3, +} +# Конфигурация параметров для каждого прибора +const PRIBOR_CONFIG_N := { + '1н': {'angle': 0.0, 'sectors': [4, 8]}, + '2н': {'angle': 90.0, 'sectors': [7, 11]}, + '3н': {'angle': 180.0, 'sectors': [6, 10]}, + '4н': {'angle': 270.0, 'sectors': [5, 9]}, +} +# Конфигурация частот и ширин для каждого ФС +const FS_PARAMS_N := { + 2: {'freq': 932.0, 'width': 100.0}, + 3: {'freq': 1157.0, 'width': 100.0} +} enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 } +var block_ip_config_n:= { + 'maa2000_1': [0, false], + 'maa2000_2': [1, false], + 'ip9_50_1': [2, false], + 'ip9_50_2': [3, false], + 'ip12_50_1': [4, false], + 'ip5_25': [7, false], +} +var block_kasseta_y5_prd_config_n: = { + 'yau07': false, + 'ems': false, + 'ug': false, + 'ukp1': false, + 'ukp2': false, +} # Основные переменные +var start_litera: int = 2 +var ug_work_1: int = 2 ## Аттенюация усилителей мощности +var ug_work_2: int = 3 ## Аттенюация усилителей мощности +# Флаги и таймеры +var mashine_timer: Timer = Timer.new() +var prd_n_module: Object var unit_prd_n: Object +var control_prd_n: Object +# Результаты контроля +var control_results_n: Dictionary = { + 'block_ip': false, # Проверка касет П1 и ИП МА2000 + 'temperature': true, # Проверка температур УМ + 'dkm_2': false, + 'dkm_3': false, + 'dou_2': false, + 'dou_3': false, + 'fs_2': 2, + 'fs_3': 2, +} +var test_control_n = preload('res://scripts/pribor-prd.gd') var ctrl_pos = 0 +################################ +func on_state_mashine() -> void: + control_prd_n.state_control_machine() func _ready() -> void: if Engine.is_editor_hint(): return - var unit_name = get_meta('unit_name')[0] - var prd_n_module = prd.prd_dict[unit_name] - unit_prd_n = prd_n_module.unit_control - var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - for temp in power_amplifier: - temp.value1 = -70 - # Подписываемся на сигналы - unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device')) - unit_prd_n.connect('status_updated', Callable(self, '_on_status_updated')) - # Устанавливаем начальный статус - _update_status_text(unit_prd_n.get_current_status()) - start_control() - on_press_device() - -func _process(_delta: float) -> void: - if Engine.is_editor_hint(): - return - set_frame($input_0, unit_prd_n.ems_g_sock_dic.ems_input_1) - set_frame($input_1, unit_prd_n.ems_g_sock_dic.ems_input_2) - set_frame($output_0, unit_prd_n.ems_g_sock_dic.ems_output_1) - set_frame($output_1, unit_prd_n.ems_g_sock_dic.ems_output_2) - - -func set_frame(node_frame: Node, val: int): node_frame.set_frame(val) - - -func start_control() -> void: - set_default_state(get_tree().get_nodes_in_group('default_reset'), get_tree().get_nodes_in_group('power_amplifier')) + initialize_connections() + setup_timer() + set_default_state() find_labels(self) -static func set_default_state(default_reset_array_node: Array, power_amplifier_arr_node: Array) -> void: - for group in default_reset_array_node: +func initialize_connections() -> void: + var unit_name = get_meta('unit_name')[0] + prd_n_module = prd.prd_dict[unit_name] + unit_prd_n = prd_n_module.unit_yau07 + + unit_prd_n.connect('line_changed', Callable(self, 'on_line_changed')) + var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier') + var init_data: Dictionary = { + 'control_label': $control_result, + 'power_amplifiers': power_amplifiers, + 'unit_prd': unit_prd_n, + 'module_prd' : prd_n_module, + 'constants': constants_n, + 'prd_config': PRIBOR_CONFIG_N, + 'fs_params': FS_PARAMS_N, + 'block_ip_prd_config': block_ip_config_n, + 'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_n, + 'control_results': control_results_n, + 'current_litera': start_litera, + } + control_prd_n = test_control_n.TestPRD.new(init_data) + add_child(control_prd_n) + control_prd_n.connect('control_is_over', Callable(self, 'on_control_result')) + + +func setup_timer() -> void: + add_child(mashine_timer) + mashine_timer.connect('timeout', Callable(self, 'on_state_mashine')) + mashine_timer.wait_time = constants_n.STATE_MASHINE_TIMER + mashine_timer.start() + + +func set_default_state() -> void: + for group in get_tree().get_nodes_in_group('default_reset'): group.state = STATE_VAL.NONE - for group in power_amplifier_arr_node: + for group in get_tree().get_nodes_in_group('power_amplifier'): group.state = STATE_VAL.NONE func _enter_tree() -> void: if Engine.is_editor_hint(): return - if unit_prd_n: - _update_status_text(unit_prd_n.get_current_status()) + $control_result.text = 'Выполняется ...' + $control_result.add_theme_color_override('font_color', Color.ALICE_BLUE) + signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true)) func _exit_tree() -> void: if Engine.is_editor_hint(): return - #prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) + prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) -static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void: - for i_node_temperature in temperature_arr_node: - var temperature_meta: String = i_node_temperature.get_meta('um') - if not temperature_dic.has(temperature_meta): return - i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40 +func on_line_changed(unit_pribor: Object) -> void: + if not unit_pribor.online: + set_default_state() -static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void: - for i_node_powapm in power_amplifier_arr_node: - var powamp_meta: String = i_node_powapm.get_meta('um') +func on_mode_changed(in_tree: bool) -> void: + if not in_tree: + mashine_timer.stop() + signaller.emit_signal('interfer_off_all') + prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) + else: + set_default_state() + control_prd_n.state = control_prd_n.STATE_MASHINE.INIT + mashine_timer.start() + + +func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: + #if not control_prd_n.block_kasseta_y5_config.yau07 or not control_prd_n.block_kasseta_y5_config.ukp1 or not control_prd_n.block_kasseta_y5_config.ukp2: + #return + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i_powapm in power_amplifier: + var powamp_meta: String = i_powapm.get_meta('um') var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE - if not pow_dic.has(powamp_meta): return - if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return - if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_3: return - i_node_powapm.value0 = pow_dic[powamp_meta] - var count_above_threshold = 0 - for i_p in pow_dic[powamp_meta]: - if i_p >= POWER_THRESHOLD: - count_above_threshold += 1 - - status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR - i_node_powapm.state = status + if pow_dic[powamp_meta].size() < 6: + status = STATE_VAL.ERROR + else: + if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return + if powamp_meta in ['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] and not fs_result.fs_3: return + i_powapm.value0 = pow_dic[powamp_meta] + for i_p in pow_dic[powamp_meta]: + if i_p < constants_n.POWER_THRESHOLD: + status = STATE_VAL.ERROR + i_powapm.state = status -func on_press_device() -> void: +func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void: + mashine_timer.stop() + block_kasseta_y5_prd_config_n = control_prd_n.block_kasseta_y5_config var nodes_y5: Array = get_tree().get_nodes_in_group('y-5') - var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') - var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group') - var power_amplifier_arr_node: Array = get_tree().get_nodes_in_group('power_amplifier') - var default_reset_array_node = get_tree().get_nodes_in_group('default_reset') - var module_fs_2: Node = $kasseta_FS_ND/ref_A4 - var dou_2: Node = $dou2_A5 - var module_fs_3: Node = $kasseta_FS_ND/ref_A3 - var dou_3: Node = $dou3_A6 - var control_data: Dictionary = unit_prd_n.get_control_results() - var for_control_result: Dictionary = { - 'nodes_y5': nodes_y5, - 'node_ip_power_arr': node_ip_power_arr, - 'fs_nodes': fs_nodes, - 'power_amplifier': power_amplifier_arr_node, - 'default_reset_array_node': default_reset_array_node, - 'module_fs_2': module_fs_2, - 'dou_2': dou_2, - 'module_fs_3': module_fs_3, - 'dou_3': dou_3, - } - for_control_result.merge(control_data, true) - on_control_result(for_control_result) - - -static func on_control_result(for_result_dic: Dictionary) -> void: - temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um) - - var block_kasseta_y5_prd_config_n: Dictionary = for_result_dic.block_kasseta_y5_config - var nodes_y5: Array = for_result_dic.nodes_y5 for node_y5 in nodes_y5: var meta_y5 = node_y5.get_meta('y5') if block_kasseta_y5_prd_config_n.has(meta_y5): - if not block_kasseta_y5_prd_config_n.yau07: + if block_kasseta_y5_prd_config_n['yau07'] == false: node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE - else: - node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR + break + node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR - var block_ip_config_n: Dictionary = for_result_dic.block_ip_config - for power_supply in for_result_dic.node_ip_power_arr: + block_ip_config_n = control_prd_n.block_ip_config + var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') + for power_supply in node_ip_power_arr: var meta_ip = power_supply.get_meta('ip') - if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug and block_kasseta_y5_prd_config_n.yau07: + if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug: power_supply.state = STATE_VAL.GOOD if block_ip_config_n[meta_ip][1] else STATE_VAL.ERROR - else: - power_supply.state = STATE_VAL.NONE - if not for_result_dic.control_is_over: - set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier) - return - var result_dic: Dictionary = for_result_dic.result_dic - for f in for_result_dic.fs_nodes: + var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group') + for f in fs_nodes: var fs_meta: String = f.get_meta('fs') if result_dic.has(fs_meta): - f.state = result_dic[fs_meta] + var new_state = result_dic[fs_meta] + f.state = new_state + result_dic[fs_meta] = new_state - if result_dic.fs_2 == 1 and block_kasseta_y5_prd_config_n['yau07']: - for_result_dic.module_fs_2.state = STATE_VAL.GOOD if result_dic.dkm_2 else STATE_VAL.ERROR - for_result_dic.dou_2.state = STATE_VAL.GOOD if result_dic.dou_2 else STATE_VAL.ERROR + if result_dic.fs_2 == 1: + $kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if result_dic.dkm_2 else STATE_VAL.ERROR + $dou2_A5.state = STATE_VAL.GOOD if result_dic.dou_2 else STATE_VAL.ERROR + else: + result_dic.fs_2 = 0 + if result_dic.fs_3 == 1: + $kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if result_dic.dkm_3 else STATE_VAL.ERROR + $dou3_A6.state = STATE_VAL.GOOD if result_dic.dou_3 else STATE_VAL.ERROR + else: + result_dic.fs_3 = 0 - if result_dic.fs_3 == 1 and block_kasseta_y5_prd_config_n['yau07']: - for_result_dic.module_fs_3.state = STATE_VAL.GOOD if result_dic.dkm_3 else STATE_VAL.ERROR - for_result_dic.dou_3.state = STATE_VAL.GOOD if result_dic.dou_3 else STATE_VAL.ERROR - - if block_kasseta_y5_prd_config_n['yau07']: - power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD) + power_fill(power_dic, result_dic) + + var result = true + for device in result_dic.values(): + if not device: + result = false + + var name_prd = control_prd_n.self_name + if result: + $control_result.text = 'Прибор ПРД-%s исправен' % name_prd + $control_result.add_theme_color_override('font_color', Color.GREEN) + else: + $control_result.text = 'Прибор ПРД-%s неисправен' % name_prd + $control_result.add_theme_color_override('font_color', Color.RED) func find_labels(node1: Node): @@ -170,22 +246,3 @@ func find_labels(node1: Node): node1.set_meta("tooltip_set", true) for child in node1.get_children(): find_labels(child) - - -func _on_status_updated(status_text: String) -> void: - _update_status_text(status_text) - - -func _update_status_text(text: String) -> void: - $control_result.text = text - # Можно добавить смену цвета в зависимости от статуса - if "Ошибка" in text or "неисправен" in text: - $control_result.add_theme_color_override('font_color', Color.RED) - log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_n.self_name]) - elif "Ограничена" in text or "Предупреждение" in text: - $control_result.add_theme_color_override('font_color', Color.YELLOW) - elif "исправен" in text or "завершён" in text: - $control_result.add_theme_color_override('font_color', Color.GREEN) - log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_n.self_name]) - else: - $control_result.add_theme_color_override('font_color', Color.WHITE) diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 7d73a63..a52ce38 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -1,35 +1,12 @@ -[gd_scene load_steps=12 format=3 uid="uid://dnuexoef2nnv5"] +[gd_scene load_steps=8 format=3 uid="uid://dnuexoef2nnv5"] [ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_bnnv3"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_is25t"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_meukj"] +[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_xkifg"] [ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b5wvk"] [ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="7_bnnv3"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_eoqf2"] -[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="8_bnnv3"] -[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="9_is25t"] -[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="10_meukj"] -[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="11_xkifg"] - -[sub_resource type="SpriteFrames" id="SpriteFrames_1wf07"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": ExtResource("8_bnnv3") -}, { -"duration": 1.0, -"texture": ExtResource("9_is25t") -}, { -"duration": 1.0, -"texture": ExtResource("10_meukj") -}, { -"duration": 1.0, -"texture": ExtResource("11_xkifg") -}], -"loop": true, -"name": &"default", -"speed": 5.0 -}] [node name="pribor_prd_n" type="Control"] layout_mode = 3 @@ -40,50 +17,50 @@ offset_right = 15.0 offset_bottom = 30.0 script = ExtResource("1_bnnv3") -[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("2_is25t")] +[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_is25t")] layout_mode = 2 -offset_left = 47.0 -offset_top = 731.0 -offset_right = 214.0 -offset_bottom = 803.0 +offset_left = 8.0 +offset_top = 877.0 +offset_right = 175.0 +offset_bottom = 949.0 fname = "MAA2000" rname = "A23" metadata/ip = "maa2000_2" -[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("2_is25t")] +[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_is25t")] layout_mode = 2 -offset_left = 524.0 -offset_top = 731.0 -offset_right = 691.0 -offset_bottom = 803.0 +offset_left = 485.0 +offset_top = 877.0 +offset_right = 652.0 +offset_bottom = 949.0 fname = "MAA2000" rname = "A22" metadata/ip = "maa2000_1" [node name="dou2_A5" parent="." groups=["default_reset"] instance=ExtResource("2_is25t")] layout_mode = 2 -offset_left = 524.0 -offset_top = 666.0 -offset_right = 691.0 -offset_bottom = 731.0 +offset_left = 485.0 +offset_top = 812.0 +offset_right = 652.0 +offset_bottom = 877.0 fname = "ДОУ-2" rname = "A5" [node name="dou3_A6" parent="." groups=["default_reset"] instance=ExtResource("2_is25t")] layout_mode = 2 -offset_left = 47.0 -offset_top = 666.0 -offset_right = 214.0 -offset_bottom = 731.0 +offset_left = 8.0 +offset_top = 812.0 +offset_right = 175.0 +offset_bottom = 877.0 fname = "ДОУ-3" rname = "A6" [node name="ref_ZZ3" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 666.0 -offset_right = 524.0 -offset_bottom = 803.0 +offset_left = 175.0 +offset_top = 812.0 +offset_right = 485.0 +offset_bottom = 949.0 texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 @@ -102,90 +79,19 @@ text = "Панель horizontal_alignment = 1 vertical_alignment = 1 -[node name="kasseta_U5" type="NinePatchRect" parent="."] +[node name="kasseta_U5" parent="." instance=ExtResource("4_xkifg")] layout_mode = 0 -offset_left = 214.0 -offset_top = 96.0 -offset_right = 524.0 -offset_bottom = 286.0 -texture = ExtResource("3_meukj") -patch_margin_left = 16 -patch_margin_top = 16 -patch_margin_right = 16 -patch_margin_bottom = 16 -script = ExtResource("6_b5wvk") - -[node name="lbl_fname" type="Label" parent="kasseta_U5"] -self_modulate = Color(1, 1, 1, 0.62) -layout_mode = 0 -offset_left = 5.0 -offset_top = 7.0 -offset_right = 305.0 -offset_bottom = 35.0 -text = "Кассета У5" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="ref_A24" parent="kasseta_U5" groups=["power_supply"] instance=ExtResource("7_eoqf2")] -offset_left = 5.0 -offset_top = 32.0 -offset_right = 55.0 -offset_bottom = 182.0 -fname = "ИП5-25" -rname = "A24" -metadata/ip = "ip5_25" - -[node name="ref_A30" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")] -offset_left = 55.0 -offset_top = 32.0 -offset_right = 105.0 -offset_bottom = 182.0 -fname = "ЯУ-07Б" -rname = "A30" -metadata/y5 = "yau07" - -[node name="ref_A26" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")] -offset_left = 105.0 -offset_top = 32.0 -offset_right = 155.0 -offset_bottom = 182.0 -fname = "ЭМС-Г" -rname = "A26" -metadata/y5 = "ems" - -[node name="ref_A27" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")] -offset_left = 155.0 -offset_top = 32.0 -offset_right = 205.0 -offset_bottom = 182.0 -fname = "УГ" -rname = "A27" -metadata/y5 = "ug" - -[node name="ref_A28" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")] -offset_left = 205.0 -offset_top = 32.0 -offset_right = 255.0 -offset_bottom = 182.0 -fname = "УКП" -rname = "A28" -metadata/y5 = "ukp1" - -[node name="ref_A29" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")] -offset_left = 254.0 -offset_top = 32.0 -offset_right = 304.0 -offset_bottom = 182.0 -fname = "УКП" -rname = "A29" -metadata/y5 = "ukp2" +offset_left = 175.0 +offset_top = 242.0 +offset_right = 485.0 +offset_bottom = 432.0 [node name="kasseta_FS_ND" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 286.0 -offset_right = 524.0 -offset_bottom = 476.0 +offset_left = 175.0 +offset_top = 432.0 +offset_right = 485.0 +offset_bottom = 622.0 texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 @@ -212,7 +118,7 @@ offset_top = 32.0 offset_right = 105.0 offset_bottom = 182.0 fname = "Блок ФС-3" -rname = "A4" +rname = "A3" [node name="ref_A1" parent="kasseta_FS_ND" groups=["default_reset", "fs_group"] instance=ExtResource("7_eoqf2")] offset_left = 105.0 @@ -220,7 +126,7 @@ offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 fname = "Модуль ФС" -rname = "A2" +rname = "A1" metadata/fs = "fs_3" [node name="ref_A2" parent="kasseta_FS_ND" groups=["default_reset", "fs_group"] instance=ExtResource("7_eoqf2")] @@ -229,7 +135,7 @@ offset_top = 32.0 offset_right = 205.0 offset_bottom = 182.0 fname = "Модуль ФС" -rname = "A1" +rname = "A2" metadata/fs = "fs_2" [node name="ref_A4" parent="kasseta_FS_ND" groups=["default_reset"] instance=ExtResource("7_eoqf2")] @@ -238,14 +144,14 @@ offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "Блок ФС-2" -rname = "A3" +rname = "A4" [node name="kasseta_P_1" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 476.0 -offset_right = 524.0 -offset_bottom = 666.0 +offset_left = 175.0 +offset_top = 622.0 +offset_right = 485.0 +offset_bottom = 812.0 texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 @@ -254,7 +160,7 @@ patch_margin_bottom = 16 script = ExtResource("6_b5wvk") fname = "Кассета П-1" -[node name="ref_A21" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")] +[node name="ref_A21" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 @@ -263,7 +169,7 @@ fname = "ИП12-50" rname = "A21" metadata/ip = "ip12_50_1" -[node name="ref_A20" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")] +[node name="ref_A20" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -272,7 +178,7 @@ fname = "ИП9-50" rname = "A20" metadata/ip = "ip9_50_1" -[node name="ref_A19" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")] +[node name="ref_A19" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 @@ -294,182 +200,153 @@ vertical_alignment = 1 [node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 524.0 -offset_top = 96.0 -offset_right = 691.0 -offset_bottom = 191.0 -fname = "УМ1535А" +offset_left = 485.0 +offset_top = 242.0 +offset_right = 652.0 +offset_bottom = 337.0 +fname = "УМ1535Б" rname = "A7" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_1" [node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 524.0 -offset_top = 191.0 -offset_right = 691.0 -offset_bottom = 286.0 +offset_left = 485.0 +offset_top = 337.0 +offset_right = 652.0 +offset_bottom = 432.0 fname = "УМ1535А" rname = "A8" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_2" [node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 524.0 -offset_top = 286.0 -offset_right = 691.0 -offset_bottom = 381.0 +offset_left = 485.0 +offset_top = 432.0 +offset_right = 652.0 +offset_bottom = 527.0 fname = "УМ1535А" rname = "A9" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_3" [node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 524.0 -offset_top = 381.0 -offset_right = 691.0 -offset_bottom = 476.0 +offset_left = 485.0 +offset_top = 527.0 +offset_right = 652.0 +offset_bottom = 622.0 fname = "УМ1535А" rname = "A10" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_4" [node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 524.0 -offset_top = 476.0 -offset_right = 691.0 -offset_bottom = 571.0 +offset_left = 485.0 +offset_top = 622.0 +offset_right = 652.0 +offset_bottom = 717.0 fname = "УМ1535А" rname = "A11" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_5" [node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 524.0 -offset_top = 571.0 -offset_right = 691.0 -offset_bottom = 666.0 +offset_left = 485.0 +offset_top = 717.0 +offset_right = 652.0 +offset_bottom = 812.0 fname = "УМ1535А" rname = "A12" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_6" [node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 47.0 -offset_top = 96.0 -offset_right = 214.0 -offset_bottom = 191.0 +offset_left = 8.0 +offset_top = 242.0 +offset_right = 175.0 +offset_bottom = 337.0 fname = "УМ1535А" rname = "A13" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_9" +metadata/um = "um_7" [node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 47.0 -offset_top = 191.0 -offset_right = 214.0 -offset_bottom = 286.0 +offset_left = 8.0 +offset_top = 337.0 +offset_right = 175.0 +offset_bottom = 432.0 fname = "УМ1535А" rname = "A14" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_10" +metadata/um = "um_8" [node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 47.0 -offset_top = 286.0 -offset_right = 214.0 -offset_bottom = 381.0 +offset_left = 8.0 +offset_top = 432.0 +offset_right = 175.0 +offset_bottom = 527.0 fname = "УМ1535А" rname = "A15" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_11" +metadata/um = "um_9" [node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 47.0 -offset_top = 381.0 -offset_right = 214.0 -offset_bottom = 476.0 +offset_left = 8.0 +offset_top = 527.0 +offset_right = 175.0 +offset_bottom = 622.0 fname = "УМ1535А" rname = "A16" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_12" +metadata/um = "um_10" [node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 47.0 -offset_top = 476.0 -offset_right = 214.0 -offset_bottom = 571.0 +offset_left = 8.0 +offset_top = 622.0 +offset_right = 175.0 +offset_bottom = 717.0 fname = "УМ1535А" rname = "A17" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_13" +metadata/um = "um_11" [node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")] layout_mode = 0 -offset_left = 47.0 -offset_top = 571.0 -offset_right = 214.0 -offset_bottom = 666.0 +offset_left = 8.0 +offset_top = 717.0 +offset_right = 175.0 +offset_bottom = 812.0 fname = "УМ1535А" rname = "A18" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_14" +metadata/um = "um_12" [node name="control_result" type="Label" parent="."] layout_mode = 0 -offset_left = 49.0 -offset_top = 993.0 -offset_right = 689.0 -offset_bottom = 1036.0 -theme_override_font_sizes/font_size = 22 +offset_left = 9.0 +offset_top = 960.0 +offset_right = 649.0 +offset_bottom = 1003.0 horizontal_alignment = 1 metadata/_edit_lock_ = true - -[node name="input_0" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(495, 443) -sprite_frames = SubResource("SpriteFrames_1wf07") - -[node name="input_1" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(246, 440) -sprite_frames = SubResource("SpriteFrames_1wf07") - -[node name="output_0" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(497, 330) -sprite_frames = SubResource("SpriteFrames_1wf07") - -[node name="output_1" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(249, 331) -sprite_frames = SubResource("SpriteFrames_1wf07") - -[node name="line" type="Line2D" parent="."] -position = Vector2(59, 920) -scale = Vector2(1.03548, 1) -points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0) -width = 2.0 -default_color = Color(1, 1, 1, 0.352941) -metadata/_edit_lock_ = true diff --git a/scenes/pribor-prd-v/pribor-prd-v.gd b/scenes/pribor-prd-v/pribor-prd-v.gd index 7e965f0..a40768a 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.gd +++ b/scenes/pribor-prd-v/pribor-prd-v.gd @@ -1,158 +1,234 @@ @tool extends 'res://scenes/контроль/прибор.gd' +const constants_v = { + 'POWER_UKP_1': 31, + 'POWER_UKP_2': 63, + 'DKM_BIT_4': 3, + 'DKM_BIT_5': 4, + 'BASE_ADDR_EMS_G': 0x120, + 'ADDR_UG_LITERA_1': 0x106, + 'ADDR_UG_LITERA_2': 0x108, + 'ADDR_UG_LITERA_3': 0x10A, + 'TEMP_THRESHOLD': 70, + 'POWER_THRESHOLD': 40, + 'RAY_DOU_NUM': 0x3, + 'ATT_UM_4': 0x2, + 'ATT_UM_5': 0x3, + 'POWER_UM': 100, + 'TIMER_DELAY': 10.0, + 'STATE_MASHINE_TIMER': 0.3, +} +# Конфигурация параметров для каждого прибора +const PRIBOR_CONFIG_V := { + '1в': {'angle': 0.0, 'sectors': [12, 16]}, + '2в': {'angle': 90.0, 'sectors': [15, 19]}, + '3в': {'angle': 180.0, 'sectors': [14, 18]}, + '4в': {'angle': 270.0, 'sectors': [13, 17]}, +} +# Конфигурация частот и ширин для каждого ФС +const FS_PARAMS_V := { + 4: {'freq': 1227.0, 'width': 100.0}, + 5: {'freq': 1575.0, 'width': 110.0}, +} enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 } +var block_ip_config_v := { + 'maa2000_1': [0, false], + 'maa2000_2': [1, false], + 'ip9_50_1': [2, false], + 'ip9_50_2': [3, false], + 'ip12_50_1': [4, false], + 'ip5_25': [7, false], +} +var block_kasseta_y5_prd_config_v: = { + 'yau07': false, + 'ems': false, + 'ug': false, + 'ukp1': false, + 'ukp2': false, +} # Основные переменные +var start_litera: int = 4 +var ug_work_1: int = 2 ## Аттенюация усилителей мощности +var ug_work_2: int = 3 ## Аттенюация усилителей мощности +# Флаги и таймеры +var mashine_timer: Timer = Timer.new() +var prd_v_module: Object var unit_prd_v: Object +var control_prd_v: Object +# Результаты контроля +var control_results_v: Dictionary = { + 'block_ip': false, # Проверка касет П1 и ИП МА2000 + 'temperature': true, # Проверка температур УМ + 'dkm_4': false, + 'dkm_5': false, + 'dou_4': false, + 'dou_5': false, + 'fs_4': 2, + 'fs_5': 2, +} +var test_control_v = preload('res://scripts/pribor-prd.gd') var ctrl_pos = 70 +func on_state_mashine() -> void: + control_prd_v.state_control_machine() + + func _ready() -> void: if Engine.is_editor_hint(): return - var unit_name = get_meta('unit_name')[0] - var prd_v_module = prd.prd_dict[unit_name] - unit_prd_v = prd_v_module.unit_control - var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - for temp in power_amplifier: - temp.value1 = -70 - # Подписываемся на сигналы - unit_prd_v.connect('control_is_over', Callable(self, 'on_press_device')) - unit_prd_v.connect('status_updated', Callable(self, '_on_status_updated')) - # Устанавливаем начальный статус - _update_status_text(unit_prd_v.get_current_status()) - on_press_device() - -func _process(_delta: float) -> void: - if Engine.is_editor_hint(): - return - set_frame($input_0, unit_prd_v.ems_g_sock_dic.ems_input_1) - set_frame($input_1, unit_prd_v.ems_g_sock_dic.ems_input_2) - set_frame($output_0, unit_prd_v.ems_g_sock_dic.ems_output_1) - set_frame($output_1, unit_prd_v.ems_g_sock_dic.ems_output_2) - - -func set_frame(node_frame: Node, val: int): node_frame.set_frame(val) - - -func start_control() -> void: - set_default_state(get_tree().get_nodes_in_group('default_reset'), get_tree().get_nodes_in_group('power_amplifier')) + initialize_connections() + setup_timer() + set_default_state() find_labels(self) -static func set_default_state(default_reset_array_node: Array, power_amplifier_arr_node: Array) -> void: - for group in default_reset_array_node: +func initialize_connections() -> void: + var unit_name = get_meta('unit_name')[0] + prd_v_module = prd.prd_dict[unit_name] + unit_prd_v = prd_v_module.unit_yau07 + + unit_prd_v.connect('line_changed', Callable(self, 'on_line_changed')) + var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier') + var init_data: Dictionary = { + 'control_label': $control_result, + 'power_amplifiers': power_amplifiers, + 'unit_prd': unit_prd_v, + 'module_prd' : prd_v_module, + 'constants': constants_v, + 'prd_config': PRIBOR_CONFIG_V, + 'fs_params': FS_PARAMS_V, + 'block_ip_prd_config': block_ip_config_v, + 'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_v, + 'control_results': control_results_v, + 'current_litera': start_litera, + } + control_prd_v = test_control_v.TestPRD.new(init_data) + add_child(control_prd_v) + control_prd_v.connect('control_is_over', Callable(self, 'on_control_result')) + + +func setup_timer() -> void: + add_child(mashine_timer) + mashine_timer.connect('timeout', Callable(self, 'on_state_mashine')) + mashine_timer.wait_time = constants_v.STATE_MASHINE_TIMER + mashine_timer.start() + + +func set_default_state() -> void: + for group in get_tree().get_nodes_in_group('default_reset'): group.state = STATE_VAL.NONE - for group in power_amplifier_arr_node: + for group in get_tree().get_nodes_in_group('power_amplifier'): group.state = STATE_VAL.NONE func _enter_tree() -> void: if Engine.is_editor_hint(): return - if unit_prd_v: - _update_status_text(unit_prd_v.get_current_status()) + $control_result.text = 'Выполняется ...' + $control_result.add_theme_color_override('font_color', Color.ALICE_BLUE) + signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false)) + signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true)) + func _exit_tree() -> void: if Engine.is_editor_hint(): return - #prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) + prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) -static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void: - for i_node_temperature in temperature_arr_node: - var temperature_meta: String = i_node_temperature.get_meta('um') - if not temperature_dic.has(temperature_meta): return - i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40 +func on_line_changed(unit_pribor: Object) -> void: + if not unit_pribor.online: + set_default_state() -static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void: - for i_node_powapm in power_amplifier_arr_node: - var powamp_meta: String = i_node_powapm.get_meta('um') - var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE - if not pow_dic.has(powamp_meta): return - if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return - if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return - i_node_powapm.value0 = pow_dic[powamp_meta] - var count_above_threshold = 0 - for i_p in pow_dic[powamp_meta]: - if i_p >= POWER_THRESHOLD: - count_above_threshold += 1 - - status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR - i_node_powapm.state = status +func on_mode_changed(in_tree: bool) -> void: + if not in_tree: + mashine_timer.stop() + prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) + signaller.emit_signal('interfer_off_all') + else: + set_default_state() + control_prd_v.state = control_prd_v.STATE_MASHINE.INIT + mashine_timer.start() -func on_press_device() -> void: - var nodes_y5: Array = get_tree().get_nodes_in_group('y-5') - var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') - var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group') +func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - var default_reset_array_node: Array = get_tree().get_nodes_in_group('default_reset') - var module_fs_4: Node = $kasseta_FS_VD/ref_A6 - var dou_4: Node = $dou4_A5 - var module_fs_5: Node = $kasseta_FS_VD/ref_A2 - var dou_5: Node = $dou5_A6 - var control_data = unit_prd_v.get_control_results() - var for_control_result: Dictionary = { - 'nodes_y5': nodes_y5, - 'node_ip_power_arr': node_ip_power_arr, - 'fs_nodes': fs_nodes, - 'power_amplifier': power_amplifier, - 'default_reset_array_node': default_reset_array_node, - 'module_fs_4': module_fs_4, - 'dou_4': dou_4, - 'module_fs_5': module_fs_5, - 'dou_5': dou_5, - } - for_control_result.merge(control_data, true) - on_control_result(for_control_result) + for i_powapm in power_amplifier: + var powamp_meta: String = i_powapm.get_meta('um') + var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE + if pow_dic[powamp_meta].size() < 6: + status = STATE_VAL.ERROR + else: + if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return + if powamp_meta in ['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] and not fs_result.fs_5: return + i_powapm.value0 = pow_dic[powamp_meta] + for i_p in pow_dic[powamp_meta]: + if i_p < constants_v.POWER_THRESHOLD: + status = STATE_VAL.ERROR + i_powapm.state = status -static func on_control_result(for_result_dic: Dictionary) -> void: - temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um) - - var block_kasseta_y5_prd_config_v: Dictionary = for_result_dic.block_kasseta_y5_config - var nodes_y5: Array = for_result_dic.nodes_y5 +func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void: + mashine_timer.stop() + block_kasseta_y5_prd_config_v = control_prd_v.block_kasseta_y5_config + var nodes_y5: Array = get_tree().get_nodes_in_group('y-5') for node_y5 in nodes_y5: var meta_y5 = node_y5.get_meta('y5') if block_kasseta_y5_prd_config_v.has(meta_y5): - if not block_kasseta_y5_prd_config_v.yau07: + if block_kasseta_y5_prd_config_v['yau07'] == false: node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE - else: - node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR - - var block_ip_config_v: Dictionary = for_result_dic.block_ip_config - for power_supply in for_result_dic.node_ip_power_arr: - var meta_ip = power_supply.get_meta('ip') - if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug and block_kasseta_y5_prd_config_v.yau07: - power_supply.state = STATE_VAL.GOOD if block_ip_config_v[meta_ip][1] else STATE_VAL.ERROR - else: - power_supply.state = STATE_VAL.NONE + break + node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR - if not for_result_dic.control_is_over: - set_default_state(for_result_dic.default_reset_array_node, for_result_dic.power_amplifier) - return - var result_dic: Dictionary = for_result_dic.result_dic - for f in for_result_dic.fs_nodes: + block_ip_config_v = control_prd_v.block_ip_config + var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') + for power_supply in node_ip_power_arr: + var meta_ip = power_supply.get_meta('ip') + if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug: + power_supply.state = STATE_VAL.GOOD if block_ip_config_v[meta_ip][1] else STATE_VAL.ERROR + + var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group') + for f in fs_nodes: var fs_meta: String = f.get_meta('fs') if result_dic.has(fs_meta): - f.state = result_dic[fs_meta] + var new_state = result_dic[fs_meta] + f.state = new_state + result_dic[fs_meta] = new_state - if result_dic.fs_5 == 1 and block_kasseta_y5_prd_config_v['yau07']: - for_result_dic.module_fs_5.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR - for_result_dic.dou_5.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR - - if result_dic.fs_4 == 1 and block_kasseta_y5_prd_config_v['yau07']: - for_result_dic.module_fs_4.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR - for_result_dic.dou_4.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR - - if block_kasseta_y5_prd_config_v['yau07']: - power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD) + if result_dic.fs_5 == 1: + $kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR + $dou5_A6.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR + else: + result_dic.fs_5 = 0 + if result_dic.fs_4 == 1: + $kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR + $dou4_A5.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR + else: + result_dic.fs_4 = 0 + power_fill(power_dic, result_dic) + + var result = true + for device in result_dic.values(): + if not device: + result = false + + var name_prd = control_prd_v.self_name + if result: + $control_result.text = 'Прибор ПРД-%s исправен' % name_prd + $control_result.add_theme_color_override('font_color', Color.GREEN) + else: + $control_result.text = 'Прибор ПРД-%s неисправен' % name_prd + $control_result.add_theme_color_override('font_color', Color.RED) func find_labels(node1: Node): @@ -169,22 +245,3 @@ func find_labels(node1: Node): node1.set_meta("tooltip_set", true) for child in node1.get_children(): find_labels(child) - - -func _on_status_updated(status_text: String) -> void: - _update_status_text(status_text) - - -func _update_status_text(text: String) -> void: - $control_result.text = text - # Можно добавить смену цвета в зависимости от статуса - if "Ошибка" in text or "неисправен" in text: - $control_result.add_theme_color_override('font_color', Color.RED) - log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_v.self_name]) - elif "Ограничена" in text or "Предупреждение" in text: - $control_result.add_theme_color_override('font_color', Color.YELLOW) - elif "исправен" in text or "завершён" in text: - $control_result.add_theme_color_override('font_color', Color.GREEN) - log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_v.self_name]) - else: - $control_result.add_theme_color_override('font_color', Color.WHITE) diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index 1afef7e..bf501cb 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -1,36 +1,13 @@ -[gd_scene load_steps=13 format=3 uid="uid://cvskpe1ti3p45"] +[gd_scene load_steps=9 format=3 uid="uid://cvskpe1ti3p45"] [ext_resource type="Script" uid="uid://cvuosuvjaci1h" path="res://scenes/pribor-prd-v/pribor-prd-v.gd" id="1_c20s6"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_xpo4b"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_wyy1b"] +[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_gl2bl"] [ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="5_nhd2k"] [ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_os4mt"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_38u2b"] [ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="8_4e87c"] -[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_4e87c"] -[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_g8fvp"] -[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_gsby4"] -[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="12_vxfkm"] - -[sub_resource type="SpriteFrames" id="SpriteFrames_s5gcy"] -animations = [{ -"frames": [{ -"duration": 1.0, -"texture": ExtResource("9_4e87c") -}, { -"duration": 1.0, -"texture": ExtResource("10_g8fvp") -}, { -"duration": 1.0, -"texture": ExtResource("11_gsby4") -}, { -"duration": 1.0, -"texture": ExtResource("12_vxfkm") -}], -"loop": true, -"name": &"default", -"speed": 5.0 -}] [node name="pribor_prd_v" type="Control"] layout_mode = 3 @@ -41,50 +18,50 @@ offset_right = 15.0 offset_bottom = 30.0 script = ExtResource("1_c20s6") -[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("2_xpo4b")] +[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_xpo4b")] layout_mode = 2 -offset_left = 524.0 -offset_top = 731.0 -offset_right = 691.0 -offset_bottom = 803.0 +offset_left = 485.0 +offset_top = 877.0 +offset_right = 652.0 +offset_bottom = 949.0 fname = "MAA2000" rname = "A22" metadata/ip = "maa2000_1" [node name="dou4_A5" parent="." groups=["default_reset"] instance=ExtResource("2_xpo4b")] layout_mode = 2 -offset_left = 524.0 -offset_top = 666.0 -offset_right = 691.0 -offset_bottom = 731.0 +offset_left = 485.0 +offset_top = 812.0 +offset_right = 652.0 +offset_bottom = 877.0 fname = "ДОУ-4" rname = "A5" -[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("2_xpo4b")] +[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_xpo4b")] layout_mode = 2 -offset_left = 47.0 -offset_top = 731.0 -offset_right = 214.0 -offset_bottom = 803.0 +offset_left = 8.0 +offset_top = 877.0 +offset_right = 175.0 +offset_bottom = 949.0 fname = "MAA2000" rname = "A23" metadata/ip = "maa2000_2" [node name="dou5_A6" parent="." groups=["default_reset"] instance=ExtResource("2_xpo4b")] layout_mode = 2 -offset_left = 47.0 -offset_top = 666.0 -offset_right = 214.0 -offset_bottom = 731.0 +offset_left = 8.0 +offset_top = 812.0 +offset_right = 175.0 +offset_bottom = 877.0 fname = "ДОУ-5" rname = "A6" [node name="ref_ZZ3" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 666.0 -offset_right = 524.0 -offset_bottom = 803.0 +offset_left = 175.0 +offset_top = 812.0 +offset_right = 485.0 +offset_bottom = 949.0 texture = ExtResource("3_wyy1b") patch_margin_left = 16 patch_margin_top = 16 @@ -103,98 +80,27 @@ text = "Панель horizontal_alignment = 1 vertical_alignment = 1 -[node name="kasseta_U5" type="NinePatchRect" parent="."] +[node name="kasseta_U5" parent="." instance=ExtResource("4_gl2bl")] layout_mode = 0 -offset_left = 214.0 -offset_top = 96.0 -offset_right = 524.0 -offset_bottom = 286.0 -texture = ExtResource("3_wyy1b") -patch_margin_left = 16 -patch_margin_top = 16 -patch_margin_right = 16 -patch_margin_bottom = 16 -script = ExtResource("6_os4mt") - -[node name="lbl_fname" type="Label" parent="kasseta_U5"] -self_modulate = Color(1, 1, 1, 0.62) -layout_mode = 0 -offset_left = 5.0 -offset_top = 7.0 -offset_right = 305.0 -offset_bottom = 35.0 -text = "Кассета У5" -horizontal_alignment = 1 -vertical_alignment = 1 - -[node name="ref_A24" parent="kasseta_U5" groups=["power_supply"] instance=ExtResource("7_38u2b")] -offset_left = 5.0 -offset_top = 32.0 -offset_right = 55.0 -offset_bottom = 182.0 -fname = "ИП5-25" -rname = "A24" -metadata/ip = "ip5_25" - -[node name="ref_A30" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")] -offset_left = 55.0 -offset_top = 32.0 -offset_right = 105.0 -offset_bottom = 182.0 -fname = "ЯУ-07Б" -rname = "A30" -metadata/y5 = "yau07" - -[node name="ref_A26" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")] -offset_left = 105.0 -offset_top = 32.0 -offset_right = 155.0 -offset_bottom = 182.0 -fname = "ЭМС-Г" -rname = "A26" -metadata/y5 = "ems" - -[node name="ref_A27" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")] -offset_left = 155.0 -offset_top = 32.0 -offset_right = 205.0 -offset_bottom = 182.0 -fname = "УГ" -rname = "A27" -metadata/y5 = "ug" - -[node name="ref_A28" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")] -offset_left = 205.0 -offset_top = 32.0 -offset_right = 255.0 -offset_bottom = 182.0 -fname = "УКП" -rname = "A28" -metadata/y5 = "ukp1" - -[node name="ref_A29" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")] -offset_left = 254.0 -offset_top = 32.0 -offset_right = 304.0 -offset_bottom = 182.0 -fname = "УКП" -rname = "A29" -metadata/y5 = "ukp2" +offset_left = 175.0 +offset_top = 242.0 +offset_right = 485.0 +offset_bottom = 432.0 [node name="kasseta_FS_VD" parent="." instance=ExtResource("5_nhd2k")] layout_mode = 0 -offset_left = 214.0 -offset_top = 286.0 -offset_right = 524.0 -offset_bottom = 476.0 +offset_left = 175.0 +offset_top = 432.0 +offset_right = 485.0 +offset_bottom = 622.0 fname = "Кассета ФС-ВД" [node name="kasseta_P_1" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 214.0 -offset_top = 476.0 -offset_right = 524.0 -offset_bottom = 666.0 +offset_left = 175.0 +offset_top = 622.0 +offset_right = 485.0 +offset_bottom = 812.0 texture = ExtResource("3_wyy1b") patch_margin_left = 16 patch_margin_top = 16 @@ -203,7 +109,7 @@ patch_margin_bottom = 16 script = ExtResource("6_os4mt") fname = "Кассета П-1В" -[node name="ref_A19" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")] +[node name="ref_A19" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 @@ -212,7 +118,7 @@ fname = "ИП9-50" rname = "A19" metadata/ip = "ip9_50_1" -[node name="ref_A20" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")] +[node name="ref_A20" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -221,7 +127,7 @@ fname = "ИП9-50" rname = "A20" metadata/ip = "ip9_50_2" -[node name="ref_A21" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")] +[node name="ref_A21" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 @@ -243,182 +149,153 @@ vertical_alignment = 1 [node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 524.0 -offset_top = 96.0 -offset_right = 691.0 -offset_bottom = 191.0 -fname = "УМ1535А" +offset_left = 485.0 +offset_top = 242.0 +offset_right = 652.0 +offset_bottom = 337.0 +fname = "УМ1535Б" rname = "A7" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_1" [node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 524.0 -offset_top = 191.0 -offset_right = 691.0 -offset_bottom = 286.0 +offset_left = 485.0 +offset_top = 337.0 +offset_right = 652.0 +offset_bottom = 432.0 fname = "УМ1535А" rname = "A8" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_2" [node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 524.0 -offset_top = 286.0 -offset_right = 691.0 -offset_bottom = 381.0 +offset_left = 485.0 +offset_top = 432.0 +offset_right = 652.0 +offset_bottom = 527.0 fname = "УМ1535А" rname = "A9" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_3" [node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 524.0 -offset_top = 381.0 -offset_right = 691.0 -offset_bottom = 476.0 +offset_left = 485.0 +offset_top = 527.0 +offset_right = 652.0 +offset_bottom = 622.0 fname = "УМ1535А" rname = "A10" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_4" [node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 524.0 -offset_top = 476.0 -offset_right = 691.0 -offset_bottom = 571.0 +offset_left = 485.0 +offset_top = 622.0 +offset_right = 652.0 +offset_bottom = 717.0 fname = "УМ1535А" rname = "A11" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_5" [node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 524.0 -offset_top = 571.0 -offset_right = 691.0 -offset_bottom = 666.0 +offset_left = 485.0 +offset_top = 717.0 +offset_right = 652.0 +offset_bottom = 812.0 fname = "УМ1535А" rname = "A12" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" metadata/um = "um_6" [node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 47.0 -offset_top = 96.0 -offset_right = 214.0 -offset_bottom = 191.0 +offset_left = 8.0 +offset_top = 242.0 +offset_right = 175.0 +offset_bottom = 337.0 fname = "УМ1535А" rname = "A13" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_9" +metadata/um = "um_7" [node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 47.0 -offset_top = 191.0 -offset_right = 214.0 -offset_bottom = 286.0 +offset_left = 8.0 +offset_top = 337.0 +offset_right = 175.0 +offset_bottom = 432.0 fname = "УМ1535А" rname = "A14" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_10" +metadata/um = "um_8" [node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 47.0 -offset_top = 286.0 -offset_right = 214.0 -offset_bottom = 381.0 +offset_left = 8.0 +offset_top = 432.0 +offset_right = 175.0 +offset_bottom = 527.0 fname = "УМ1535А" rname = "A15" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_11" +metadata/um = "um_9" [node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 47.0 -offset_top = 381.0 -offset_right = 214.0 -offset_bottom = 476.0 +offset_left = 8.0 +offset_top = 527.0 +offset_right = 175.0 +offset_bottom = 622.0 fname = "УМ1535А" rname = "A16" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_12" +metadata/um = "um_10" [node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 47.0 -offset_top = 476.0 -offset_right = 214.0 -offset_bottom = 571.0 +offset_left = 8.0 +offset_top = 622.0 +offset_right = 175.0 +offset_bottom = 717.0 fname = "УМ1535А" rname = "A17" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_13" +metadata/um = "um_11" [node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")] layout_mode = 0 -offset_left = 47.0 -offset_top = 571.0 -offset_right = 214.0 -offset_bottom = 666.0 +offset_left = 8.0 +offset_top = 717.0 +offset_right = 175.0 +offset_bottom = 812.0 fname = "УМ1535А" rname = "A18" -value0_info = "Мощность" +value0_info = "Мощность, Вт" value1_info = "Температура,°C" -metadata/um = "um_14" - -[node name="input_0" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(496, 440) -sprite_frames = SubResource("SpriteFrames_s5gcy") - -[node name="input_1" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(248, 440) -sprite_frames = SubResource("SpriteFrames_s5gcy") - -[node name="output_0" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(496, 336) -sprite_frames = SubResource("SpriteFrames_s5gcy") - -[node name="output_1" type="AnimatedSprite2D" parent="."] -visible = false -position = Vector2(248, 336) -sprite_frames = SubResource("SpriteFrames_s5gcy") - -[node name="line" type="Line2D" parent="."] -position = Vector2(59, 920) -scale = Vector2(1.03548, 1) -points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0) -width = 2.0 -default_color = Color(1, 1, 1, 0.352941) -metadata/_edit_lock_ = true +metadata/um = "um_12" [node name="control_result" type="Label" parent="."] layout_mode = 0 -offset_left = 49.0 -offset_top = 993.0 -offset_right = 689.0 -offset_bottom = 1036.0 -theme_override_font_sizes/font_size = 22 +offset_left = 9.0 +offset_top = 960.0 +offset_right = 649.0 +offset_bottom = 1003.0 horizontal_alignment = 1 metadata/_edit_lock_ = true diff --git a/scenes/pribor-uf/pribor-uf.gd b/scenes/pribor-uf/pribor-uf.gd index 0e45033..5f6b038 100644 --- a/scenes/pribor-uf/pribor-uf.gd +++ b/scenes/pribor-uf/pribor-uf.gd @@ -100,7 +100,7 @@ func status_uf() -> void: $lbl_header2.text = 'Прибор исправен' $lbl_header2.modulate = Color.GREEN else: - $lbl_header2.text = 'Прибор неисправен' + $lbl_header2.text = 'Прибор не исправен' $lbl_header2.modulate = Color.RED $lbl_header2.visible = true diff --git a/scenes/pribor-uf/pribor-uf.tscn b/scenes/pribor-uf/pribor-uf.tscn index 82ceaaf..998ace6 100644 --- a/scenes/pribor-uf/pribor-uf.tscn +++ b/scenes/pribor-uf/pribor-uf.tscn @@ -7,16 +7,14 @@ [node name="pribor_uf" type="Control"] layout_mode = 3 anchors_preset = 0 -offset_left = -121.0 -offset_right = -121.0 script = ExtResource("1_7gtpa") [node name="ref_uf" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 244.0 -offset_top = 128.0 -offset_right = 765.0 -offset_bottom = 836.0 +offset_left = 187.0 +offset_top = 247.0 +offset_right = 708.0 +offset_bottom = 955.0 texture = ExtResource("2_ho0da") patch_margin_left = 16 patch_margin_top = 16 @@ -144,25 +142,19 @@ offset_bottom = 35.0 text = "Кассета В-13" [node name="lbl_header2" type="Label" parent="."] +visible = false layout_mode = 0 -offset_left = 252.0 -offset_top = 1009.0 -offset_right = 757.0 -offset_bottom = 1064.0 +offset_left = 199.0 +offset_top = 974.0 +offset_right = 704.0 +offset_bottom = 1000.0 theme_override_font_sizes/font_size = 22 -text = "Состояние неизвестно..." +text = "Прибор не исправен +" horizontal_alignment = 1 vertical_alignment = 1 [node name="timer" type="Timer" parent="."] autostart = true -[node name="line" type="Line2D" parent="."] -position = Vector2(195, 950) -scale = Vector2(1.03548, 1) -points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0) -width = 2.0 -default_color = Color(1, 1, 1, 0.352941) -metadata/_edit_lock_ = true - [connection signal="timeout" from="timer" to="." method="on_timer" binds= [&"уарэп-эмс"]] diff --git a/scenes/pribor-uyep/pribor-uyep.tscn b/scenes/pribor-uyep/pribor-uyep.tscn index f5a9c52..e78e782 100644 --- a/scenes/pribor-uyep/pribor-uyep.tscn +++ b/scenes/pribor-uyep/pribor-uyep.tscn @@ -17,10 +17,10 @@ script = ExtResource("1_46rp6") [node name="ref_G1" type="NinePatchRect" parent="."] layout_mode = 0 -offset_left = 88.0 -offset_top = 128.0 -offset_right = 678.0 -offset_bottom = 910.0 +offset_left = 70.0 +offset_top = 303.0 +offset_right = 660.0 +offset_bottom = 1085.0 texture = ExtResource("1_6olof") patch_margin_left = 16 patch_margin_top = 16 @@ -29,10 +29,10 @@ patch_margin_bottom = 16 [node name="spt25_A1" parent="." instance=ExtResource("6_60xs3")] layout_mode = 0 -offset_left = 106.0 -offset_top = 144.0 -offset_right = 361.0 -offset_bottom = 574.0 +offset_left = 88.0 +offset_top = 319.0 +offset_right = 343.0 +offset_bottom = 749.0 tooltip_text = "Ящик - 11, Позиция - 3" script = ExtResource("4_v0lil") unit_name = "уарэп-спт25-1" @@ -64,10 +64,10 @@ offset_bottom = 417.0 [node name="spt25_A2" parent="." instance=ExtResource("6_60xs3")] layout_mode = 0 -offset_left = 410.0 -offset_top = 145.0 -offset_right = 660.0 -offset_bottom = 575.0 +offset_left = 392.0 +offset_top = 320.0 +offset_right = 642.0 +offset_bottom = 750.0 tooltip_text = "Ящик - 11, Позиция - 2" script = ExtResource("4_v0lil") unit_name = "уарэп-спт25-2" @@ -98,10 +98,10 @@ offset_right = 235.0 offset_bottom = 417.0 [node name="sch3" parent="." instance=ExtResource("7_qu7ja")] -offset_left = 106.0 -offset_top = 599.0 -offset_right = 661.0 -offset_bottom = 884.0 +offset_left = 88.0 +offset_top = 774.0 +offset_right = 643.0 +offset_bottom = 1059.0 unit_name = "уарэп-щ3" fname = "Щ3 (контроль и управление питанием)" rname = "A1" diff --git a/scenes/tabs-switch/lbl_ready.gd b/scenes/tabs-switch/lbl_ready.gd index b089367..f35d4ed 100644 --- a/scenes/tabs-switch/lbl_ready.gd +++ b/scenes/tabs-switch/lbl_ready.gd @@ -4,7 +4,7 @@ const STATUS_GOOD := {"text": "Исправно", "color": Color.GREEN, "font_co const STATUS_BAD := {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE} var _is_uf_status_initialized: bool = false var is_prd_operational: bool = true -var is_uf_operational: bool = true +var is_uf_operational: bool = false func _ready() -> void: diff --git a/scenes/tabs-switch/tab-switch.tscn b/scenes/tabs-switch/tab-switch.tscn index 1c958ec..a148f04 100644 --- a/scenes/tabs-switch/tab-switch.tscn +++ b/scenes/tabs-switch/tab-switch.tscn @@ -79,10 +79,25 @@ visible = false layout_mode = 2 metadata/_tab_index = 5 +[node name="lbl_ready" type="Label" parent="."] +layout_mode = 0 +offset_left = 1503.0 +offset_right = 1600.0 +offset_bottom = 27.0 +tooltip_text = "Готовность аппаратуры к работе" +mouse_filter = 0 +theme_override_font_sizes/font_size = 14 +theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22") +text = "Нет связи" +horizontal_alignment = 1 +vertical_alignment = 1 +script = ExtResource("8_tidwt") +metadata/_edit_lock_ = true + [node name="remote_control" type="Label" parent="."] layout_mode = 2 -offset_left = 1242.0 -offset_right = 1402.0 +offset_left = 1244.0 +offset_right = 1401.0 offset_bottom = 27.0 tooltip_text = "Комплекс находится под внешним управлением" mouse_filter = 0 @@ -94,7 +109,7 @@ vertical_alignment = 1 [node name="тренаж_режим" type="Button" parent="."] layout_mode = 0 -offset_left = 1405.0 +offset_left = 1404.0 offset_right = 1501.0 offset_bottom = 27.0 tooltip_text = "Задействовать режим Тренаж" @@ -110,20 +125,5 @@ toggle_mode = true text = "Тренаж" script = ExtResource("9_41d34") -[node name="lbl_ready" type="Label" parent="."] -layout_mode = 0 -offset_left = 1504.0 -offset_right = 1600.0 -offset_bottom = 27.0 -tooltip_text = "Готовность аппаратуры к работе" -mouse_filter = 0 -theme_override_font_sizes/font_size = 14 -theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22") -text = "Нет связи" -horizontal_alignment = 1 -vertical_alignment = 1 -script = ExtResource("8_tidwt") -metadata/_edit_lock_ = true - [connection signal="tab_changed" from="tab_switch" to="tab_switch" method="_on_tab_changed"] -[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenazh_toggled"] +[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenaj_toggled"] diff --git a/scenes/tilemap/mark.tscn b/scenes/tilemap/mark.tscn index 8fc00fe..4cbfc0c 100644 --- a/scenes/tilemap/mark.tscn +++ b/scenes/tilemap/mark.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://ce5mtxqd1ndru"] -[ext_resource type="Texture2D" uid="uid://cgqo5gucd2be0" path="res://scenes/tilemap/dot.png" id="2_rq0y0"] +[ext_resource type="Texture2D" uid="uid://cgqo5gucd2be0" path="res://data/dot.png" id="2_rq0y0"] [node name="rect" type="TextureRect"] offset_left = -16.0 diff --git a/scenes/tilemap/ship_mark.tscn b/scenes/tilemap/ship_mark.tscn index fbf2558..bac2bd2 100644 --- a/scenes/tilemap/ship_mark.tscn +++ b/scenes/tilemap/ship_mark.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://c2523fcn14gn4"] -[ext_resource type="Texture2D" uid="uid://cj1f2uy6qfvki" path="res://scenes/tilemap/23900.png" id="1_v0nwa"] +[ext_resource type="Texture2D" uid="uid://cj1f2uy6qfvki" path="res://data/23900.png" id="1_v0nwa"] [node name="23900" type="Sprite2D"] scale = Vector2(0.496934, 0.496934) diff --git a/scenes/tilemap/threat.tscn b/scenes/tilemap/threat.tscn index 1457760..d671ae2 100644 --- a/scenes/tilemap/threat.tscn +++ b/scenes/tilemap/threat.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=2 format=3 uid="uid://cv342kc1jj5hb"] -[ext_resource type="Texture2D" uid="uid://mobingoxskg1" path="res://scenes/tilemap/threat.png" id="1_pvxsy"] +[ext_resource type="Texture2D" uid="uid://mobingoxskg1" path="res://data/threat.png" id="1_pvxsy"] [node name="Threat" type="Sprite2D"] scale = Vector2(0.0244268, 0.0244268) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 74d15ae..13525aa 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -373,7 +373,7 @@ func _process(delta) -> void: remove_child(req) req.queue_free() _req_count -= 1 - push_error('запрос \"%s\" не отправлен' % tile.url) #TODO: For Deugs + push_error('запрос \"%s\" не отправлен' % tile.url) if _queue.is_empty(): emit_signal('load_completed') @@ -727,7 +727,7 @@ func blend_mask(val: bool) -> void: func update_coordinates_label(lon: float, lat: float) -> void: - coordinates_label = 'Координаты:\nNS:%f\nEW:%f' % [lat, lon] + coordinates_label = 'Координаты: NS:%f, EW:%f' % [lat, lon] signaller.emit_signal('update_coordinates_map', coordinates_label) diff --git a/scenes/контроль/блок-в.tscn b/scenes/контроль/блок-в.tscn index 69bb8d2..06dcfa8 100644 --- a/scenes/контроль/блок-в.tscn +++ b/scenes/контроль/блок-в.tscn @@ -35,7 +35,7 @@ signal pressed(control: PanelContainer) if not is_inside_tree(): return $margin/vbox/grid1/level7.value = v - $margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 50 else Color.GOLD if v >= 40 else Color.WHITE + $margin/vbox/grid1/level7.tint_progress = Color.RED if v > 70 else Color.WHITE @export var min_value0: float: @@ -191,8 +191,8 @@ func _enter_tree_defered(): $margin/vbox/grid0/rname.text = rname $margin/vbox/grid0/fname.text = fname $margin/vbox/grid0/state.texture = textures[state] - #else: - #push_warning('обращение к %s вне дерева' % self) TODO: пишеться только когда заходишь в проект а дальше не используется + else: + push_warning('обращение к %s вне дерева' % self) func get_level_nodes() -> Array: @@ -273,9 +273,10 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u") script = SubResource("GDScript_oj3k3") textures = [ExtResource("1_n1aqt"), ExtResource("2_rim3u"), ExtResource("3_3w8fg")] value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0] -min_value1 = -40.0 -max_value0 = 1400.0 -max_value1 = 55.0 +value1 = 56.0 +min_value1 = -50.0 +max_value0 = 100.0 +max_value1 = 120.0 step0 = 1.0 step1 = 1.0 value_name0 = "P,%" @@ -475,11 +476,12 @@ layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 tooltip_text = " -Текущее: 0.00 -Диапазон: -40.00…60.00" +Текущее: 56.00 +Диапазон: -50.00…120.00" mouse_filter = 0 -min_value = -40.0 -max_value = 55.0 +min_value = -50.0 +max_value = 120.0 +value = 56.0 fill_mode = 3 nine_patch_stretch = true stretch_margin_left = 8 diff --git a/scenes/контроль/кассета-п-2.tscn b/scenes/контроль/кассета-п-2.tscn index cf2dd65..a265d9d 100644 --- a/scenes/контроль/кассета-п-2.tscn +++ b/scenes/контроль/кассета-п-2.tscn @@ -14,7 +14,7 @@ patch_margin_right = 16 patch_margin_bottom = 16 script = ExtResource("2_mdnod") -[node name="ref_A26" parent="." groups=["power_supply"] instance=ExtResource("3_4a27g")] +[node name="ref_A26" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("3_4a27g")] offset_left = 10.0 offset_top = 30.0 offset_right = 60.0 @@ -23,7 +23,7 @@ fname = "ИП9-50" rname = "A22" metadata/ip = "ip9_50_3" -[node name="ref_A23" parent="." groups=["power_supply"] instance=ExtResource("3_4a27g")] +[node name="ref_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("3_4a27g")] offset_left = 60.0 offset_top = 30.0 offset_right = 110.0 @@ -35,10 +35,9 @@ metadata/ip = "ip12_50_2" [node name="lbl_fname" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 -offset_left = 8.0 +offset_left = 5.0 offset_top = 5.0 -offset_right = 112.0 +offset_right = 105.0 offset_bottom = 30.0 -text = "Касета П-2" horizontal_alignment = 1 vertical_alignment = 1 diff --git a/scenes/контроль/кассета-у-5-нв.tscn b/scenes/контроль/кассета-у-5-нв.tscn index 011731b..dad7c79 100644 --- a/scenes/контроль/кассета-у-5-нв.tscn +++ b/scenes/контроль/кассета-у-5-нв.tscn @@ -31,7 +31,7 @@ offset_top = 32.0 offset_right = 55.0 offset_bottom = 182.0 fname = "ИП5-25" -rname = "A31" +rname = "A24" metadata/ip = "ip5_25" [node name="ref_A30" parent="." groups=["y-5"] instance=ExtResource("3_picsk")] @@ -40,7 +40,7 @@ offset_top = 32.0 offset_right = 105.0 offset_bottom = 182.0 fname = "ЯУ-07Б" -rname = "A37" +rname = "A30" metadata/y5 = "yau07" [node name="ref_A26" parent="." groups=["y-5"] instance=ExtResource("3_picsk")] @@ -49,7 +49,7 @@ offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 fname = "ЭМС-Г" -rname = "A33" +rname = "A26" metadata/y5 = "ems" [node name="ref_A27" parent="." groups=["y-5"] instance=ExtResource("3_picsk")] @@ -58,7 +58,7 @@ offset_top = 32.0 offset_right = 205.0 offset_bottom = 182.0 fname = "УГ" -rname = "A34" +rname = "A27" metadata/y5 = "ug" [node name="ref_A28" parent="." groups=["y-5"] instance=ExtResource("3_picsk")] @@ -67,7 +67,7 @@ offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A36" +rname = "A28" metadata/y5 = "ukp1" [node name="ref_A29" parent="." groups=["y-5"] instance=ExtResource("3_picsk")] @@ -76,5 +76,5 @@ offset_top = 32.0 offset_right = 304.0 offset_bottom = 182.0 fname = "УКП" -rname = "A35" +rname = "A29" metadata/y5 = "ukp2" diff --git a/scenes/контроль/кнопка-прибора.gd b/scenes/контроль/кнопка-прибора.gd index 837c5c1..d24dae3 100644 --- a/scenes/контроль/кнопка-прибора.gd +++ b/scenes/контроль/кнопка-прибора.gd @@ -1,85 +1,39 @@ @tool + extends TextureButton -@onready var tween: Tween @export var state_colors: Array - -func _ready(): - toggle_mode = true - focus_mode = Control.FOCUS_ALL - connect("focus_entered", _on_focus_entered) - connect("focus_exited", _on_focus_exited) +func _on_toggled(toggled_on): $frame.visible = toggled_on func _enter_tree() -> void: - if has_node("label"): - $label.self_modulate = state_colors[state] + $label.self_modulate = state_colors[state] + ProjectSettings.connect('settings_changed', _on_settings_changed) -func update_progress_bar(target_value) -> void: - if tween: - tween.kill() - tween = create_tween() - tween.tween_property($control_progress, "value", target_value, 0.3) +func _exit_tree() -> void: + ProjectSettings.disconnect('settings_changed', _on_settings_changed) -func _on_toggled(toggled_on): - if has_node("frame"): - $frame.visible = toggled_on - - -func _on_focus_entered(): - button_pressed = true - #enter_press() TODO: Пока что без выбора прибора - - -func _on_focus_exited(): - pass - - -func enter_press(): - var enter_event = InputEventAction.new() - enter_event.action = "ui_accept" - enter_event.pressed = true - Input.parse_input_event(enter_event) +func _on_settings_changed(): + if not is_inside_tree(): return + var white_color = ProjectSettings.get_setting('Схема прибора. Белый цвет', Color.DIM_GRAY) + var black_color = ProjectSettings.get_setting('Схема прибора. Чёрный цвет', Color.CORAL) + $pic_functional.material.set('shader_parameter/white', white_color) + $pic_functional.material.set('shader_parameter/black', black_color) @export var state: int: set(v): v = 0 if v < 0 else v % state_colors.size() state = v - if is_inside_tree() and has_node("label"): + if is_inside_tree(): $label.self_modulate = state_colors[v] -@export var progress_value: float = 0.0: +@export var show_functional: bool: set(v): - progress_value = v - + show_functional = v if is_inside_tree(): - update_progress_bar(v) - var max_val = $control_progress.get('max_value') - var percentage = (v / max_val) * 100.0 - $control_progress.tooltip_text = 'Процесс контроля %01d%%' % percentage - - -@export var progress_visible: bool: - set(v): - progress_visible = v - if is_inside_tree(): - $control_progress.visible = v - - -@export var progress_max_value: int: - set(v): - progress_max_value = v - if is_inside_tree(): - $control_progress.max_value = v - - -@export var progress_min_value: int: - set(v): - progress_min_value = v - if is_inside_tree(): - $control_progress.min_value = v + $pic_functional.visible = v diff --git a/scenes/контроль/контроль.tscn b/scenes/контроль/контроль.tscn index c0a84d2..039a6ae 100644 --- a/scenes/контроль/контроль.tscn +++ b/scenes/контроль/контроль.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=21 format=3 uid="uid://lwmw4egynmd1"] +[gd_scene load_steps=26 format=3 uid="uid://lwmw4egynmd1"] [ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"] [ext_resource type="Script" uid="uid://q3gmpsqspjfp" path="res://scenes/контроль/внешний.gd" id="2_8r80x"] @@ -12,12 +12,16 @@ [ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="7_6j01w"] [ext_resource type="Texture2D" uid="uid://u3tnejvpm8it" path="res://data/disconnect-a.png" id="8_gs2be"] [ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="8_isjua"] +[ext_resource type="Shader" uid="uid://83fx15q1xlid" path="res://shaders/two-color.gdshader" id="9_71ec4"] [ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="9_iqgf5"] [ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="9_ll0vs"] -[ext_resource type="Texture2D" uid="uid://00871pb6moln" path="res://data/прогресс-фон-1.png" id="9_w6m6a"] -[ext_resource type="Texture2D" uid="uid://c1k856fxhrjnh" path="res://data/прогресс-заполнение-1.png" id="10_lbx5w"] +[ext_resource type="Texture2D" uid="uid://bktiige0i2lhl" path="res://data/У-РЭП-РПД-Н.png" id="9_qe1go"] +[ext_resource type="Texture2D" uid="uid://b2vf7en1jj8dv" path="res://data/У-РЭП-РПД-В.png" id="9_w6m6a"] +[ext_resource type="Texture2D" uid="uid://u7h3l0jjrsnp" path="res://data/У-УФ.png" id="11_gjf0t"] [ext_resource type="Script" uid="uid://bncy1x53jp73d" path="res://scenes/контроль/connect_pribor.gd" id="11_u7tym"] -[ext_resource type="Script" uid="uid://xjs7owe2iexn" path="res://scenes/контроль/control_prd.gd" id="18_lbx5w"] +[ext_resource type="Texture2D" uid="uid://vdhmga62vjsj" path="res://data/АФСП-РТР.png" id="13_32yvq"] +[ext_resource type="Texture2D" uid="uid://dm350ta8noa0v" path="res://data/У-РЭП-РПД-К.png" id="16_32yvq"] +[ext_resource type="Texture2D" uid="uid://c3cyog3gy24ft" path="res://data/У-ЭП.png" id="16_gjf0t"] [sub_resource type="GDScript" id="GDScript_iqgf5"] script/source = "extends Panel @@ -46,23 +50,26 @@ const PRIBORS_RES = \\ 'pribor_uf': ['res://scenes/pribor-uf/pribor-uf.tscn', 'Контроль исправности прибора УФ'], 'pribor_uyep': ['res://scenes/pribor-uyep/pribor-uyep.tscn', 'Контроль исправности устройства У-ЭП'], } -var ctl_btn_state := false + + +var cur_pribor_node = null func on_line_changed(u, conn_node, _pribor_meta): conn_node.set_val(u.online) func on_serv_changed(u, pribor_node, _pribor_meta): pribor_node.state = int(u.serviceability) -var count_device_control_is_ready: int = 0 func on_mode_changed(): clean_pribor_items() reset_pribor_buttons() + $chk_show_functional.disabled = true func reset_pribor_buttons(): var pribor_buttons: = get_tree().get_nodes_in_group('pribor_buttons') for node in pribor_buttons: node.button_pressed = false + node.show_functional = false func _ready(): @@ -89,9 +96,6 @@ func _ready(): if prd.prd_dict.has(item): var prd_module = prd.prd_dict[item] prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module, pribor_node)) - prd_module.unit_control.connect('update_progress', Callable(self, 'on_update_progress').bind(pribor_node)) - prd_module.unit_control.connect('update_max_value_progress', Callable(self, 'on_update_max_value_progress').bind(pribor_node)) - prd_module.unit_control.connect('control_is_over', Callable(self, 'on_control_is_over').bind(prd_module.unit_control)) if item == 'уарэп-эмс': signaller.connect('update_uf_serviceability', Callable(self, 'on_update_uf_serviceability').bind(pribor_node)) # Пиктограммы приборов, которые отображают состояние подключения только @@ -105,7 +109,6 @@ func _ready(): signaller.conn(signaller.режим_журнал, on_mode_changed) signaller.conn(signaller.режим_настройки, on_mode_changed) signaller.conn(signaller.режим_эмс, on_mode_changed) - signaller.connect('debag_control_pressed', Callable(self, 'on_control_button_pressed')) func online_change_arr(_u, conn_node, pribor_meta): @@ -126,6 +129,10 @@ func clean_pribor_items(): func on_pribor_press(pribor_path, header_text, pribor_node): + if cur_pribor_node: + cur_pribor_node.show_functional = false + $chk_show_functional.button_pressed = false + cur_pribor_node = pribor_node clean_pribor_items() var pribor_obj = load(pribor_path) if not pribor_obj: @@ -136,13 +143,13 @@ func on_pribor_press(pribor_path, header_text, pribor_node): push_error('экземпляр не создан: \\\"%s\\\" (%s)' % [pribor_path, header_text]) return $lbl_header.text = header_text + $chk_show_functional.disabled = false var meta_list = pribor_node.get_meta_list() if meta_list.find('unit_name') > -1: var unit_name = pribor_node.get_meta('unit_name') pribor.set_meta('unit_name', unit_name) pribor.add_to_group('pribor_items') add_child(pribor) - update_pribor_items_visibility() func on_serviceability_changed(prd_module: Object, prd_pribor:Node)-> void: @@ -156,45 +163,23 @@ func on_update_uf_serviceability(uf_serviceaability: bool, uf_pribor: Node)-> vo uf_pribor.state = 1 if uf_serviceaability else 2 -func _on_control_prd_pressed() -> void: - count_device_control_is_ready = 0 - signaller.emit_signal('start_contol_device') +func _on_chk_show_functional_toggled(toggled_on: bool) -> void: + if cur_pribor_node: + cur_pribor_node.show_functional = toggled_on -func on_update_progress(value_progress: float, pribor_node: Node) -> void: - pribor_node.progress_value = value_progress - pribor_node.progress_visible = value_progress > 0 - - -func on_update_max_value_progress(max_value_progress: int, pribor_node: Node) -> void: - pribor_node.progress_max_value = max_value_progress - - -func on_control_is_over(pribor_node: Node) -> void: - if pribor_node.self_name in ['1н', '2н', '3н', '4н', '1в', '2в', '3в', '4в', '1к', '2к', '3к', '4к',]: - count_device_control_is_ready += 1 - if count_device_control_is_ready == 12: - var time_dict = Time.get_datetime_dict_from_system() - $control_prd.text = 'Контроль выполнен %02d:%02d/%02d.%02d' % [ - time_dict.hour, - time_dict.minute, - time_dict.day, - time_dict.month] - $control_prd.disabled = false - $control_prd.tooltip_text = 'Нажать для повторного контроля ' - - -func on_control_button_pressed(state: bool) -> void: - ctl_btn_state = state - update_pribor_items_visibility() - - -func update_pribor_items_visibility(): - var pribor_items = get_tree().get_nodes_in_group('pribor_items') - for pribor in pribor_items: - for child_name in ['input_0', 'output_0', 'input_1', 'output_1', 'input_2', 'output_1']: - if pribor.has_node(child_name): - pribor.get_node(child_name).visible = ctl_btn_state +func _on_gui_input(event: InputEvent) -> void: + if event is InputEventMouseButton and event.pressed and event.button_index == MOUSE_BUTTON_LEFT: + if cur_pribor_node: + cur_pribor_node.show_functional = false + var pribor_buttons := get_tree().get_nodes_in_group('pribor_buttons') + for node in pribor_buttons: + node.button_pressed = false + clean_pribor_items() + cur_pribor_node = null + $chk_show_functional.button_pressed = false + $chk_show_functional.disabled = true + $lbl_header.text = \"\" " [sub_resource type="SpriteFrames" id="SpriteFrames_foasq"] @@ -211,6 +196,12 @@ animations = [{ "speed": 5.0 }] +[sub_resource type="ShaderMaterial" id="ShaderMaterial_71ec4"] +shader = ExtResource("9_71ec4") +shader_parameter/white = Vector3(0.14, 0.13, 0.13) +shader_parameter/black = Vector3(0.95, 0.55, 0.05) +shader_parameter/gamma = 2.0 + [node name="Контроль" type="Panel"] anchors_preset = 15 anchor_right = 1.0 @@ -219,14 +210,16 @@ grow_horizontal = 2 grow_vertical = 2 script = SubResource("GDScript_iqgf5") metadata/_edit_lock_ = true +metadata/_edit_vertical_guides_ = [21.0, 1578.0] +metadata/_edit_horizontal_guides_ = [200.0, 51.0] [node name="capsrpb" type="TextureRect" parent="." groups=["pribor_pics"]] editor_description = "Кнопка для отображения внешних соединений." self_modulate = Color(0.788235, 0.788235, 0.788235, 1) layout_mode = 0 -offset_left = 945.0 +offset_left = 959.0 offset_top = 1021.0 -offset_right = 1201.0 +offset_right = 1215.0 offset_bottom = 1277.0 scale = Vector2(0.25, 0.25) size_flags_horizontal = 15 @@ -258,9 +251,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для отображения внешних соединений." self_modulate = Color(0.788235, 0.788235, 0.788235, 1) layout_mode = 0 -offset_left = 1074.0 +offset_left = 1088.0 offset_top = 1021.0 -offset_right = 1330.0 +offset_right = 1344.0 offset_bottom = 1277.0 scale = Vector2(0.25, 0.25) size_flags_horizontal = 15 @@ -293,9 +286,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для отображения внешних соединений." self_modulate = Color(0.788235, 0.788235, 0.788235, 1) layout_mode = 0 -offset_left = 1202.0 +offset_left = 1216.0 offset_top = 1021.0 -offset_right = 1458.0 +offset_right = 1472.0 offset_bottom = 1277.0 scale = Vector2(0.25, 0.25) size_flags_horizontal = 15 @@ -328,9 +321,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для отображения внешних соединений." self_modulate = Color(0.788235, 0.788235, 0.788235, 1) layout_mode = 0 -offset_left = 1330.0 +offset_left = 1344.0 offset_top = 1021.0 -offset_right = 1586.0 +offset_right = 1600.0 offset_bottom = 1277.0 scale = Vector2(0.25, 0.25) size_flags_horizontal = 15 @@ -363,9 +356,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для отображения внешних соединений." self_modulate = Color(0.788235, 0.788235, 0.788235, 1) layout_mode = 0 -offset_left = 1458.0 +offset_left = 1472.0 offset_top = 1021.0 -offset_right = 1714.0 +offset_right = 1728.0 offset_bottom = 1277.0 scale = Vector2(0.25, 0.25) size_flags_horizontal = 15 @@ -398,9 +391,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1048.0 -offset_top = 179.0 +offset_top = 193.0 offset_right = 1125.0 -offset_bottom = 295.0 +offset_bottom = 309.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -416,9 +409,9 @@ metadata/unit_name = ["уарэп-яу07-1н"] [node name="label" type="Label" parent="pribor_prd_n_1"] layout_mode = 0 offset_left = 8.0 -offset_top = -40.0 +offset_top = -38.0 offset_right = 60.0 -offset_bottom = -21.0 +offset_bottom = -19.0 text = "ПРД Н1" horizontal_alignment = 1 vertical_alignment = 1 @@ -439,6 +432,7 @@ patch_margin_right = 16 patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_n_1"] +visible = false light_mask = 3 position = Vector2(35, -10) scale = Vector2(0.625, 0.625) @@ -446,36 +440,33 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_1"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_n_1"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -4.0 -offset_top = 124.0 -offset_right = 89.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1029.0 +offset_top = 9.0 +offset_right = 576.0 +offset_bottom = 830.0 +scale = Vector2(0.97094, 0.97094) +texture = ExtResource("9_qe1go") + +[node name="connect_pribor2" type="AnimatedSprite2D" parent="pribor_prd_n_1"] +light_mask = 3 +position = Vector2(35, -10) +scale = Vector2(0.625, 0.625) +sprite_frames = SubResource("SpriteFrames_foasq") +frame_progress = 0.72355 +script = ExtResource("11_u7tym") [node name="pribor_uf" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1183.0 -offset_top = 558.0 +offset_top = 565.0 offset_right = 1294.0 -offset_bottom = 743.0 +offset_bottom = 750.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -492,9 +483,9 @@ metadata/online_proc = "on_line_changed" self_modulate = Color(0, 1, 0, 1) layout_mode = 0 offset_left = 15.0 -offset_top = -44.0 +offset_top = -34.0 offset_right = 91.0 -offset_bottom = -25.0 +offset_bottom = -15.0 text = "УФ" horizontal_alignment = 1 vertical_alignment = 1 @@ -522,13 +513,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="pic_functional" type="TextureRect" parent="pribor_uf"] +visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") +layout_mode = 0 +offset_left = -1155.0 +offset_top = -362.0 +offset_right = -96.0001 +offset_bottom = 311.0 +scale = Vector2(0.789429, 0.789429) +texture = ExtResource("11_gjf0t") + [node name="pribor_rtr" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1058.0 -offset_top = 588.0 +offset_top = 595.0 offset_right = 1164.0 -offset_bottom = 744.0 +offset_bottom = 751.0 pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 size_flags_vertical = 15 @@ -543,10 +546,10 @@ metadata/online_proc = "online_change_arr" [node name="label" type="Label" parent="pribor_rtr"] layout_mode = 0 -offset_left = 11.0 -offset_top = -49.0 -offset_right = 94.0 -offset_bottom = -30.0 +offset_left = 12.0 +offset_top = -54.0 +offset_right = 95.0 +offset_bottom = -35.0 text = "РТР" horizontal_alignment = 1 vertical_alignment = 1 @@ -566,31 +569,33 @@ patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="label2" type="Label" parent="pribor_rtr"] -layout_mode = 0 -offset_left = 11.0 -offset_top = -49.0 -offset_right = 94.0 -offset_bottom = -30.0 -text = "РТР" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"] light_mask = 3 -position = Vector2(53, -15) +position = Vector2(55, -15) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="pic_functional" type="TextureRect" parent="pribor_rtr"] +visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") +layout_mode = 0 +offset_left = -1036.0 +offset_top = -394.0 +offset_right = 927.0 +offset_bottom = 595.0 +scale = Vector2(0.792688, 0.792688) +texture = ExtResource("13_32yvq") + [node name="pribor_afsp_1" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1053.0 -offset_top = 425.0 +offset_top = 432.0 offset_right = 1886.0 -offset_bottom = 1065.0 +offset_bottom = 1072.0 scale = Vector2(0.2, 0.2) pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 @@ -606,9 +611,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_afsp_1"] layout_mode = 0 -offset_left = 175.0 +offset_left = 165.0 offset_top = -245.0 -offset_right = 272.0 +offset_right = 262.0 offset_bottom = -225.0 scale = Vector2(5, 5) text = "АФСП 1" @@ -631,17 +636,6 @@ patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="label2" type="Label" parent="pribor_afsp_1"] -layout_mode = 0 -offset_left = 175.0 -offset_top = -245.0 -offset_right = 272.0 -offset_bottom = -225.0 -scale = Vector2(5, 5) -text = "АФСП 1" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_1"] light_mask = 3 position = Vector2(415, -40) @@ -650,13 +644,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="pic_functional" type="TextureRect" parent="pribor_afsp_1"] +visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") +layout_mode = 0 +offset_left = -5120.0 +offset_top = -895.0 +offset_right = -3157.0 +offset_bottom = 93.9999 +scale = Vector2(3.96323, 3.96323) +texture = ExtResource("13_32yvq") + [node name="pribor_afsp_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1243.0 -offset_top = 425.0 +offset_top = 432.0 offset_right = 2076.0 -offset_bottom = 1065.0 +offset_bottom = 1072.0 scale = Vector2(0.2, 0.2) pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 @@ -673,9 +679,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_afsp_2"] layout_mode = 0 -offset_left = 175.0 +offset_left = 200.0 offset_top = -240.0 -offset_right = 272.0 +offset_right = 297.0 offset_bottom = -220.0 scale = Vector2(5, 5) text = "АФСП 2" @@ -698,32 +704,33 @@ patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="label2" type="Label" parent="pribor_afsp_2"] -layout_mode = 0 -offset_left = 175.0 -offset_top = -240.0 -offset_right = 272.0 -offset_bottom = -220.0 -scale = Vector2(5, 5) -text = "АФСП 2" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"] light_mask = 3 -position = Vector2(415, -40) +position = Vector2(425, -40) scale = Vector2(3, 3) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="pic_functional" type="TextureRect" parent="pribor_afsp_2"] +visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") +layout_mode = 0 +offset_left = -6070.0 +offset_top = -900.0 +offset_right = -4107.0 +offset_bottom = 89.0001 +scale = Vector2(3.96409, 4.54663) +texture = ExtResource("13_32yvq") + [node name="pribor_uyep" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1313.0 -offset_top = 558.0 +offset_top = 565.0 offset_right = 1407.0 -offset_bottom = 744.0 +offset_bottom = 751.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -738,9 +745,9 @@ metadata/online_proc = "online_change_arr" [node name="label" type="Label" parent="pribor_uyep"] layout_mode = 0 offset_left = 26.8566 -offset_top = -43.3276 +offset_top = -38.3276 offset_right = 66.8566 -offset_bottom = -24.3276 +offset_bottom = -19.3276 text = "У-ЭП" horizontal_alignment = 1 vertical_alignment = 1 @@ -768,13 +775,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.872305 script = ExtResource("11_u7tym") +[node name="pic_functional" type="TextureRect" parent="pribor_uyep"] +visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") +layout_mode = 0 +offset_left = -1292.0 +offset_top = -365.0 +offset_right = 821.0 +offset_bottom = 764.0 +scale = Vector2(0.736875, 0.814493) +texture = ExtResource("16_gjf0t") + [node name="pribor_prd_v_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1440.0 -offset_top = 687.0 +offset_top = 680.0 offset_right = 1517.0 -offset_bottom = 803.0 +offset_bottom = 796.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -789,10 +808,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_2"] layout_mode = 0 -offset_left = 11.0 -offset_top = -42.0 -offset_right = 63.0 -offset_bottom = -23.0 +offset_left = 14.0 +offset_top = -38.0 +offset_right = 66.0 +offset_bottom = -19.0 text = "ПРД В2" horizontal_alignment = 1 vertical_alignment = 1 @@ -814,42 +833,31 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_v_2"] light_mask = 3 -position = Vector2(37, -10) +position = Vector2(40, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_2"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_v_2"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -4.0 -offset_top = 124.0 -offset_right = 89.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1419.0 +offset_top = -480.0 +offset_right = 173.0 +offset_bottom = 328.0 +scale = Vector2(0.977411, 0.977411) +texture = ExtResource("9_w6m6a") [node name="pribor_prd_n_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1440.0 -offset_top = 322.0 +offset_top = 345.0 offset_right = 1517.0 -offset_bottom = 438.0 +offset_bottom = 461.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -864,10 +872,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_2"] layout_mode = 0 -offset_left = 11.0 -offset_top = -42.0 -offset_right = 63.0 -offset_bottom = -23.0 +offset_left = 15.0 +offset_top = -38.0 +offset_right = 67.0 +offset_bottom = -19.0 theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 0 text = "ПРД Н2" @@ -890,43 +898,41 @@ patch_margin_right = 16 patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_n_2"] +visible = false light_mask = 3 -position = Vector2(37, -10) +position = Vector2(40, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_2"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_n_2"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -4.0 -offset_top = 124.0 -offset_right = 89.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1419.0 +offset_top = -145.0 +offset_right = 186.0 +offset_bottom = 676.0 +scale = Vector2(0.96888, 0.96888) +texture = ExtResource("9_qe1go") + +[node name="connect_pribor2" type="AnimatedSprite2D" parent="pribor_prd_n_2"] +light_mask = 3 +position = Vector2(35, -10) +scale = Vector2(0.625, 0.625) +sprite_frames = SubResource("SpriteFrames_foasq") +frame_progress = 0.72355 +script = ExtResource("11_u7tym") [node name="pribor_prd_k_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1440.0 -offset_top = 504.0 +offset_top = 515.0 offset_right = 1517.0 -offset_bottom = 620.0 +offset_bottom = 631.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -941,10 +947,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_2"] layout_mode = 0 -offset_left = 11.0 -offset_top = -42.0 -offset_right = 63.0 -offset_bottom = -23.0 +offset_left = 17.0 +offset_top = -38.0 +offset_right = 69.0 +offset_bottom = -19.0 text = "ПРД К2" horizontal_alignment = 1 vertical_alignment = 1 @@ -966,42 +972,31 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_k_2"] light_mask = 3 -position = Vector2(37, -10) +position = Vector2(43, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_2"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_k_2"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -4.0 -offset_top = 124.0 -offset_right = 89.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1418.0 +offset_top = -314.0 +offset_right = 345.0 +offset_bottom = 649.0 +scale = Vector2(0.881522, 0.881522) +texture = ExtResource("16_32yvq") [node name="pribor_prd_v_3" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1048.0 -offset_top = 803.0 +offset_top = 802.0 offset_right = 1125.0 -offset_bottom = 919.0 +offset_bottom = 918.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1017,9 +1012,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_3"] layout_mode = 0 offset_left = 9.0 -offset_top = -41.0 +offset_top = -38.0 offset_right = 61.0 -offset_bottom = -22.0 +offset_bottom = -19.0 text = "ПРД В3" horizontal_alignment = 1 vertical_alignment = 1 @@ -1041,42 +1036,31 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_v_3"] light_mask = 3 -position = Vector2(35, -10) +position = Vector2(34, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_3"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_v_3"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -8.0 -offset_top = 124.0 -offset_right = 85.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1026.0 +offset_top = -601.0 +offset_right = 566.0 +offset_bottom = 207.0 +scale = Vector2(0.975409, 0.975409) +texture = ExtResource("9_w6m6a") [node name="pribor_prd_n_3" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1323.0 -offset_top = 803.0 +offset_top = 802.0 offset_right = 1400.0 -offset_bottom = 919.0 +offset_bottom = 918.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1092,9 +1076,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_3"] layout_mode = 0 offset_left = 8.0 -offset_top = -43.0 +offset_top = -38.0 offset_right = 60.0 -offset_bottom = -24.0 +offset_bottom = -19.0 text = "ПРД Н3" horizontal_alignment = 1 vertical_alignment = 1 @@ -1122,36 +1106,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_3"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_n_3"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -7.0 -offset_top = 124.0 -offset_right = 86.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1302.0 +offset_top = -602.0 +offset_right = 303.0 +offset_bottom = 219.0 +scale = Vector2(0.969291, 0.969291) +texture = ExtResource("9_qe1go") [node name="pribor_prd_k_3" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1188.0 -offset_top = 803.0 +offset_top = 802.0 offset_right = 1265.0 -offset_bottom = 919.0 +offset_bottom = 918.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1167,9 +1140,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_3"] layout_mode = 0 offset_left = 9.0 -offset_top = -42.0 +offset_top = -38.0 offset_right = 61.0 -offset_bottom = -23.0 +offset_bottom = -19.0 text = "ПРД К3" horizontal_alignment = 1 vertical_alignment = 1 @@ -1197,36 +1170,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_3"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_k_3"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -8.0 -offset_top = 124.0 -offset_right = 85.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1167.0 +offset_top = -602.0 +offset_right = 596.0 +offset_bottom = 361.0 +scale = Vector2(0.882165, 0.896739) +texture = ExtResource("16_32yvq") [node name="pribor_prd_v_1" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1328.0 -offset_top = 179.0 +offset_top = 198.0 offset_right = 1405.0 -offset_bottom = 295.0 +offset_bottom = 314.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1242,9 +1204,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_1"] layout_mode = 0 offset_left = 8.0 -offset_top = -44.0 +offset_top = -38.0 offset_right = 60.0 -offset_bottom = -25.0 +offset_bottom = -19.0 text = "ПРД В1" horizontal_alignment = 1 vertical_alignment = 1 @@ -1272,36 +1234,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_1"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_v_1"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -4.0 -offset_top = 124.0 -offset_right = 89.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1304.0 +offset_top = 2.0 +offset_right = 288.0 +offset_bottom = 810.0 +scale = Vector2(0.974661, 0.974661) +texture = ExtResource("9_w6m6a") [node name="pribor_prd_k_1" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1183.0 -offset_top = 179.0 +offset_top = 193.0 offset_right = 1260.0 -offset_bottom = 295.0 +offset_bottom = 309.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1317,9 +1268,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_1"] layout_mode = 0 offset_left = 9.0 -offset_top = -44.0 +offset_top = -38.0 offset_right = 61.0 -offset_bottom = -25.0 +offset_bottom = -19.0 text = "ПРД К1" horizontal_alignment = 1 vertical_alignment = 1 @@ -1347,36 +1298,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_1"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_k_1"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -4.0 -offset_top = 124.0 -offset_right = 89.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -1163.0 +offset_top = 10.0 +offset_right = 600.0 +offset_bottom = 973.0 +scale = Vector2(0.883479, 0.883479) +texture = ExtResource("16_32yvq") [node name="pribor_prd_v_4" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 -offset_left = 940.0 -offset_top = 322.0 -offset_right = 1017.0 -offset_bottom = 438.0 +offset_left = 946.0 +offset_top = 345.0 +offset_right = 1023.0 +offset_bottom = 461.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1390,10 +1330,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_4"] layout_mode = 0 -offset_left = 15.0 -offset_top = -41.0 -offset_right = 67.0 -offset_bottom = -22.0 +offset_left = 17.0 +offset_top = -38.0 +offset_right = 69.0 +offset_bottom = -19.0 text = "ПРД В4" horizontal_alignment = 1 vertical_alignment = 1 @@ -1421,36 +1361,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_4"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_v_4"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -6.0 -offset_top = 124.0 -offset_right = 87.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -923.0 +offset_top = -144.0 +offset_right = 669.0 +offset_bottom = 664.0 +scale = Vector2(0.976707, 0.976707) +texture = ExtResource("9_w6m6a") [node name="pribor_prd_n_4" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 941.0 -offset_top = 687.0 +offset_top = 685.0 offset_right = 1018.0 -offset_bottom = 803.0 +offset_bottom = 801.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1465,9 +1394,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_4"] layout_mode = 0 offset_left = 14.0 -offset_top = -41.0 +offset_top = -38.0 offset_right = 66.0 -offset_bottom = -22.0 +offset_bottom = -19.0 text = "ПРД Н4" horizontal_alignment = 1 vertical_alignment = 1 @@ -1495,36 +1424,25 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_4"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_n_4"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -8.0 -offset_top = 124.0 -offset_right = 85.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -919.0 +offset_top = -485.0 +offset_right = 686.0 +offset_bottom = 336.0 +scale = Vector2(0.968111, 0.968111) +texture = ExtResource("9_qe1go") [node name="pribor_prd_k_4" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 -offset_left = 941.0 -offset_top = 504.0 -offset_right = 1018.0 -offset_bottom = 620.0 +offset_left = 946.0 +offset_top = 515.0 +offset_right = 1023.0 +offset_bottom = 631.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1538,10 +1456,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_4"] layout_mode = 0 -offset_left = 14.0 -offset_top = -40.0 -offset_right = 66.0 -offset_bottom = -21.0 +offset_left = 17.0 +offset_top = -38.0 +offset_right = 69.0 +offset_bottom = -19.0 text = "ПРД К4" horizontal_alignment = 1 vertical_alignment = 1 @@ -1563,40 +1481,29 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_k_4"] light_mask = 3 -position = Vector2(39, -10) +position = Vector2(42, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") -[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_4"] +[node name="pic_functional" type="TextureRect" parent="pribor_prd_k_4"] visible = false +z_index = 1 +material = SubResource("ShaderMaterial_71ec4") layout_mode = 0 -offset_left = -8.0 -offset_top = 124.0 -offset_right = 85.0 -offset_bottom = 134.0 -size_flags_horizontal = 3 -size_flags_vertical = 3 -tooltip_text = " -Текущее: 0.00" -mouse_filter = 0 -max_value = 30.0 -nine_patch_stretch = true -stretch_margin_left = 5 -stretch_margin_top = 5 -stretch_margin_right = 5 -stretch_margin_bottom = 5 -texture_under = ExtResource("9_w6m6a") -texture_progress = ExtResource("10_lbx5w") -tint_under = Color(1, 1, 1, 0.419608) -tint_progress = Color(0.890196, 0.486275, 0.196078, 1) +offset_left = -924.0 +offset_top = -315.0 +offset_right = 839.0 +offset_bottom = 648.0 +scale = Vector2(0.879295, 0.879295) +texture = ExtResource("16_32yvq") [node name="txr_legend0" type="TextureRect" parent="."] layout_mode = 0 -offset_left = 316.0 +offset_left = 219.0 offset_top = 1141.0 -offset_right = 540.0 +offset_right = 443.0 offset_bottom = 1365.0 scale = Vector2(0.1, 0.1) texture = ExtResource("7_6j01w") @@ -1604,9 +1511,9 @@ texture = ExtResource("7_6j01w") [node name="lbl_legend0" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.627451) layout_mode = 0 -offset_left = 344.0 +offset_left = 247.0 offset_top = 1142.0 -offset_right = 500.0 +offset_right = 403.0 offset_bottom = 1162.0 theme_override_font_sizes/font_size = 17 text = "Ожидание результата" @@ -1614,27 +1521,27 @@ text = "Ожидание результата" [node name="lbl_legend1" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.627451) layout_mode = 0 -offset_left = 149.0 +offset_left = 52.0 offset_top = 1142.0 -offset_right = 222.0 +offset_right = 125.0 offset_bottom = 1162.0 theme_override_font_sizes/font_size = 17 text = "Исправно" [node name="txr_legend1" type="TextureRect" parent="."] layout_mode = 0 -offset_left = 123.0 +offset_left = 26.0001 offset_top = 1141.0 -offset_right = 347.0 +offset_right = 250.0 offset_bottom = 1365.0 scale = Vector2(0.1, 0.1) texture = ExtResource("8_isjua") [node name="txr_legend2" type="TextureRect" parent="."] layout_mode = 0 -offset_left = 573.0 +offset_left = 476.0 offset_top = 1141.0 -offset_right = 797.0 +offset_right = 700.0 offset_bottom = 1365.0 scale = Vector2(0.1, 0.1) texture = ExtResource("9_ll0vs") @@ -1642,18 +1549,18 @@ texture = ExtResource("9_ll0vs") [node name="lbl_legend2" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.627451) layout_mode = 0 -offset_left = 601.0 +offset_left = 504.0 offset_top = 1142.0 -offset_right = 645.0 +offset_right = 548.0 offset_bottom = 1162.0 theme_override_font_sizes/font_size = 17 text = "Сбой" [node name="lbl_header" type="Label" parent="."] layout_mode = 0 -offset_left = 88.0 +offset_left = 78.0 offset_top = 27.0 -offset_right = 666.0 +offset_right = 656.0 offset_bottom = 58.0 theme_override_font_sizes/font_size = 22 text = "Контроль исправности прибора" @@ -1696,35 +1603,35 @@ text = "На связи" metadata/_edit_use_anchors_ = true [node name="line0" type="Line2D" parent="."] -position = Vector2(929, 950) -points = PackedVector2Array(-8, 0, 582.16, 0, 608, 0) +position = Vector2(936, 950) +points = PackedVector2Array(-8, 0, 608, 0) width = 2.0 default_color = Color(1, 1, 1, 0.352941) [node name="line1" type="Line2D" parent="."] -position = Vector2(929, 1128) +position = Vector2(936, 1128) points = PackedVector2Array(-8, 0, 608, 0) width = 2.0 default_color = Color(1, 1, 1, 0.352941) [node name="line2" type="Line2D" parent="."] -position = Vector2(73.3548, 1127) -scale = Vector2(1.03548, 1) +position = Vector2(32, 1128) points = PackedVector2Array(-8, 0, 608, 0) width = 2.0 default_color = Color(1, 1, 1, 0.352941) -[node name="control_prd" type="Button" parent="."] +[node name="chk_show_functional" type="CheckButton" parent="."] layout_mode = 0 -offset_left = 1043.0 -offset_top = 64.0 -offset_right = 1390.0 -offset_bottom = 104.0 -focus_mode = 0 -text = "Запуск контроля" -script = ExtResource("18_lbx5w") -metadata/_edit_lock_ = true +offset_left = 1050.0 +offset_top = 26.0 +offset_right = 1429.0 +offset_bottom = 60.0 +theme_override_font_sizes/font_size = 22 +disabled = true +text = "Показть функциональную схему Э2" +flat = true +[connection signal="gui_input" from="." to="." method="_on_gui_input"] [connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"] [connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"] [connection signal="toggled" from="pribor_rtr" to="pribor_rtr" method="_on_toggled"] @@ -1742,4 +1649,4 @@ metadata/_edit_lock_ = true [connection signal="toggled" from="pribor_prd_v_4" to="pribor_prd_v_4" method="_on_toggled"] [connection signal="toggled" from="pribor_prd_n_4" to="pribor_prd_n_4" method="_on_toggled"] [connection signal="toggled" from="pribor_prd_k_4" to="pribor_prd_k_4" method="_on_toggled"] -[connection signal="pressed" from="control_prd" to="." method="_on_control_prd_pressed"] +[connection signal="toggled" from="chk_show_functional" to="." method="_on_chk_show_functional_toggled"] diff --git a/scenes/настройки/настройки.tscn b/scenes/настройки/настройки.tscn index d115368..907b56c 100644 --- a/scenes/настройки/настройки.tscn +++ b/scenes/настройки/настройки.tscn @@ -9,6 +9,7 @@ script/source = "class_name configure extends Panel const TableHeader = preload('res://table/header.tscn') const TableToggle = preload('res://table/settings-toggle.tscn') const TableEdit = preload('res://table/ячейка-2.tscn') +const TableColor = preload('res://table/color-picker.tscn') const ALIGNMENT = [HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER] const HEADER_ROW = [TableHeader, TableHeader] @@ -35,7 +36,6 @@ const SETTING_TABLE = [ ['Кнопка «Подавление»', TableEdit, TableToggle, 'Разрешить отображение кнопки'], ['Виртуальная клавиатура', TableEdit, TableToggle, 'Включить отображение экранной клавиатуры'], ['Скрыть вкладку ЭМС 2', TableEdit, TableToggle, 'Отображать вкладку \\\"ЭМС-2\\\"'], - ['Отладка контроля', TableEdit, TableToggle, 'Отображать отладку контроля'], ['Текущая версия ПО УАРЭП', TableEdit, TableEdit, 'Время сборки, версия и номер фиксации'], ['уарэп-яу07-частный', TableEdit, TableEdit, 'IP-адрес для получения частных сообщений от ЯУ-07'], ['уарэп-яу07-общий', TableEdit, TableEdit, 'IP-адрес для получения широковещательных сообщений от ЯУ-07'], @@ -67,16 +67,17 @@ const SETTING_TABLE = [ ['Период опроса состояния АФСП, секунды', TableEdit, TableEdit, 'Время в секундах' ], ['уарэп-трасса', TableEdit, TableEdit, 'IP-адрес для связи с Трассой [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'], ['Включить работу по своим целям', TableEdit, TableToggle, 'Разрешает работу в секторе со своей целью'], - ['Список своих протоколов', TableEdit, TableEdit, 'Список протоколов целей, по которым запрещено работать' ], ] + ['Список своих протоколов', TableEdit, TableEdit, 'Список протоколов целей, по которым запрещено работать' ], + ['Схема прибора. Белый цвет', TableEdit, TableColor, 'Настройка отображаемого цвета фона' ], + ['Схема прибора. Чёрный цвет', TableEdit, TableColor, 'Настройка отображаемого цвета схемы' ], ] const EXTERNAL_CU = 16 ## Внешнее целеуказание const TRASSA = 17 const SUPPRESS = 18 ## Строка - Подавление const KEYBOARD = 19 ## Строка - Виртуальная клавиатура const HIDE_EMS2 = 20 ## Строка - Скрыть вкладку ЭМС 2 -const DEBAG_CONTROL = 21## Строка - Отладка контроля -const COMMIT = 22 ## Строка - Версия УАРЭП -const GOS_BTN = 52 ## Разрешить работу по своим целям +const COMMIT = 21 ## Строка - Версия УАРЭП +const GOS_BTN = 51 ## Разрешить работу по своим целям var name_to_line_index: = {} ## Для преобразования названия параметра в номер строки @@ -116,11 +117,6 @@ func on_ems2_pressed(btn) -> void: signaller.emit_signal('ems2_hide_pressed', state) -func on_debag_control_pressed(btn) -> void: - var state = btn.button_pressed - signaller.emit_signal(\"debag_control_pressed\", state) - - func on_row_pressed(i_row: int): $scroll_set/table.clear_rows_selected() $scroll_set/table.set_row_selected(i_row, true) @@ -238,10 +234,6 @@ func button_settings(): on_ems2_pressed(ems2_hide_node) var gos_node = $scroll_set/table.get_node2(1, GOS_BTN).get_children()[0] gos_node.connect('pressed', on_gos_pressed.bind(gos_node)) - var debag_control = $scroll_set/table.get_node2(1, DEBAG_CONTROL).get_children()[0] - debag_control.connect('pressed', on_debag_control_pressed.bind(debag_control)) - debag_control.set_pressed(false) - on_debag_control_pressed(debag_control) func _on_btn_save_settings_pressed(): diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 2079510..56203b2 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -56,6 +56,7 @@ var fs_selected: Dictionary ## Словарь выбранных сектор var fs_active: Dictionary ## Словарь секторов назначенных на подавление var fs_emit: Dictionary ## Словарь секторов назначенных на подавление var fs_closed: Dictionary ## Словарь для секторов запрета +var fs_failed: Array ## Индикация сломанных секторов (модули ФС). AntBandState.ANT_BAND_READY - исправен, AntBandState.ANT_BAND_FAILURE - сломан. ## Состояние перетаскивания. enum DragFSM { @@ -79,6 +80,11 @@ enum MapViewMode { } +enum AntBandState { + ANT_BAND_READY = 1, + ANT_BAND_FAILED = 0 +} + const VAL_TO_EVENT = { false: 'manual_control', ## Выбор целей и установка помех вручную. true: 'full_auto' } ## Выбор целей и установка помех автоматически. @@ -92,6 +98,12 @@ func on_threat_selected(th, ecm_btns): on_rto_threat_sel(th.id, ecm_btns) func on_enter_tree() -> void: call_deferred('on_button_strobe_pressed') +func clear_all_klaster(): $canvas.clear_all_seczap() + + +func on_user_panning(): $btn_center.button_pressed = false + + func on_settings_changed(): gos_flag = ProjectSettings.get_setting('application/config/Включить работу по своим целям', true) color_emit = ProjectSettings.get_setting('application/interfer/emit_color', Color(0.58, 0.47, 0.51, 1.0)) @@ -144,10 +156,18 @@ func _exit_tree() -> void: timer1.queue_free() +func init_fs_failed(): + var sectors_count = $canvas.fs_default_colors.size() + fs_failed.resize(sectors_count) + for i in fs_failed.size(): + fs_failed[i] = AntBandState.ANT_BAND_READY + + ## Производит инициализацию. func _ready(): ProjectSettings.connect('settings_changed', on_settings_changed) on_settings_changed() + init_fs_failed() min_zoom = ProjectSettings.get_setting('application/config/map_minimum_zoom', 5) max_zoom = ProjectSettings.get_setting('application/config/map_maximum_zoom', 19) drag_fsm = DragFSM.OFF @@ -188,16 +208,13 @@ func _ready(): func sector_klaster(sector_data): - if sector_data["draw"]: - var rect: Rect2 = sector_data["rect"] - var color: Color = sector_data["color"] - var id: int = sector_data["index"] + if sector_data['draw']: + var rect: Rect2 = sector_data['rect'] + var color: Color = sector_data['color'] + var id: int = sector_data['index'] $canvas.add_seczap(id, Vector4(rect.position.x, rect.position.y, rect.size.x, rect.size.y)) $canvas.set_seczap_color(id, color) - else: - pass -func clear_all_klaster(): $canvas.clear_all_seczap() func on_navi_data_received(data: Dictionary): var k = data.get('k', 0.0) @@ -205,10 +222,6 @@ func on_navi_data_received(data: Dictionary): course = k -func on_user_panning(): - $btn_center.button_pressed = false - - func on_chk_interfer_prinuditelno(_interfer_sectors): $chk_auto.set_pressed_no_signal(false) on_value_changed(false) @@ -522,6 +535,7 @@ func update_fs_colors(): else: fs_colors[key] = color_select $canvas.set_band_colors(fs_colors) + $canvas.set_band_failures(fs_failed) if fs_emit.size(): if $btn_activate.pressed: $btn_activate.self_modulate = Color.RED @@ -564,7 +578,7 @@ func set_btns_disabled(value: bool, btn): btn.set_disabled(value) -func on_interfer_prinuditelno(prenuditelno_sectors, btns): +func on_interfer_prinuditelno (prenuditelno_sectors, btns): for key in prenuditelno_sectors: var sectors = [] for sector in prenuditelno_sectors[key]: @@ -577,8 +591,9 @@ func on_interfer_prinuditelno(prenuditelno_sectors, btns): ## Вызывается при получении информации о состоянии модулей ФС от КАПС РПБ. -func on_fs_update_state(_fs_dict: Dictionary): - pass +func on_fs_update_state(fs_dict: Dictionary): + for key in fs_dict.keys(): + fs_failed[key] = fs_dict[key].isg func on_btn_center_toggled(toggled_on: bool) -> void: diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 8313ec3..8282d3f 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -306,18 +306,18 @@ vertical_alignment = 1 [node name="coordinates_map" type="Label" parent="."] layout_mode = 0 -offset_left = 999.0 -offset_top = 128.0 -offset_right = 1111.0 -offset_bottom = 147.0 +offset_left = 660.0 +offset_top = -24.0 +offset_right = 772.0 +offset_bottom = -5.0 text = "Координаты:" [node name="scale_map" type="Label" parent="."] layout_mode = 0 -offset_left = 999.0 -offset_top = 202.0 -offset_right = 1109.0 -offset_bottom = 223.0 +offset_left = 1003.0 +offset_top = -24.0 +offset_right = 1113.0 +offset_bottom = -3.0 text = "Масштаб:" [node name="zoom_plus" type="Button" parent="."] diff --git a/scenes/эмс2/эмс_тг.gd b/scenes/эмс2/эмс_тг.gd index 7919eaf..429c0e0 100644 --- a/scenes/эмс2/эмс_тг.gd +++ b/scenes/эмс2/эмс_тг.gd @@ -1,5 +1,6 @@ extends Panel + func _ready() -> void: var unit_trassa = network.get_unit_instance('уарэп-трасса') unit_trassa.connect('line_changed', Callable(self, 'on_trassa_line_changed')) @@ -8,30 +9,30 @@ func _ready() -> void: func on_trassa_line_changed(unit_trassa): if unit_trassa.online: - $"454/СостояниеРэс3".self_modulate = Color.WEB_GREEN - $"СкруглённыйПрямоугольникБелый/Label3".text = 'Трасса' - $"СкруглённыйПрямоугольникБелый/Label4".text = 'Трасса' - $"СкруглённыйПрямоугольникБелый/Label5".text = 'Активный' - $"СкруглённыйПрямоугольникБелый/Label6".text = str(unit_trassa.daa) - $"СкруглённыйПрямоугольникБелый/Label7".text = str(unit_trassa.dap) - $"СкруглённыйПрямоугольникБелый/Label8".text = '1' - $"СкруглённыйПрямоугольникБелый/Label9".text = str(unit_trassa.lfb) - $"СкруглённыйПрямоугольникБелый/Label10".text = str(unit_trassa.lfb) + $'454/СостояниеРэс3'.self_modulate = Color.WEB_GREEN + $'СкруглённыйПрямоугольникБелый/Label3'.text = 'Трасса' + $'СкруглённыйПрямоугольникБелый/Label4'.text = 'Трасса' + $'СкруглённыйПрямоугольникБелый/Label5'.text = 'Активный' + $'СкруглённыйПрямоугольникБелый/Label6'.text = str(unit_trassa.daa) + $'СкруглённыйПрямоугольникБелый/Label7'.text = str(unit_trassa.dap) + $'СкруглённыйПрямоугольникБелый/Label8'.text = '1' + $'СкруглённыйПрямоугольникБелый/Label9'.text = str(unit_trassa.lfb) + $'СкруглённыйПрямоугольникБелый/Label10'.text = str(unit_trassa.lfb) else: - $"454/СостояниеРэс3".self_modulate = Color.WHITE - $"СкруглённыйПрямоугольникБелый/Label3".text = '-' - $"СкруглённыйПрямоугольникБелый/Label4".text = '-' - $"СкруглённыйПрямоугольникБелый/Label5".text = '-' - $"СкруглённыйПрямоугольникБелый/Label6".text = '-' - $"СкруглённыйПрямоугольникБелый/Label7".text = '-' - $"СкруглённыйПрямоугольникБелый/Label8".text = '-' - $"СкруглённыйПрямоугольникБелый/Label9".text = '-' - $"СкруглённыйПрямоугольникБелый/Label10".text = '-' + $'454/СостояниеРэс3'.self_modulate = Color.WHITE + $'СкруглённыйПрямоугольникБелый/Label3'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label4'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label5'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label6'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label7'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label8'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label9'.text = '-' + $'СкруглённыйПрямоугольникБелый/Label10'.text = '-' -func on_sector_klaster(_data, unit_trassa): - $"СкруглённыйПрямоугольникБелый/Label6".text = str(unit_trassa.dap) - $"СкруглённыйПрямоугольникБелый/Label7".text = str(unit_trassa.daa) - $"СкруглённыйПрямоугольникБелый/Label8".text = '1' - $"СкруглённыйПрямоугольникБелый/Label9".text = str(unit_trassa.lfb) - $"СкруглённыйПрямоугольникБелый/Label10".text = str(unit_trassa.hfb) +func on_sector_klaster(data, unit_trassa): + $'СкруглённыйПрямоугольникБелый/Label6'.text = str(unit_trassa.dap) + $'СкруглённыйПрямоугольникБелый/Label7'.text = str(unit_trassa.daa) + $'СкруглённыйПрямоугольникБелый/Label8'.text = '1' + $'СкруглённыйПрямоугольникБелый/Label9'.text = str(unit_trassa.lfb) + $'СкруглённыйПрямоугольникБелый/Label10'.text = str(unit_trassa.hfb) diff --git a/scripts/interfer.gd b/scripts/interfer.gd index cefdb43..405dacb 100644 --- a/scripts/interfer.gd +++ b/scripts/interfer.gd @@ -93,6 +93,7 @@ const ID_INTERFERS_LEN = 63 ## Размер пула номеров целе const INTERFER_OFF = 'off' const INTERFER_IQFILE = 'IQ-файл' const POW_DEFAULT: float = 50.0 +const PERIOD_DEFAULT = 7.5 var msg6_num: int = 0 ## Счётчик сообщений "тип 6" var msg8_num: int = 0 ## Счётчик сообщений "тип 8" var id_array: Array ## Массив id воздействий. @@ -215,7 +216,7 @@ func _ready() -> void: threats.connect('threats_resized', Callable(self, 'on_threats_resized')) threats.connect('threat_update', Callable(self, 'on_threats_update').bind(ecms, unit_caps)) ProjectSettings.connect('settings_changed', on_settings_changed) - var unit_nav = network.get_unit_instance('навигация') + var unit_nav: = network.get_unit_instance('навигация') unit_nav.connect('data_received', on_nav_data_received.bind(unit_caps)) @@ -389,10 +390,7 @@ func on_interfer_create(interfer_name, sel_threats, fs_arr, power, u, ecms) -> v if krp != '': interfer_name = krp set_rparams(item, param) - if (param['width'] < settings.WIDTH_MIN): - param['width'] = settings.WIDTH_MIN - elif (param['width'] > settings.WIDTH_MAX): - param['width'] = settings.WIDTH_MAX + check_width(param) interfer_create(u, interfer_name, ecms, param, kni, id, thrs, SOURCE_INTERFER[0], power) for item in fs_arr: @@ -401,10 +399,7 @@ func on_interfer_create(interfer_name, sel_threats, fs_arr, power, u, ecms) -> v var id = item[3] param['freq'] = item[1] param['width'] = item[2] - if (param['width'] < settings.WIDTH_MIN): - param['width'] = settings.WIDTH_MIN - elif (param['width'] > settings.WIDTH_MAX): - param['width'] = settings.WIDTH_MAX + check_width(param) interfer_create(u, interfer_name, ecms, param, kni, id, fs, SOURCE_INTERFER[1], power) @@ -444,7 +439,7 @@ func interfer_create(u, interfer_name, ecms, param, kni, id, dict, source_interf var sz = ecms.size() var ispp: int = 0 param['dur'] = 1.0 # Необходимо добавить параметры управления - param['period'] = 1.0 # Необходимо добавить параметры управления + param['period'] = param.get('period', PERIOD_DEFAULT) var key = dict.find_key(id) if source_interfer != SOURCE_INTERFER[2]: if key != null: @@ -580,9 +575,8 @@ func on_threats_update(threat, ecms, unit_caps): ecm.priority = threat.priority ecm.params['freq'] = threat.freq var width = threat.width * 1.5 - if width < settings.WIDTH_MIN: - width = settings.WIDTH_MIN ecm.params['width'] = width + check_width(ecm.params) if (threat.rkrp != '') and threat.fflags.rkrp and auto_enabled: var krp = get_krp(threat) if krp != '': @@ -619,12 +613,11 @@ func set_rparams(threat: threats.Threat, params: Dictionary): params['freq'] = threat.rparams['freq'] else: params['freq'] = threat.freq - if threat.rparams.has('period'): - params['period'] = threat.rparams['period'] if threat.rparams.has('width'): - params['width'] = threat.rparams['width'] + params['width'] = threat.rparams['width'] * 1.5 else: params['width'] = threat.width * 1.5 + check_width(params) if threat.rparams.has('filename'): params['filename'] = threat.rparams['filename'] @@ -695,3 +688,8 @@ func set_th_emit(th: threats.Threat, ecm: Interfer): return else: th.emit_state = 1 + + +func check_width(param: Dictionary): + if (param['width'] < settings.WIDTH_MIN): param['width'] = settings.WIDTH_MIN + elif (param['width'] > settings.WIDTH_MAX): param['width'] = settings.WIDTH_MAX diff --git a/scripts/prd.gd b/scripts/prd.gd index c1b56b0..46c8e08 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -153,7 +153,6 @@ class Fs: class PRD: var prd_name: String ## Имя прибора var unit_yau07 ## Юнит эмс - var unit_control: Object ## Класс проверки прибора ПРД var fs_dic: Dictionary ## Массив блоков ФС var yemsg_board: yemsboards.EmsBoard ## Плата ЭМС-Г var state = PrdState.WORK @@ -168,7 +167,6 @@ class PRD: unit_yau07 = u_yau07 init_ems_g() - func init_ems_g(): var in_tbl: Array = [] var out_tbl: Array = [] @@ -285,9 +283,6 @@ func _ready() -> void: var unit_prd = network.get_unit_instance(prd_name) var new_prd = PRD.new(prd_name, unit_prd) prd_dict[prd_name] = new_prd - var unit_control = TestPRD.new({'unit_prd': unit_prd}, new_prd.cmd_array) - add_child(unit_control) - new_prd.unit_control = unit_control for key in FS_PRD.keys(): var fs = Fs.new(key, FS_PRD[key][0]) fs_dict[key] = fs diff --git a/scripts/pribor-prd.gd b/scripts/pribor-prd.gd index 5349de5..c717f50 100644 --- a/scripts/pribor-prd.gd +++ b/scripts/pribor-prd.gd @@ -1,29 +1,25 @@ -class_name TestPRD -extends Node -# Константы -const CONFIG_PATH = "user://config/setting_prd_control.json" -const DEFAULT_CONFIG_PATH = "res://config/setting_prd_control.json" -# Добавляем константы для прогресса -const PROGRESS_INIT: float = 5.0 -const PROGRESS_FS_TURN_ON: float = 10.0 -const PROGRESS_FS_WORK: float = 20.0 -const PROGRESS_CHECK_KASSETA: float = 25.0 -const PROGRESS_WRITE_ISA: float = 30.0 -const PROGRESS_READ_ISA: float = 35.0 -const PROGRESS_UG_SET_RAY: float = 40.0 -const PROGRESS_RAY_STATES: float = 50.0 -const PROGRESS_COMPLETE: float = 100.0 +class TestPRD extends Node: + const RAY_m5:= 'RAY_m5' + const RAY_5:= 'RAY_5' + const RAY_15:= 'RAY_15' + const RAY_25:= 'RAY_25' + const RAY_35:= 'RAY_35' + const RAY_45:= 'RAY_45' + enum DataIndices { + STATUS_BOARD = 0, + IN_BLANK_PRD = 1, + IN_IMPULS_PRD = 7, + OUT_BLANK_PRD = 13, + OUT_IMPULS_PRD = 19, + DRY_CONTACT = 27, + DKM = 28, + POWER_UKP_1 = 31, + TEMPERATURE_UKP_1 = 47, + POWER_UKP_2 = 63, + TEMPERATURE_UKP_2 = 79, + } -# Для маппинга (Возможно уберу в будущем, но это не точно) -const RAY_m5: String = "RAY_m5" -const RAY_5: String = "RAY_5" -const RAY_15: String = "RAY_15" -const RAY_25: String = "RAY_25" -const RAY_35: String = "RAY_35" -const RAY_45: String = "RAY_45" - -const RAY_TYPES := [RAY_m5, RAY_5, RAY_15, RAY_25, RAY_35, RAY_45] -enum STATE_MACHINE { + enum STATE_MASHINE { INIT, FS_TURN_ON, FS_WORK, @@ -43,771 +39,460 @@ enum STATE_MACHINE { STOP_CONTROL, AWAIT } -var ems_g_sock_dic: Dictionary = { - 'ems_input_1': 0, - 'ems_input_2': 0, - 'ems_input_lit_1': 0, - 'ems_output_1': 0, - 'ems_output_2': 0, - 'ems_output_lit_1': 0, -} + const FS_KEYS := { + 1: 'fs_1', + 2: 'fs_2', + 3: 'fs_3', + 4: 'fs_4', + 5: 'fs_5', + 6: 'fs_6', + 7: 'fs_7' + } + const TEMPERATURE_CONSTANTS := { + 'CONST_MIN_TEMP': -25, + 'MAXIMUM_CODE_ADC': 3796, + 'MINIMUM_CODE_AD': 2660, + 'TEMPERATURE_UKP_1': 47, + 'TEMPERATURE_UKP_2': 79, + } -# Загруженные конфигурации -var config_data: Dictionary -var device_constants: Dictionary -var base_configs: Dictionary -var device_configs: Dictionary -var data_indices: Dictionary -var fs_keys: Dictionary -var temperature_constants: Dictionary -var ems_input_bits_config: Dictionary -var fs_rules: Array - -var _ray_state_mapping: Dictionary -# Переменные класса -var constants: Dictionary -var pribor_config: Dictionary -var fs_parameters: Dictionary -var block_ip_config: Dictionary -var block_kasseta_y5_config: Dictionary -var temperature_um: Dictionary -var control_results: Dictionary -var power_result: Dictionary -var ecms: Dictionary -var power_for_litera: Dictionary -var self_name: String -var state: int = STATE_MACHINE.INIT -var current_litera: int -var flag_write_isa: bool = false -var flag_fs_status_ok: bool = false -var flag_si_fs_input: bool = false -var flag_si_fs_output: bool = false -var flag_in_control: bool = false -var flag_control_is_over: bool = false -var flag_no_trust_yau07: bool = false -var flag_only_fs: bool = false -var unit_prd: Object -var control_timer: Timer = Timer.new() -var ems_6666_timer: Timer = Timer.new() -var machine_timer: Timer = Timer.new() -var cc: int = 0 -var cmd_array: Array - -# Добавляем переменные для отслеживания прогресса -var total_fs_to_check: int = 0 -var completed_fs_count: int = 0 -var current_fs_progress: float = 0.0 -# Переменная для текущего статуса -var current_status: String = "Ожидание запуска контроля" - -# Сигналы Класса -signal control_is_over() # Когда контроль все! -signal status_updated(status_text: String) # Сигнал для обновления статуса -signal update_progress(progress_value: float) -signal update_max_value_progress(max_progress_value: int) - -var progress_value: float: - set(v): - if progress_value != v: - progress_value = v - call_deferred('emit_signal', 'update_progress', v) + var power_result: Dictionary = { + 1: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + 2: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + 3: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + 4: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + 5: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + 6: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + 7: {RAY_m5: [], RAY_5: [], RAY_15: [], RAY_25: [], RAY_35: [], RAY_45: [],}, + } + var constants: Dictionary + var pribor_config: Dictionary + var fs_parameters: Dictionary + var block_ip_config: Dictionary + var block_kasseta_y5_config: Dictionary + var control_results: Dictionary + var self_name: String + var state: int = STATE_MASHINE.INIT + var current_litera: int + var flag_write_isa: bool = false + var flag_fs_status_ok: bool = false + var flag_si_fs_input: bool = false + var flag_si_fs_output: bool = false + var unit_prd: Object + var module_prd: Object + var power_amplify: Array + var control_label: Label + var control_timer: Timer = Timer.new() + var ems_6666_timer: Timer = Timer.new() + signal control_is_over(control_results, power_result) -## Инициализация аргуметнов -func _init(init_data: Dictionary, cmd_array_from_prd: Array) -> void: - unit_prd = init_data['unit_prd'] - cmd_array = cmd_array_from_prd - _load_configuration() - _initialize_ray_mapping() - _initialize_power_structure() + var ecms: Dictionary ## Словарь помеховых воздействий + + ## Инициализация аргуметнов + func _init(init_data: Dictionary) -> void: + control_label = init_data['control_label'] + power_amplify = init_data['power_amplifiers'] + unit_prd = init_data['unit_prd'] + module_prd = init_data['module_prd'] + constants = init_data['constants'] + pribor_config = init_data['prd_config'] + fs_parameters = init_data['fs_params'] + block_ip_config = init_data['block_ip_prd_config'] + block_kasseta_y5_config = init_data['block_kasseta_y5_prd_config'] + control_results = init_data['control_results'] + current_litera = init_data['current_litera'] -func _initialize_power_structure() -> void: - power_for_litera = {} - for litera in range(1, 8): - power_for_litera[litera] = {} - for ray_type in RAY_TYPES: - power_for_litera[litera][ray_type] = [] + func _ready() -> void: + initialize_connections() + setup_timer() -func _ready() -> void: - _determine_self_name() - initialize_connections() - setup_timer() + func _process(_delta: float) -> void: + pass -func _get_ray_key(machine_state: int) -> String: - return _ray_state_mapping.get(machine_state, "") + ## Пакеты от ЯУ-07 + func on_data_received(unit_pribor: Object) -> void: + if not is_inside_tree(): + return + + var status: PackedByteArray = unit_pribor.status + block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config) + block_ip_config = check_block_ip(status, block_ip_config) + control_results.temperature = check_temperature_um(status, power_amplify) + socket_status_ems_g(status) + _process_dkm_status(status) + if current_litera != 0: + var tek_litera: Dictionary = power_result[current_litera] + var interes = _get_ray_key(state) + if interes != '': + tek_litera[_get_ray_key(state)] = power_um_ukp(status, current_litera, tek_litera[_get_ray_key(state)]) + power_result[current_litera] = tek_litera -func _ensure_config_exists() -> bool: - DirAccess.make_dir_recursive_absolute("user://config") - if FileAccess.file_exists(CONFIG_PATH): - return true - if not FileAccess.file_exists(DEFAULT_CONFIG_PATH): - return false - var src := FileAccess.open(DEFAULT_CONFIG_PATH, FileAccess.READ) - var dst := FileAccess.open(CONFIG_PATH, FileAccess.WRITE) - if src == null or dst == null: - return false - dst.store_string(src.get_as_text()) - src.close() - dst.close() - return true + func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void: + var number_socket_input: int + if current_litera >= 1 and current_litera <= 7: + number_socket_input = current_litera + 7 + + var in_blank: int = packet_form_yau_07.decode_u16(DataIndices.IN_BLANK_PRD) + flag_si_fs_input = (in_blank & (1 << number_socket_input)) != 0 ## Флаг СИ от ФС входа в ЭМС-Г для текущей литеры + + var number_socket_output: int + number_socket_output = 4 if current_litera in [2, 4, 6] else 3 if current_litera == 1 else 5 + + var out_blank: int = packet_form_yau_07.decode_u16(DataIndices.OUT_BLANK_PRD) + flag_si_fs_output = (out_blank & (1 << number_socket_output)) != 0 ## Флаг Модуляции УМ ЭМС-Г для текущей литеры -func _load_configuration() -> void: - if not _ensure_config_exists(): return - var config_file = FileAccess.open(CONFIG_PATH, FileAccess.READ) - if config_file: - var json_text = config_file.get_as_text() - config_file.close() - - var json = JSON.new() - var parse_result = json.parse(json_text) - if parse_result == OK: - config_data = json.data - _parse_config_data() + ## Пакеты от MP550Service + func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> void: + var fs_key: String = FS_KEYS.get(current_litera, '') + if fs_key.is_empty(): + return + + var fs_result := {fs_key: 0} + fs_result = on_fs_state(packet_type_7, fs_mapping, fs_result) + control_results[fs_key] = fs_result[fs_key] + flag_fs_status_ok = control_results[fs_key] == 1 + + + ## + func state_control_machine() -> void: + match state: + STATE_MASHINE.INIT: + _handle_init_state() + STATE_MASHINE.FS_TURN_ON: + _handle_fs_turn_on_state() + state = STATE_MASHINE.FS_WORK + STATE_MASHINE.FS_WORK: + if ecms.size() and flag_fs_status_ok: + ems_6666_timer.start() + _handle_fs_work_state() + STATE_MASHINE.CHEK_KASSETA_Y5: + if block_kasseta_y5_config['yau07']: + state = STATE_MASHINE.WRITE_ISA + STATE_MASHINE.WRITE_ISA: + if not flag_write_isa: + _handle_ug_set_state(0x6) + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.READ_ISA: + if (unit_prd.cmd_state == unit_prd.CmdState.DONE) or (unit_prd.cmd_state == unit_prd.CmdState.FAIL): + _handle_read_isa(module_prd, unit_prd, [constants.ADDR_UG_LITERA_1, constants.ADDR_UG_LITERA_2, constants.ADDR_UG_LITERA_3]) + flag_write_isa = false + state = STATE_MASHINE.UG_SET_RAY + STATE_MASHINE.UG_SET_RAY: + var addr: int = constants.ADDR_UG_LITERA_1 + if current_litera == 3 or current_litera == 5 or current_litera == 7: + addr = constants.ADDR_UG_LITERA_2 + if unit_prd.isa_ports.has(addr) and (unit_prd.cmd_state == unit_prd.CmdState.DONE): + if unit_prd.isa_ports[addr] & 0x07 == 0: + state = STATE_MASHINE.UG_SET_RAY_1 + elif unit_prd.isa_ports[addr] & 0x07 == 1: + state = STATE_MASHINE.UG_SET_RAY_2 + elif unit_prd.isa_ports[addr] & 0x07 == 2: + state = STATE_MASHINE.UG_SET_RAY_3 + elif unit_prd.isa_ports[addr] & 0x07 == 3: + state = STATE_MASHINE.UG_SET_RAY_4 + elif unit_prd.isa_ports[addr] & 0x07 == 4: + state = STATE_MASHINE.UG_SET_RAY_5 + elif unit_prd.isa_ports[addr] & 0x07 == 5: + if not current_litera == 1: + control_results = check_dou_result(control_results, power_result, self_name, current_litera, constants) + state = STATE_MASHINE.IN_EMS_STOP + elif unit_prd.isa_ports[addr] & 0x07 == 6: + state = STATE_MASHINE.UG_SET_RAY_0 + + STATE_MASHINE.UG_SET_RAY_0: + if flag_si_fs_input and not flag_write_isa: + control_timer.stop() + _handle_ug_set_state(0x0) + await get_tree().create_timer(0.5).timeout + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.UG_SET_RAY_1: + if not flag_write_isa: + _handle_ug_set_state(0x1) + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.UG_SET_RAY_2: + if not flag_write_isa: + _handle_ug_set_state(0x2) + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.UG_SET_RAY_3: + if not flag_write_isa: + _handle_ug_set_state(0x3) + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.UG_SET_RAY_4: + if not flag_write_isa: + _handle_ug_set_state(0x4) + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.UG_SET_RAY_5: + if not flag_write_isa: + _handle_ug_set_state(0x5) + state = STATE_MASHINE.READ_ISA + STATE_MASHINE.IN_EMS_STOP: + ems_6666_timer.stop() + state = STATE_MASHINE.FS_TURN_OFF + STATE_MASHINE.FS_TURN_OFF: + ems_6666_timer.stop() + _handle_fs_turn_off_state() + state = STATE_MASHINE.STOP_CONTROL + STATE_MASHINE.STOP_CONTROL: + _handle_stop_control_state() + + + func _handle_init_state() -> void: + control_label.text = 'Выполняется инициализация ФС-%s' % current_litera + if current_litera in [1, 2, 3, 4, 5, 6, 7]: + if not ecms.size(): + state = STATE_MASHINE.FS_TURN_ON else: - push_error("Ошибка разбора JSON конфигурации: " + json.get_error_message()) - else: - push_error("Ошибка to load config file: " + CONFIG_PATH) - - -func _parse_config_data() -> void: - device_constants = _convert_numbers(config_data.get("device_constants", {})) - base_configs = _convert_numbers(config_data.get("base_configs", {})) - device_configs = _convert_numbers(config_data.get("device_configs", {})) - data_indices = _convert_numbers(config_data.get("data_indices", {})) - fs_keys = _convert_numbers(config_data.get("fs_keys", {})) - temperature_constants = _convert_numbers(config_data.get("temperature_constants", {})) - ems_input_bits_config = _convert_numbers(config_data.get("ems_input_bits_config", {})) - fs_rules = _convert_numbers(config_data.get("fs_rules", [])) - - -static func _convert_numbers(value): - if value is float: - # Если float без дробной части - конвертируем в int - if value == int(value): - return int(value) - return value - elif value is Dictionary: - var result = {} - for key in value: - result[key] = _convert_numbers(value[key]) - return result - elif value is Array: - var result = [] - for item in value: - result.append(_convert_numbers(item)) - return result - else: - return value - - -func _initialize_ray_mapping() -> void: - _ray_state_mapping = { - STATE_MACHINE.UG_SET_RAY_0: "RAY_m5", - STATE_MACHINE.UG_SET_RAY_1: "RAY_5", - STATE_MACHINE.UG_SET_RAY_2: "RAY_15", - STATE_MACHINE.UG_SET_RAY_3: "RAY_25", - STATE_MACHINE.UG_SET_RAY_4: "RAY_35", - STATE_MACHINE.UG_SET_RAY_5: "RAY_45", - } - - -func _process(_delta: float) -> void: - pass - - -## Пакеты от ЯУ-07 -func on_data_received(unit_pribor: Object) -> void: - if not flag_in_control: return - var status: PackedByteArray = unit_pribor.status - block_kasseta_y5_config = check_block_kasseta_y5(status, block_kasseta_y5_config, flag_no_trust_yau07) - if flag_no_trust_yau07: return - socket_status_ems_g(status) - block_ip_config = check_block_ip(status, block_ip_config) - temperature_um = check_temperature_um(status) - if machine_timer.is_stopped(): - return - - _process_dkm_status(status) - if current_litera != 0: # Формирование мощностей в литерах - var tek_litera: Dictionary = power_for_litera[current_litera] - var interes = _get_ray_key(state) - if interes != '': - tek_litera[_get_ray_key(state)] = power_um_ukp(status, current_litera, tek_litera[_get_ray_key(state)]) - power_for_litera[current_litera] = tek_litera - - -# Методы для работы с JSON -func _get_data_index(key: String) -> int: - return data_indices.get(key, -1) - - -func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void: - if self_name in ['1н', '2н', '3н', '4н']: - ems_g_sock_dic.ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 9)) != 0 - ems_g_sock_dic.ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 10)) != 0 - if self_name in ['1в', '2в', '3в', '4в']: - ems_g_sock_dic.ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 11)) != 0 - ems_g_sock_dic.ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 12)) != 0 - if self_name in ['1к', '2к', '3к', '4к']: - ems_g_sock_dic.ems_input_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 8)) != 0 - ems_g_sock_dic.ems_input_1 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 13)) != 0 - ems_g_sock_dic.ems_input_2 = (packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) & (1 << 14)) != 0 - - ems_g_sock_dic.ems_output_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 4)) != 0 - ems_g_sock_dic.ems_output_2 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 5)) != 0 - ems_g_sock_dic.ems_output_lit_1 = (packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) & (1 << 3)) != 0 - - var number_socket_input: int - if current_litera >= 1 and current_litera <= 7: - number_socket_input = current_litera + 7 - - var in_blank: int = packet_form_yau_07.decode_u16(_get_data_index('IN_BLANK_PRD')) - flag_si_fs_input = (in_blank & (1 << number_socket_input)) != 0 ## Флаг СИ от ФС входа в ЭМС-Г для текущей литеры - - var number_socket_output: int - number_socket_output = 4 if current_litera in [2, 4, 6] else 3 if current_litera == 1 else 5 - - var out_blank: int = packet_form_yau_07.decode_u16(_get_data_index('OUT_BLANK_PRD')) - flag_si_fs_output = (out_blank & (1 << number_socket_output)) != 0 ## Флаг Модуляции УМ ЭМС-Г для текущей литеры - - -## Пакеты от MP550Service -func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> void: - var fs_key: String = fs_keys.get(str(current_litera), '') - if fs_key.is_empty(): - return - - var fs_result := {fs_key: 0} - fs_result = on_fs_state(packet_type_7, fs_mapping, fs_result, fs_rules) - control_results[fs_key] = fs_result[fs_key] - flag_fs_status_ok = control_results[fs_key] == 1 - - -## -func state_control_machine() -> void: - match state: - STATE_MACHINE.INIT: - _handle_init_state() - STATE_MACHINE.FS_TURN_ON: - _handle_fs_turn_on_state() - state = STATE_MACHINE.FS_WORK - STATE_MACHINE.FS_WORK: - var flag_ecm: bool = false - for key in ecms: - var params = ecms[key].params.freq - if fs_parameters[current_litera].freq == params: - var kni = ecms[key].kni - if pribor_config[self_name].angle == kni: - flag_ecm = true - if flag_ecm and flag_fs_status_ok: - ems_6666_timer.start() - _handle_fs_work_state() - STATE_MACHINE.CHEK_KASSETA_Y5: - if block_kasseta_y5_config['yau07']: - state = STATE_MACHINE.WRITE_ISA - elif flag_only_fs: - state = STATE_MACHINE.IN_EMS_STOP - STATE_MACHINE.WRITE_ISA: - if not flag_write_isa: - _handle_ug_set_state(0x6) - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.READ_ISA: - if (unit_prd.cmd_state == unit_prd.CmdState.DONE) or (unit_prd.cmd_state == unit_prd.CmdState.FAIL): - _handle_read_isa(unit_prd, [constants.ADDR_UG_LITERA_1, constants.ADDR_UG_LITERA_2, constants.ADDR_UG_LITERA_3], cmd_array) - flag_write_isa = false - state = STATE_MACHINE.UG_SET_RAY - STATE_MACHINE.UG_SET_RAY: - var addr: int = constants.ADDR_UG_LITERA_1 - if current_litera == 3 or current_litera == 5 or current_litera == 7: - addr = constants.ADDR_UG_LITERA_2 - if unit_prd.isa_ports.has(addr) and (unit_prd.cmd_state == unit_prd.CmdState.DONE): - if unit_prd.isa_ports[addr] & 0x07 == 0: - state = STATE_MACHINE.UG_SET_RAY_1 - elif unit_prd.isa_ports[addr] & 0x07 == 1: - state = STATE_MACHINE.UG_SET_RAY_2 - elif unit_prd.isa_ports[addr] & 0x07 == 2: - state = STATE_MACHINE.UG_SET_RAY_3 - elif unit_prd.isa_ports[addr] & 0x07 == 3: - state = STATE_MACHINE.UG_SET_RAY_4 - elif unit_prd.isa_ports[addr] & 0x07 == 4: - state = STATE_MACHINE.UG_SET_RAY_5 - elif unit_prd.isa_ports[addr] & 0x07 == 5: - if not current_litera == 1: - control_results = check_dou_result(control_results, power_for_litera, self_name, current_litera, constants) - state = STATE_MACHINE.IN_EMS_STOP - elif unit_prd.isa_ports[addr] & 0x07 == 6: - state = STATE_MACHINE.UG_SET_RAY_0 - if current_litera == 1: - state = STATE_MACHINE.UG_SET_RAY_5 - - STATE_MACHINE.UG_SET_RAY_0: - if flag_si_fs_input and not flag_write_isa: - control_timer.stop() - _handle_ug_set_state(0x0) - await get_tree().create_timer(0.5).timeout - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.UG_SET_RAY_1: - if not flag_write_isa: - _handle_ug_set_state(0x1) - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.UG_SET_RAY_2: - if not flag_write_isa: - _handle_ug_set_state(0x2) - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.UG_SET_RAY_3: - if not flag_write_isa: - _handle_ug_set_state(0x3) - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.UG_SET_RAY_4: - if not flag_write_isa: - _handle_ug_set_state(0x4) - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.UG_SET_RAY_5: - if not flag_write_isa: - _handle_ug_set_state(0x5) - state = STATE_MACHINE.READ_ISA - STATE_MACHINE.IN_EMS_STOP: - ems_6666_timer.stop() - state = STATE_MACHINE.FS_TURN_OFF - STATE_MACHINE.FS_TURN_OFF: - ems_6666_timer.stop() - _handle_fs_turn_off_state() - state = STATE_MACHINE.STOP_CONTROL - STATE_MACHINE.STOP_CONTROL: - _handle_stop_control_state() - ## В машине состояний вызов изменения состояния прогресс бара контроля - if block_kasseta_y5_config['yau07'] or flag_no_trust_yau07: - progressbar_status() - - -## 'Выполняется инициализация ФС-%s' % current_litera -func _handle_init_state() -> void: - if current_litera in [1, 2, 3, 4, 5, 6, 7]: - _set_status("Инициализация ФС-%s" % current_litera) - var flag_ecm: bool = false - for key in ecms: - var params = ecms[key].params.freq - if fs_parameters[current_litera].freq == params: - var kni = ecms[key].kni - if pribor_config[self_name].angle == kni: - flag_ecm = true - if not flag_ecm: - state = STATE_MACHINE.FS_TURN_ON - else: - flag_control_is_over = true - control_results = on_control_result(block_ip_config, control_results) - power_result = prep_power(power_for_litera, self_name) - machine_timer.stop() - var result: bool = true - for device in control_results.values(): - if not device: - result = false - _set_status("Прибор ПРД-%s: %s" % [self_name, ['неисправен', 'исправен'][int(result)]]) - emit_signal('control_is_over') - - -##'Выполняется включение ФС-%s' % current_litera -func _handle_fs_turn_on_state() -> void: - _set_status("Включение ФС-%s" % current_litera) - manage_fs(true, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM) - control_timer.wait_time = constants.TIMER_DELAY - control_timer.start() - - -##'Выполняется проверка ФС-%s' % current_litera -func _handle_fs_work_state() -> void: - _set_status("Проверка ФС-%s" % current_litera) - if (current_litera == 2 and control_results.fs_2) or \ - (current_litera == 3 and control_results.fs_3) or \ - (current_litera == 4 and control_results.fs_4) or \ - (current_litera == 5 and control_results.fs_5) or \ - (current_litera == 6 and control_results.fs_6) or \ - (current_litera == 7 and control_results.fs_7) or \ - (current_litera == 1 and control_results.fs_1): - state = STATE_MACHINE.CHEK_KASSETA_Y5 - - -## Подготовка к настройки и записи в УГ -func _handle_ug_set_state(RAY_DOU_NUM: int) -> void: - _set_status("Настройка угла %s" % _get_ray_name(RAY_DOU_NUM)) - var dic_att := { - 'RAY_DOU_NUM': RAY_DOU_NUM, - 'ADDR_UG_LITERA_1': constants.ADDR_UG_LITERA_1, - 'ADDR_UG_LITERA_2': constants.ADDR_UG_LITERA_2, - 'ADDR_UG_LITERA_3': constants.ADDR_UG_LITERA_3, - 'ATT_UM_3': 0x00, - 'BASE_EMS_G': constants.BASE_ADDR_EMS_G - } - if self_name == '1к' or self_name == '2к' or self_name == '3к' or self_name == '4к': - dic_att['ATT_UM_1'] = constants.ATT_UM_6 - dic_att['ATT_UM_2'] = constants.ATT_UM_7 - dic_att['ATT_UM_3'] = constants.ATT_UM_1 - elif self_name == '1в' or self_name == '2в' or self_name == '3в' or self_name == '4в': - dic_att['ATT_UM_1'] = constants.ATT_UM_4 - dic_att['ATT_UM_2'] = constants.ATT_UM_5 - elif self_name == '1н' or self_name == '2н' or self_name == '3н' or self_name == '4н': - dic_att['ATT_UM_1'] = constants.ATT_UM_2 - dic_att['ATT_UM_2'] = constants.ATT_UM_3 - flag_write_isa = on_ug_setting(unit_prd, dic_att, cmd_array) - - - - -## Функция для продвижения статуса прогресс бара -func progressbar_status() -> void: - if current_litera == 0: - progress_value = PROGRESS_COMPLETE - await get_tree().create_timer(0.5).timeout - progress_value = 0 - return - - # Базовый прогресс в зависимости от состояния - var base_progress: float = 0.0 - - match state: - STATE_MACHINE.INIT: - base_progress = PROGRESS_INIT - STATE_MACHINE.FS_TURN_ON: - base_progress = PROGRESS_FS_TURN_ON - STATE_MACHINE.FS_WORK: - base_progress = PROGRESS_FS_WORK - STATE_MACHINE.CHEK_KASSETA_Y5: - base_progress = PROGRESS_CHECK_KASSETA - STATE_MACHINE.WRITE_ISA: - base_progress = PROGRESS_WRITE_ISA - STATE_MACHINE.READ_ISA: - base_progress = PROGRESS_READ_ISA - STATE_MACHINE.UG_SET_RAY: - base_progress = PROGRESS_UG_SET_RAY - STATE_MACHINE.UG_SET_RAY_0, STATE_MACHINE.UG_SET_RAY_1: - base_progress = PROGRESS_RAY_STATES - STATE_MACHINE.UG_SET_RAY_2: - base_progress = PROGRESS_RAY_STATES + 10.0 - STATE_MACHINE.UG_SET_RAY_3: - base_progress = PROGRESS_RAY_STATES + 20.0 - STATE_MACHINE.UG_SET_RAY_4: - base_progress = PROGRESS_RAY_STATES + 30.0 - STATE_MACHINE.UG_SET_RAY_5: - base_progress = PROGRESS_RAY_STATES + 40.0 - STATE_MACHINE.IN_EMS_STOP, STATE_MACHINE.FS_TURN_OFF, STATE_MACHINE.STOP_CONTROL: - base_progress = PROGRESS_COMPLETE - - # Плавное заполнение во время ожидания таймера - if control_timer.time_left > 0 and state != STATE_MACHINE.STOP_CONTROL: - var timer_progress = (control_timer.wait_time - control_timer.time_left) / control_timer.wait_time - base_progress = lerp(base_progress - 5.0, base_progress, timer_progress) - - # Распределяем прогресс по ФС - if total_fs_to_check > 0: - var progress_per_fs = PROGRESS_COMPLETE / total_fs_to_check - current_fs_progress = base_progress - progress_value = (completed_fs_count * progress_per_fs) + (current_fs_progress * progress_per_fs / PROGRESS_COMPLETE) - else: - progress_value = base_progress - - progress_value = clamp(progress_value, 0.0, PROGRESS_COMPLETE) - - -##'Выполняется отключение ФС-%s' % current_litera -func _handle_fs_turn_off_state() -> void: - _set_status("Отключение ФС-%s" % current_litera) - flag_fs_status_ok = false - manage_fs(false, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM) - - -##'Выполняется завершение проверки ФС-%s' % current_litera -func _handle_stop_control_state() -> void: - _set_status("Завершение контроля ФС-%s" % current_litera) - # Увеличиваем счетчик завершенных ФС - completed_fs_count += 1 - - _advance_to_next_fs() - state = STATE_MACHINE.INIT - if current_litera == 0: return - if flag_no_trust_yau07: - state = STATE_MACHINE.STOP_CONTROL - - -## Переходит на следующую литеру, если 0 то считай закончил выполнения контроля -func _advance_to_next_fs() -> void: - match current_litera: - 1: current_litera = 6 - 2: current_litera = 3 - 3: current_litera = 0 - 4: current_litera = 5 - 5: current_litera = 0 - 6: current_litera = 7 - 7: current_litera = 0 - # Сбрасываем прогресс текущей ФС при переходе к следующей - if current_litera != 0: - current_fs_progress = 0.0 - - -###################################### -func initialize_connections() -> void: - var fs_mapping = _create_fs_mapping(self_name) - signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state').bind(fs_mapping)) - signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_contol_device')) - interfer.connect('interfer_resized', Callable(self, 'on_interfer_resized')) - unit_prd.connect('data_received', Callable(self, 'on_data_received')) - - var mode_signals = ['режим_работа', 'режим_журнал', 'режим_эмс', 'режим_настройки'] - for signal_name in mode_signals: - signaller.connect(signal_name, Callable(self, 'on_mode_changed').bind(false)) - signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true)) - - -func on_interfer_resized(ecms_dic: Dictionary) -> void: - ecms = ecms_dic - - -func _on_start_contol_device()-> void: - _set_status("Подготовка к контролю") - _determine_self_name() - machine_timer.wait_time = constants.STATE_MASHINE_TIMER - machine_timer.start() - - -func _determine_self_name() -> void: - flag_no_trust_yau07 = false - flag_only_fs = false - cc = 0 - state = STATE_MACHINE.get("INIT", 0) - var current_unit = unit_prd.name - var parts = current_unit.split('-') - self_name = parts[-1] - - var device_type: String = _get_device_type() - if device_type.is_empty(): - return - - var device_config = device_constants.get(device_type, {}) - var device_data_config = device_configs.get(device_type, {}) - - # Загружаем конфигурацию устройства - constants = device_config.get("constants", {}) - pribor_config = device_config.get("pribor_config", {}) - - # Конвертируем fs_params ключи в int - var raw_fs_params = device_config.get("fs_params", {}) - fs_parameters = {} - for key in raw_fs_params: - fs_parameters[int(key)] = raw_fs_params[key] - - # Загружаем конфигурации блоков - block_ip_config = _load_block_config(device_data_config.get("block_ip", {}), "block_ip") - block_kasseta_y5_config = _load_block_config(device_data_config.get("block_kasseta", {}), "block_kasseta") - control_results = device_data_config.get("control_results", {}) - current_litera = device_config.get("start_litera", 0) - - # Определяем общее количество ФС для контроля - match self_name: - '1к', '2к', '3к', '4к': - total_fs_to_check = 3 # Литеры 1, 6, 7 - '1н', '2н', '3н', '4н': - total_fs_to_check = 2 # Литеры 2, 3 - '1в', '2в', '3в', '4в': - total_fs_to_check = 2 # Литеры 4, 5 - - progress_value = 0 - completed_fs_count = 0 - current_fs_progress = 0.0 - call_deferred('emit_signal', 'update_max_value_progress', 100) - - -func _load_block_config(config, config_type: String) -> Dictionary: - if config is String and config == "base": - return base_configs.get(config_type, {}).duplicate(true) - elif config is Dictionary: - return config.duplicate(true) - return {} - - -func _get_device_type() -> String: - if self_name.ends_with('н'): return 'PRD_N' - elif self_name.ends_with('в'): return 'PRD_V' - elif self_name.ends_with('к'): return 'PRD_K' - return '' - - -## Настройка таймеров -func setup_timer() -> void: - add_child(control_timer) - control_timer.timeout.connect(on_stop_control) - control_timer.one_shot = true - control_timer.wait_time = constants.get("TIMER_DELAY", 10.0) - - add_child(ems_6666_timer) - ems_6666_timer.timeout.connect(_on_ems_6666_timer) - ems_6666_timer.wait_time = 1.0 - - add_child(machine_timer) - machine_timer.connect('timeout', Callable(self, 'on_state_mashine')) - - -## Таймер отправки команды в ЭМС-Г для модуляции -func _on_ems_6666_timer() -> void: - cmd_array.append([unit_prd.CmdCode.WRITE_ISA, [constants.BASE_ADDR_EMS_G, 6666]]) - - -## Таймер вызова машины состояний -func on_state_mashine(): - state_control_machine() - - -## При таймауте таймера ожидания выполнения команды и перехода на следующий шаг машины состояний -func on_stop_control() -> void: - _handle_fs_turn_off_state() - - if state == STATE_MACHINE.UG_SET_RAY: - flag_no_trust_yau07 = true - elif state == STATE_MACHINE.CHEK_KASSETA_Y5: - flag_only_fs = true - state = STATE_MACHINE.FS_TURN_OFF - - -## Срабатывает при выходе или входе в режим контроль -func on_mode_changed(in_tree: bool) -> void: - flag_in_control = in_tree - if not in_tree: ## TODO: Дополнительная проверка если контроль идет, если нет, то смысла вызывать нет - _set_status("Ожидание запуска контроля") - flag_control_is_over = false - flag_no_trust_yau07 = false - flag_only_fs = false - progress_value = 0 - machine_timer.stop() - state = STATE_MACHINE.INIT + control_results = on_control_result(block_ip_config, control_results) + var send_power_pack = prep_power(power_result, self_name) + emit_signal('control_is_over', control_results, send_power_pack) + state = STATE_MASHINE.AWAIT + + + func _handle_fs_turn_on_state() -> void: + control_label.text = 'Выполняется включение ФС-%s' % current_litera + manage_fs(true, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM) + control_timer.wait_time = constants.TIMER_DELAY + control_timer.start() + + + func _handle_fs_work_state() -> void: + control_label.text = 'Выполняется проверка ФС-%s' % current_litera + if (current_litera == 2 and control_results.fs_2) or \ + (current_litera == 3 and control_results.fs_3) or \ + (current_litera == 4 and control_results.fs_4) or \ + (current_litera == 5 and control_results.fs_5) or \ + (current_litera == 6 and control_results.fs_6) or \ + (current_litera == 7 and control_results.fs_7) or \ + (current_litera == 1 and control_results.fs_1): + state = STATE_MASHINE.CHEK_KASSETA_Y5 + + + func _handle_ug_set_state(RAY_DOU_NUM: int) -> void: + var dic_att := { + 'RAY_DOU_NUM': RAY_DOU_NUM, + 'ADDR_UG_LITERA_1': constants.ADDR_UG_LITERA_1, + 'ADDR_UG_LITERA_2': constants.ADDR_UG_LITERA_2, + 'ADDR_UG_LITERA_3': constants.ADDR_UG_LITERA_3, + 'ATT_UM_3': 0x00, + 'BASE_EMS_G': constants.BASE_ADDR_EMS_G + } + if self_name == '1к' or self_name == '2к' or self_name == '3к' or self_name == '4к': + dic_att['ATT_UM_1'] = constants.ATT_UM_6 + dic_att['ATT_UM_2'] = constants.ATT_UM_7 + dic_att['ATT_UM_3'] = constants.ATT_UM_1 + elif self_name == '1в' or self_name == '2в' or self_name == '3в' or self_name == '4в': + dic_att['ATT_UM_1'] = constants.ATT_UM_4 + dic_att['ATT_UM_2'] = constants.ATT_UM_5 + elif self_name == '1н' or self_name == '2н' or self_name == '3н' or self_name == '4н': + dic_att['ATT_UM_1'] = constants.ATT_UM_2 + dic_att['ATT_UM_2'] = constants.ATT_UM_3 + + var log_text = dic_att.ATT_UM_3 if current_litera == 1 else dic_att.ATT_UM_1 if current_litera in [2, 4, 6] else dic_att.ATT_UM_2 + control_label.text = 'Выполняется настройка угла (%s) и атт (0x0%s)' % [ + dic_att.RAY_DOU_NUM, + log_text + ] + flag_write_isa = on_ug_setting(module_prd, unit_prd, dic_att) + + + func _on_ems_6666_timer() -> void: + module_prd.cmd_array.append([unit_prd.CmdCode.WRITE_ISA, [constants.BASE_ADDR_EMS_G, 6666]]) + + + func _handle_fs_turn_off_state() -> void: + control_label.text = 'Выполняется отключение ФС-%s' % current_litera + flag_fs_status_ok = false + manage_fs(false, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM) + + + func _handle_stop_control_state() -> void: + control_label.text = 'Выполняется завершение проверки ФС-%s' % current_litera + _advance_to_next_fs() + state = STATE_MASHINE.INIT + + + func _advance_to_next_fs() -> void: + match current_litera: + 1: current_litera = 6 + 2: current_litera = 3 + 3: current_litera = 0 + 4: current_litera = 5 + 5: current_litera = 0 + 6: current_litera = 7 + 7: current_litera = 0 + + + ###################################### + func initialize_connections() -> void: + _determine_self_name() + var fs_mapping = _create_fs_mapping(self_name) + signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state').bind(fs_mapping)) + interfer.connect('interfer_resized', Callable(self, 'on_interfer_resized')) + unit_prd.connect('data_received', Callable(self, 'on_data_received')) + + + func on_interfer_resized(ecms_dic: Dictionary) -> void: + ecms = ecms_dic + + + func _determine_self_name() -> void: + var current_unit = unit_prd.name + var parts = current_unit.split('-') + self_name = parts[-1] + + + func setup_timer() -> void: + add_child(control_timer) + control_timer.timeout.connect(on_stop_control) + control_timer.one_shot = true + control_timer.wait_time = 15.0 + control_timer.start() + + add_child(ems_6666_timer) + ems_6666_timer.timeout.connect(_on_ems_6666_timer) + ems_6666_timer.wait_time = 1.0 + + + func _process_dkm_status(status: PackedByteArray) -> void: + if not control_results.has(_get_current_fs_key()): + return + var dkm_bit = _get_dkm_bit_for_current_fs(current_litera, constants) + if dkm_bit == 0: + control_results['dkm_1'] = check_dkm(status, dkm_bit) + + var addr: int = constants.ADDR_UG_LITERA_1 + if current_litera == 3 or current_litera == 5 or current_litera == 7: + addr = constants.ADDR_UG_LITERA_2 + if not unit_prd.isa_ports.has(addr) or not (unit_prd.cmd_state == unit_prd.CmdState.DONE): + return + if not unit_prd.isa_ports[addr] & 0x07 == 6: return + + if dkm_bit == 1: + control_results['dkm_2'] = check_dkm(status, dkm_bit) + elif dkm_bit == 2: + control_results['dkm_3'] = check_dkm(status, dkm_bit) + elif dkm_bit == 3: + control_results['dkm_4'] = check_dkm(status, dkm_bit) + elif dkm_bit == 4: + control_results['dkm_5'] = check_dkm(status, dkm_bit) + elif dkm_bit == 5: + control_results['dkm_6'] = check_dkm(status, dkm_bit) + elif dkm_bit == 6: + control_results['dkm_7'] = check_dkm(status, dkm_bit) + + + func _get_current_fs_key() -> String: + return FS_KEYS.get(current_litera, '') + + + static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary) -> int: + match litera: + 1: return constants_dic.DKM_BIT_1 + 2: return constants_dic.DKM_BIT_2 + 3: return constants_dic.DKM_BIT_3 + 4: return constants_dic.DKM_BIT_4 + 5: return constants_dic.DKM_BIT_5 + 6: return constants_dic.DKM_BIT_6 + 7: return constants_dic.DKM_BIT_7 + _: return -1 + + + static func _get_ray_key(machine_state: int) -> String: + match machine_state: + STATE_MASHINE.UG_SET_RAY_0: return RAY_m5 + STATE_MASHINE.UG_SET_RAY_1: return RAY_5 + STATE_MASHINE.UG_SET_RAY_2: return RAY_15 + STATE_MASHINE.UG_SET_RAY_3: return RAY_25 + STATE_MASHINE.UG_SET_RAY_4: return RAY_35 + STATE_MASHINE.UG_SET_RAY_5: return RAY_45 + _: return '' + + + func on_stop_control() -> void: _handle_fs_turn_off_state() - #prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) - else: - _set_status("Ожидание запуска контроля") + state = STATE_MASHINE.FS_TURN_OFF -func _process_dkm_status(status: PackedByteArray) -> void: - if not control_results.has(_get_current_fs_key(current_litera, fs_keys)): - return - var dkm_bit = _get_dkm_bit_for_current_fs(current_litera, constants) - if dkm_bit == 0: - control_results['dkm_1'] = check_dkm(status, dkm_bit) + static func on_control_result(ip_config: Dictionary, ctrl_results: Dictionary) -> Dictionary: + var all_blocks_ip_ok = true - var addr: int = constants.ADDR_UG_LITERA_1 - if current_litera == 3 or current_litera == 5 or current_litera == 7: - addr = constants.ADDR_UG_LITERA_2 - if not unit_prd.isa_ports.has(addr) or not (unit_prd.cmd_state == unit_prd.CmdState.DONE): - return - if not unit_prd.isa_ports[addr] & 0x07 == 6: return - - if dkm_bit == 1: - control_results['dkm_2'] = check_dkm(status, dkm_bit) - elif dkm_bit == 2: - control_results['dkm_3'] = check_dkm(status, dkm_bit) - elif dkm_bit == 3: - control_results['dkm_4'] = check_dkm(status, dkm_bit) - elif dkm_bit == 4: - control_results['dkm_5'] = check_dkm(status, dkm_bit) - elif dkm_bit == 5: - control_results['dkm_6'] = check_dkm(status, dkm_bit) - elif dkm_bit == 6: - control_results['dkm_7'] = check_dkm(status, dkm_bit) + for block in ip_config: + if not ip_config[block][1]: + all_blocks_ip_ok = false + ctrl_results['block_ip'] = all_blocks_ip_ok + return ctrl_results -static func _get_current_fs_key(litera: int, fs_keys_dic: Dictionary) -> String: - return fs_keys_dic.get(str(litera), '') - - -## Возвращает бит ДКМ для проверки текущей литеры -static func _get_dkm_bit_for_current_fs(litera: int, constants_dic: Dictionary) -> int: - match litera: - 1: return constants_dic.DKM_BIT_1 - 2: return constants_dic.DKM_BIT_2 - 3: return constants_dic.DKM_BIT_3 - 4: return constants_dic.DKM_BIT_4 - 5: return constants_dic.DKM_BIT_5 - 6: return constants_dic.DKM_BIT_6 - 7: return constants_dic.DKM_BIT_7 - _: return -1 - - -## Итоговое заключение по результам контроля всех ИП -static func on_control_result(ip_config: Dictionary, ctrl_results: Dictionary) -> Dictionary: - var all_blocks_ip_ok = true - for block in ip_config: - if not ip_config[block][1]: - all_blocks_ip_ok = false - ctrl_results['block_ip'] = all_blocks_ip_ok - return ctrl_results - - -## Установка угла и аттенюации для УМ -static func on_ug_setting(prd_unit: Object, settings_ug: Dictionary, prd_cmd_array: Array) -> bool: - var result_1 = ((settings_ug.ATT_UM_1 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07) - var result_2 = ((settings_ug.ATT_UM_2 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07) - prd_cmd_array.append([prd_unit.CmdCode.WRITE_ISA, [ settings_ug.ADDR_UG_LITERA_1, result_1, - settings_ug.ADDR_UG_LITERA_2, result_2, - settings_ug.ADDR_UG_LITERA_3, settings_ug.ATT_UM_3, - ] - ]) - return true - - -static func _handle_read_isa(prd_unit: Object, read_isa_ports: Array, prd_cmd_array) -> void: - prd_cmd_array.append([prd_unit.CmdCode.READ_ISA, read_isa_ports]) - - -## Управаление модулем фс (включить/отключить излучение) -static func manage_fs(mode: bool, pribor: String, p_conf: Dictionary, fs_params: Dictionary, litera: int, power_um: int) -> void: - # Получаем конфигурацию для текущего прибора - var config: Dictionary = p_conf[pribor] - var angle: float = config.angle - var sectors: Array = config.sectors - - # Формируем выходные данные - var interfer_name: String = 'k1' if mode else 'off' - var fs_arr: Array = [] - - if litera in fs_params: - var params = fs_params[litera] - fs_arr.append([ - angle, - params.freq, - params.width, - sectors[litera - 1] if litera == 1 else sectors[litera - 5] if litera > 5 else sectors[litera - 4] if litera > 3 else sectors[litera - 2] + ## Установка угла и аттенюации для УМ + static func on_ug_setting(prd_module: Object, prd_unit: Object, settings_ug: Dictionary) -> bool: + var result_1 = ((settings_ug.ATT_UM_1 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07) + var result_2 = ((settings_ug.ATT_UM_2 & 0x07) << 3) | (settings_ug.RAY_DOU_NUM & 0x07) + prd_module.cmd_array.append([prd_unit.CmdCode.WRITE_ISA, [ settings_ug.ADDR_UG_LITERA_1, result_1, + settings_ug.ADDR_UG_LITERA_2, result_2, + settings_ug.ADDR_UG_LITERA_3, settings_ug.ATT_UM_3, + ] ]) - #signaller.emit_signal('emit_changed', mode) TODO: не отключаю подавление (даже если при входе в контроль он был отключен) - signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um) + return true -## Проверка касет П1 и ИП МА2000 -static func check_block_ip(status_prd: PackedByteArray, ip_config: Dictionary) -> Dictionary: - # Конфигурация проверяемых блоков - var byte_dry: int = 27 - var ug_valid: bool = (status_prd[0] >> 1) & 1 - for block in ip_config: - var bit: int = ip_config[block][0] - if ug_valid: - var status = status_prd[byte_dry] >> bit & 1 - ip_config[block][1] = false if status else true - return ip_config + static func _handle_read_isa(prd_module: Object, prd_unit: Object, read_isa_ports: Array) -> void: + prd_module.cmd_array.append([prd_unit.CmdCode.READ_ISA, read_isa_ports]) -## Проверка кассеты у-5 (ЯУ-07Б, ЭМС-Г, УГ, УКП-1, УКП-2) -static func check_block_kasseta_y5(status_prd: PackedByteArray, y5_config: Dictionary, flag_not_trust: bool) -> Dictionary: - y5_config.yau07 = not flag_not_trust - if y5_config.yau07: + ## Управаление модулем фс (включить/отключить излучение) + static func manage_fs(mode: bool, pribor: String, p_conf: Dictionary, fs_params: Dictionary, litera: int, power_um: int) -> void: + # Получаем конфигурацию для текущего прибора + var config: Dictionary = p_conf[pribor] + var angle: float = config.angle + var sectors: Array = config.sectors + + # Формируем выходные данные + var interfer_name: String = 'k1' if mode else 'off' + var fs_arr: Array = [] + + if litera in fs_params: + var params = fs_params[litera] + fs_arr.append([ + angle, + params.freq, + params.width, + sectors[litera - 1] if litera == 1 else sectors[litera - 5] if litera > 5 else sectors[litera - 4] if litera > 3 else sectors[litera - 2] + ]) + signaller.emit_signal('emit_changed', mode) + signaller.emit_signal('interfer_init', interfer_name, fs_arr, power_um) + + + ## Проверка касет П1 и ИП МА2000 + static func check_block_ip(status_prd: PackedByteArray, ip_config: Dictionary) -> Dictionary: + # Конфигурация проверяемых блоков + var byte_dry: int = 27 + var ug_valid: bool = (status_prd[0] >> 1) & 1 + for block in ip_config: + var bit: int = ip_config[block][0] + if ug_valid: + var status = status_prd[byte_dry] >> bit & 1 + ip_config[block][1] = false if status else true + return ip_config + + + ## Проверка кассеты у-5 (ЯУ-07Б, ЭМС-Г, УГ, УКП-1, УКП-2) + static func check_block_kasseta_y5(status_prd: PackedByteArray, y5_config: Dictionary) -> Dictionary: + y5_config.yau07 = true y5_config.ems = (status_prd[0] & 1) and ((status_prd[0] >> 4) & 1) y5_config.ug = (status_prd[0] >> 1) & 1 y5_config.ukp1 = (status_prd[0] >> 2) & 1 y5_config.ukp2 = (status_prd[0] >> 3) & 1 - return y5_config + return y5_config -## Мониторинг температуры -static func check_temperature_um(status_prd: PackedByteArray) -> Dictionary: + ## Проверка температур УМ от УКП + static func check_temperature_um(status_prd: PackedByteArray, power_amplifier: Array) -> bool: const Constants: Dictionary = { 'CONST_MIN_TEMP': -25, 'MAXIMUM_CODE_ADC': 3796, @@ -815,258 +500,247 @@ static func check_temperature_um(status_prd: PackedByteArray) -> Dictionary: 'TEMPERATURE_UKP_1': 47, 'TEMPERATURE_UKP_2': 79, } - const arr_um: Array = ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6', 'um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14', 'um_15', 'um_16'] const TEMP: float = 115.0 / (Constants.MAXIMUM_CODE_ADC - Constants.MINIMUM_CODE_AD) - var return_dic_temp: Dictionary var ukp1_online: int = (status_prd[0] >> 2) & 1 var ukp2_online = (status_prd[0] >> 3) & 1 + var all_temp_is_ok: bool = true + if ukp1_online: var tmp_1: int var temperature_ukp_1: int - for i_temp in 8: + for i_temp in 6: temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * i_temp) tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) - return_dic_temp[arr_um[i_temp]] = tmp_1 + power_amplifier[i_temp].value1 = tmp_1 + if tmp_1>70: + all_temp_is_ok = false + + if power_amplifier.size() > 12: # Темпуратура от УМ литеры 1 + temperature_ukp_1 = status_prd.decode_u16(Constants.TEMPERATURE_UKP_1 + 2 * 7) + tmp_1 = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) + power_amplifier[6].value1 = tmp_1 + if tmp_1>70: + all_temp_is_ok = false + if ukp2_online: - for i_temp in 8: + for i_temp in 6: var temperature_ukp_2: int = status_prd.decode_u16(Constants.TEMPERATURE_UKP_2 + 2 * i_temp) var tmp_2: int = round(Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) - return_dic_temp[arr_um[i_temp+8]] = tmp_2 - return return_dic_temp + if power_amplifier.size() > 12: + power_amplifier[i_temp+7].value1 = tmp_2 + if tmp_2>70: + all_temp_is_ok = false + else: + power_amplifier[i_temp+6].value1 = tmp_2 + if tmp_2>70: + all_temp_is_ok = false + return all_temp_is_ok + + ## Проверка ДКМ + static func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> bool: + var dkm: int = 28 + var status_dkm: bool = status_prd[dkm] >> bit_dkm & 1 + return status_dkm -## Проверка ДКМ -static func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> bool: - var dkm: int = 28 - var status_dkm: bool = status_prd[dkm] >> bit_dkm & 1 - return status_dkm + ## + static func _create_fs_mapping(s_name: String) -> Dictionary: + var suffixes: Dictionary = { + 0: '1к', 1: '4к', 2: '3к', 3: '2к', + 4: '1н', 5: '4н', 6: '3н', 7: '2н', + 8: '1н', 9: '4н', 10: '3н', 11: '2н', + 12: '1в', 13: '4в', 14: '3в', 15: '2в', + 16: '1в', 17: '4в', 18: '3в', 19: '2в', + 20: '1к', 21: '4к', 22: '3к', 23: '2к', + 24: '1к', 25: '4к', 26: '3к', 27: '2к', + } + + var mapping: Dictionary = {} + for fs_num in suffixes: + mapping[fs_num] = {'condition': s_name == suffixes[fs_num]} + return mapping -## Распределения номеров ФС по пирборам -static func _create_fs_mapping(s_name: String) -> Dictionary: - var suffixes: Dictionary = { - 0: '1к', 1: '4к', 2: '3к', 3: '2к', - 4: '1н', 5: '4н', 6: '3н', 7: '2н', - 8: '1н', 9: '4н', 10: '3н', 11: '2н', - 12: '1в', 13: '4в', 14: '3в', 15: '2в', - 16: '1в', 17: '4в', 18: '3в', 19: '2в', - 20: '1к', 21: '4к', 22: '3к', 23: '2к', - 24: '1к', 25: '4к', 26: '3к', 27: '2к', - } + ## + static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary) -> Dictionary: + var FS_RULES = [ + {'key': 'fs_1', 'min': 0, 'max': 4}, + {'key': 'fs_2', 'min': 4, 'max': 8}, + {'key': 'fs_3', 'min': 8, 'max': 12}, + {'key': 'fs_4', 'min': 12, 'max': 16}, + {'key': 'fs_5', 'min': 16, 'max': 20}, + {'key': 'fs_6', 'min': 20, 'max': 24}, + {'key': 'fs_7', 'min': 24, 'max': 27} + ] - var mapping: Dictionary = {} - for fs_num in suffixes: - mapping[fs_num] = {'condition': s_name == suffixes[fs_num]} - return mapping + var updated_results := fs_results.duplicate() + for fs_num in packet_type_7: + if not (fs_num in fs_mapping and fs_mapping[fs_num]['condition']): + continue + var fs_data = packet_type_7[fs_num] + for rule_key in FS_RULES.size(): + var rule: Dictionary = FS_RULES[rule_key] + if _should_apply_rule(fs_num, rule, updated_results): + updated_results[rule.key] = fs_data.isg + break + return updated_results -## Получения статуса ФС -static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary, fs_rules_config: Array) -> Dictionary: - var updated_results := fs_results.duplicate() - for fs_num in packet_type_7: - if not (fs_num in fs_mapping and fs_mapping[fs_num]['condition']): - continue - var fs_data = packet_type_7[fs_num] - for rule in fs_rules_config: - if _should_apply_rule(fs_num, rule, updated_results): - updated_results[rule.key] = fs_data.isg - break - return updated_results + ## Вспомогательная функция для проверки применения правила + static func _should_apply_rule(fs_num: int, rule: Dictionary, results: Dictionary) -> bool: + return bool(fs_num >= rule.min and fs_num < rule.max) and results.has(rule.key) -## Вспомогательная функция для проверки применения правила -static func _should_apply_rule(fs_num: int, rule: Dictionary, results: Dictionary) -> bool: - return bool(fs_num >= rule.min and fs_num < rule.max) and results.has(rule.key) + ## + static func power_um_ukp(status: PackedByteArray, litera: int, pwr_result: Array) -> Array: + const Constants: Dictionary = {'POWER_UKP_1' : 31, 'POWER_UKP_2': 63} + var power_values: Array = [] + var base_offset = 0 + var iteration: int = 6 + var ug_valid: bool = (status[0] >> 2) & 1 + + match litera: + 1: + # Обработка для current_fs = 1 (одно значение) + var value = status.decode_u16(Constants.POWER_UKP_1 + 2 * 7) + if ug_valid: + power_values = [value] + 2: + # Обработка для current_fs = 2 (6 значений из УКП1) + base_offset = Constants.POWER_UKP_1 + if ug_valid: + for i in iteration: + power_values.append(status.decode_u16(base_offset + 2 * i)) + 3: + # Обработка для current_fs = 3 (6 значений из УКП2) + base_offset = Constants.POWER_UKP_2 + if ug_valid: + for i in iteration: + power_values.append(status.decode_u16(base_offset + 2 * i)) + 4: + # Обработка для current_fs = 4 (6 значений из УКП1) + base_offset = Constants.POWER_UKP_1 + if ug_valid: + for i in iteration: + power_values.append(status.decode_u16(base_offset + 2 * i)) + 5: + # Обработка для current_fs = 5 (6 значений из УКП2) + base_offset = Constants.POWER_UKP_2 + if ug_valid: + for i in iteration: + power_values.append(status.decode_u16(base_offset + 2 * i)) + 6: + # Обработка для current_fs = 6 (6 значений из УКП1) + base_offset = Constants.POWER_UKP_1 + if ug_valid: + for i in iteration: + power_values.append(status.decode_u16(base_offset + 2 * i)) + 7: + # Обработка для current_fs = 7 (6 значений из УКП2) + base_offset = Constants.POWER_UKP_2 + if ug_valid: + for i in iteration: + power_values.append(status.decode_u16(base_offset + 2 * i)) + + power_values = update_max_power_values(power_values, pwr_result) + return power_values -## Получение мощности при выполнении контроля -static func power_um_ukp(status: PackedByteArray, litera: int, pwr_result: Array) -> Array: - const Constants: Dictionary = {'POWER_UKP_1' : 31, 'POWER_UKP_2': 63} - var power_values: Array = [] - var base_offset = 0 - var iteration: int = 6 - var ug_valid: bool = (status[0] >> 2) & 1 + ## Обновление максимальных значений + static func update_max_power_values(power_data: Array, max_power_values: Array) -> Array: + if power_data.size() != 6: + if max_power_values.is_empty(): + max_power_values = power_data.duplicate() + elif power_data[0] > max_power_values[0]: + max_power_values = power_data.duplicate() + return max_power_values - match litera: - 1: - # Обработка для current_fs = 1 (одно значение) - var value = status.decode_u16(Constants.POWER_UKP_1 + 2 * 7) - if ug_valid: - power_values = [value] - 2: - # Обработка для current_fs = 2 (6 значений из УКП1) - base_offset = Constants.POWER_UKP_1 - if ug_valid: - for i in iteration: - power_values.append(status.decode_u16(base_offset + 2 * i)) - 3: - # Обработка для current_fs = 3 (6 значений из УКП2) - base_offset = Constants.POWER_UKP_2 - if ug_valid: - for i in iteration: - power_values.append(status.decode_u16(base_offset + 2 * i)) - 4: - # Обработка для current_fs = 4 (6 значений из УКП1) - base_offset = Constants.POWER_UKP_1 - if ug_valid: - for i in iteration: - power_values.append(status.decode_u16(base_offset + 2 * i)) - 5: - # Обработка для current_fs = 5 (6 значений из УКП2) - base_offset = Constants.POWER_UKP_2 - if ug_valid: - for i in iteration: - power_values.append(status.decode_u16(base_offset + 2 * i)) - 6: - # Обработка для current_fs = 6 (6 значений из УКП1) - base_offset = Constants.POWER_UKP_1 - if ug_valid: - for i in iteration: - power_values.append(status.decode_u16(base_offset + 2 * i)) - 7: - # Обработка для current_fs = 7 (6 значений из УКП2) - base_offset = Constants.POWER_UKP_2 - if ug_valid: - for i in iteration: - power_values.append(status.decode_u16(base_offset + 2 * i)) - - power_values = update_max_power_values(power_values, pwr_result) - return power_values - - -## Обновление максимальных значений -static func update_max_power_values(power_data: Array, max_power_values: Array) -> Array: - if power_data.size() != 6: if max_power_values.is_empty(): max_power_values = power_data.duplicate() - elif power_data[0] > max_power_values[0]: - max_power_values = power_data.duplicate() - return max_power_values + else: + for i in 6: + if power_data[i] > max_power_values[i]: + max_power_values[i] = power_data[i] - if max_power_values.is_empty(): - max_power_values = power_data.duplicate() - else: - for i in 6: - if power_data[i] > max_power_values[i]: - max_power_values[i] = power_data[i] - - return max_power_values.duplicate() + return max_power_values.duplicate() -## Подготовка принятых данных по контролю для передачи в сцену -static func prep_power(power_dic: Dictionary, prd_name: String)-> Dictionary: - const RAY_KEYS := ["RAY_m5", "RAY_5", "RAY_15", "RAY_25", "RAY_35", "RAY_45"] - var prep_pow_dic: Dictionary = {} + static func check_dou_result(control_dic: Dictionary, power_dic: Dictionary, pribor: String, litera: int, cnst: Dictionary) -> Dictionary: + var all_dou_ok = true + var dou: String = 'dou_2' if litera == 2 else 'dou_3' + if pribor == '1к' or pribor == '2к' or pribor == '3к' or pribor == '4к': + dou = 'dou_6' if litera == 6 else 'dou_7' + elif pribor == '1в' or pribor == '2в' or pribor == '3в' or pribor == '4в': + dou = 'dou_4' if litera == 4 else 'dou_5' - var arr_litera: Array[int] - match prd_name: - '1н', '2н', '3н', '4н': - arr_litera = [2, 3] - '1в', '2в', '3в', '4в': - arr_litera = [4, 5] - '1к', '2к', '3к', '4к': - arr_litera = [6, 7, 1] + var ray_dic: Dictionary = power_dic[litera] + if ray_dic[RAY_m5].size() == 0 or \ + ray_dic[RAY_5 ].size() == 0 or \ + ray_dic[RAY_15].size() == 0 or \ + ray_dic[RAY_25].size() == 0 or \ + ray_dic[RAY_35].size() == 0 or \ + ray_dic[RAY_45].size() == 0: + control_dic[dou] = false + return control_dic - if not arr_litera: - print_debug('Ошибка в prd_name') - return prep_pow_dic + for i_pow_arr in ray_dic.values(): + for i_pow in i_pow_arr.size(): + if i_pow_arr[i_pow] < cnst.POWER_THRESHOLD: + all_dou_ok = false - var um_names: Array[Array] = [] - if arr_litera.size() != 3: - um_names = [ - ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'], - ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] - ] - else: - um_names = [ - ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'], - ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'], - ['um_8'] - ] + control_dic[dou] = all_dou_ok - for litera_index in arr_litera.size(): - var litera: int = arr_litera[litera_index] - var litera_data: Dictionary = power_dic.get(litera, {}) - var um_data: Array[Array] = [[], [], [], [], [], []] - - for i in range(RAY_KEYS.size()): - var ray_key: String = RAY_KEYS[i] - var ray_array: Array = litera_data.get(ray_key, []) - - if ray_array.size() == 1: - var single_value = ray_array[0] - for j in range(6): - um_data[j].append(single_value) - else: - for j in range(6): - um_data[j].append(ray_array[j] if j < ray_array.size() else 0) - - var current_um_names: Array = um_names[litera_index] - for um_index in range(current_um_names.size()): - prep_pow_dic[current_um_names[um_index]] = um_data[um_index] - return prep_pow_dic - - -static func check_dou_result(control_dic: Dictionary, power_dic: Dictionary, pribor: String, litera: int, cnst: Dictionary) -> Dictionary: - var all_dou_ok = true - var dou: String = 'dou_2' if litera == 2 else 'dou_3' - if pribor == '1к' or pribor == '2к' or pribor == '3к' or pribor == '4к': - dou = 'dou_6' if litera == 6 else 'dou_7' - elif pribor == '1в' or pribor == '2в' or pribor == '3в' or pribor == '4в': - dou = 'dou_4' if litera == 4 else 'dou_5' - - var ray_dic: Dictionary = power_dic[litera] - if ray_dic[RAY_m5].size() == 0 or \ - ray_dic[RAY_5 ].size() == 0 or \ - ray_dic[RAY_15].size() == 0 or \ - ray_dic[RAY_25].size() == 0 or \ - ray_dic[RAY_35].size() == 0 or \ - ray_dic[RAY_45].size() == 0: - control_dic[dou] = false return control_dic - for i_pow_arr in ray_dic.values(): - for i_pow in i_pow_arr.size(): - if i_pow_arr[i_pow] < cnst.POWER_THRESHOLD: - all_dou_ok = false - control_dic[dou] = all_dou_ok - return control_dic + static func prep_power(power_dic: Dictionary, prd_name: String)-> Dictionary: + const RAY_KEYS := ["RAY_m5", "RAY_5", "RAY_15", "RAY_25", "RAY_35", "RAY_45"] + var prep_pow_dic: Dictionary = {} + var arr_litera: Array[int] + match prd_name: + '1н', '2н', '3н', '4н': + arr_litera = [2, 3] + '1в', '2в', '3в', '4в': + arr_litera = [4, 5] + '1к', '2к', '3к', '4к': + arr_litera = [6, 7, 1] -# Сеттер для статуса -func _set_status(new_status: String) -> void: - if current_status != new_status: - current_status = new_status - call_deferred('emit_signal', 'status_updated', new_status) + if not arr_litera: + print_debug('Ошибка в prd_name') + return prep_pow_dic + var um_names: Array[Array] = [] + if arr_litera.size() != 3: + um_names = [ + ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'], + ['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] + ] + else: + um_names = [ + ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'], + ['um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13'], + ['um_7'] # Особый случай для третьего элемента + ] -# Геттер для текущего статуса (чтобы можно было забрать в любой момент) -func get_current_status() -> String: - return current_status + for litera_index in arr_litera.size(): + var litera: int = arr_litera[litera_index] + var litera_data: Dictionary = power_dic.get(litera, {}) + var um_data: Array[Array] = [[], [], [], [], [], []] + for i in range(RAY_KEYS.size()): + var ray_key: String = RAY_KEYS[i] + var ray_array: Array = litera_data.get(ray_key, []) -func _get_ray_name(ray_num: int) -> String: - match ray_num: - 0: return "-5°" - 1: return "5°" - 2: return "15°" - 3: return "25°" - 4: return "35°" - 5: return "45°" - 6: return "ДКМ" - _: return "неизвестный угол" + if ray_array.size() == 1: + var single_value = ray_array[0] + for j in range(6): + um_data[j].append(single_value) + else: + for j in range(6): + um_data[j].append(ray_array[j] if j < ray_array.size() else 0) - -# Геттер для результатов контроля -func get_control_results() -> Dictionary: - return { - 'control_is_over': flag_control_is_over, - 'result_dic': control_results, - 'power_dic': power_result, - 'block_kasseta_y5_config': block_kasseta_y5_config, - 'block_ip_config': block_ip_config, - 'temperature_um': temperature_um, - 'POWER_THRESHOLD': constants.POWER_THRESHOLD, - 'name_prd': self_name - } + var current_um_names: Array = um_names[litera_index] + for um_index in range(current_um_names.size()): + prep_pow_dic[current_um_names[um_index]] = um_data[um_index] + return prep_pow_dic diff --git a/scripts/signaller.gd b/scripts/signaller.gd index 434df1e..16c703b 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -182,11 +182,6 @@ signal kb_pressed(state) signal ems2_hide_pressed(state) -## Вызывается при нажатии на кнопку отладки контроля -## [param state] - состояние показа отладки контроля -signal debag_control_pressed(state) - - ## Вызывается при нажатии на кнопку экранной клавиатуры ## [param state] - состояние скрытия кнопки ЭМС2 signal emit_changed(state) @@ -221,10 +216,6 @@ signal sector_klaster (new_sector_data) signal clear_klaster () -## Вызывается при нажатии на кнопку "Запуск контроля".[br] -signal start_contol_device() - - ## Вызывается при программном отключении помехи.[br] ## [param ecm] - выключаемая помеха ([b]true[/b] signal on_prog_ecm_off(ecm: interfer.Interfer) diff --git a/settings.json b/settings.json index 427f445..daf3d72 100644 --- a/settings.json +++ b/settings.json @@ -4,6 +4,7 @@ "Адрес БПО левого борта": "http://172.22.246.13:8081/selftest?presetType=bpo&400000000", "Адрес БПО правого борта": "http://172.22.246.11:8082/selftest?presetType=bpo&400000000", "Виртуальная клавиатура": false, + "Включить работу по своим целям": true, "Внешнее указание Трасса": false, "Внешнее управление": false, "Кнопка «JTIDS»": false, @@ -26,29 +27,31 @@ "Период опроса состояния АФСП, секунды": "30", "Период опроса состояния БПО, секунды": "30", "Скрыть вкладку ЭМС 2": true, + "Список своих протоколов": "j11", + "Схема прибора. Белый цвет": [1.0, 1.0, 1.0], + "Схема прибора. Чёрный цвет": [0.0, 0.0, 0.0], "Текущая версия ПО УАРЭП": "master b2633d8 Thu Sep 11 16:26:39 2025 +0300", - "Шаблон адреса сервера карт": "http://10.1.1.2:8001/osm_tiles/{z}/{x}/{y}.png", + "Шаблон адреса сервера карт": "http://169.254.27.71:8001/osm_tiles/{z}/{x}/{y}.png", "навигация": [ "*", 60000, true, true ], - "уареп-трасса": "127.0.0.1,127.0.0.1,50200,10004", "уарэп-5п28": [ "127.0.0.1", 50777 ], "уарэп-капсрпб": [ - "192.168.11.102", - "192.168.11.105", + "127.0.0.1", + "127.0.0.1", 42023, 42022, false, true ], "уарэп-спт25-1": [ - "/home/user/tty0", + "/home/sasha/dev/tty0", 0, 19200, "N", @@ -56,15 +59,23 @@ 1 ], "уарэп-спт25-2": [ - "/home/user/tty1", + "/home/sasha/dev/tty4", 0, 19200, "N", 8, 1 ], + "уарэп-трасса": [ + "127.0.0.1", + "127.0.0.1", + 50200, + 10004, + false, + true + ], "уарэп-щ3": [ - "/home/user/tty3", + "/home/sasha/dev/tty2", 7, 19200, "N", diff --git a/shaders/antenas.tres b/shaders/antenas.tres index 2c689e0..1dd2f46 100644 --- a/shaders/antenas.tres +++ b/shaders/antenas.tres @@ -7,6 +7,9 @@ code = "shader_type canvas_item; #define RADIUS_INNER_0 200.0 /* Радиус внутренний для режима приоритет РТО */ #define RADIUS_INNER_1 480.0 /* Радиус внутренний для режима приоритет РЛС */ +#define ANTENAS_COUNT 28 /* Количество антенн */ +#define ANT_BAND_READY 1U /* Антенна (модуль ФС) готова или исправна */ +#define ANT_BAND_FAILED 0U /* Антенна (модуль ФС) не исправно */ uniform vec2 pc0 = vec2(560, 560); /* Центр сетки антенн */ uniform float rotation: hint_range(0.0, 360.0) = 0.0; /* */ @@ -14,9 +17,13 @@ uniform vec4 color0: source_color = vec4(0.38, 0.47, 0.51, 0.4); uniform vec4 color1: source_color = vec4(0.39, 0.44, 0.50, 0.4); uniform float radius_inner_0 = RADIUS_INNER_0; uniform float radius_inner_1 = RADIUS_INNER_1; -uniform float radius_outter = 550.0; /* Радиус внешний. Должно быть равно ant_band_r1_6 */ +uniform float radius_outter = 550.0; /* Радиус внешний. Должно быть равно ant_band_r1_6 */ uniform float alpha: hint_range(0.0, 1.0) = 0.5; -uniform int mode = 0; /* Режим отображения. Приоритет РТО - 0, приоритет РЛС - 1 */ +uniform int mode = 0; /* Режим отображения. Приоритет РТО - 0, приоритет РЛС - 1 */ +uniform float ffr: hint_range(0.0, 1.0) = 0.2; /* Индикация неисправности модулей ФС. Заметность штриховки. */ +uniform float sfr: hint_range(0.0, 10.0) = 0.0; /* Индикация неисправности модулей ФС. Скорость движения штрховки */ +uniform float afr: hint_range(0.0, 180.0) = 0.0; /* Индикация неисправности модулей ФС. Наклон штрховки */ +uniform float pfr: hint_range(1.0, 20.0) = 10.0; /* Индикация неисправности модулей ФС. Частота штриховки */ const int ant_band_count_0 = 2; const int ant_band_count_1 = 2; @@ -42,7 +49,8 @@ const float ant_band_r1_4[] = {450.0, 530.0}; const float ant_band_r1_5[] = {500.0, 540.0}; const float ant_band_r1_6[] = {550.0, 550.0}; -uniform vec4 ant_band_c[28]; +uniform vec4 ant_band_c[ANTENAS_COUNT]; +uniform uint ant_band_m[ANTENAS_COUNT]; const float d4 = 90.0; const float ds = 1.0; @@ -79,6 +87,12 @@ void antenas(inout vec4 c, vec2 uv, vec2 p0, int cnt, float r0, float r1, inout col.rgb = ant_band_c[j].rgb; index++; col.a = alpha + (random_timed(uv) - 0.5f) * ant_band_c[j].a; + if (ant_band_m[j] == ANT_BAND_FAILED) + { + vec2 uvr = uv; + rotate_vec2(uvr, radians(afr), pc0); + col.a *= (1.0 - ffr) + tanh(10.0 * sin(TIME * sfr + 2.0 * PI * uvr.x / pfr)) * ffr; + } float v = float(i & 1); vec4 color = v * col + (1.0f - v) * col; sector(c, uv, p0, float(i) * da, da, r0, r1, color); @@ -120,4 +134,9 @@ shader_parameter/radius_inner_1 = 480.0 shader_parameter/radius_outter = 550.0 shader_parameter/alpha = 0.5 shader_parameter/mode = 0 +shader_parameter/ffr = 0.2 +shader_parameter/sfr = 0.0 +shader_parameter/afr = 0.0 +shader_parameter/pfr = 10.0 shader_parameter/ant_band_c = PackedVector4Array(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) +shader_parameter/ant_band_m = PackedInt32Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) diff --git a/table/table.gd b/table/table.gd index 14037c0..4d645d5 100644 --- a/table/table.gd +++ b/table/table.gd @@ -325,9 +325,10 @@ func _set_row_selected(i_row: int, selected: bool = true) -> void: var node = nodes[node_key] var selector = nodes[selector_key] nodes.erase(selector_key) - if is_instance_valid(node) and is_instance_valid(selector): - if selector.get_parent() == node: - node.remove_child(selector) + if is_instance_valid(selector): + var prnt = selector.get_parent_control() + if prnt: + prnt.remove_child(selector) selector.queue_free() else: push_warning('обращение к удалённому элементу \"%s\"' % selector_key) @@ -449,7 +450,6 @@ func remove_row(i_row: int): if nodes.has(sel_key): var selector = nodes[sel_key] - if selector == null: return var prnt = selector.get_parent() prnt.remove_child(selector) selector.queue_free() @@ -486,11 +486,8 @@ func next_index(indexes: Array) -> void: func swap_nodes(nodes_copy, node_key_format, i0, i1) -> void: var key0 = node_key_format % [i0.y, i0.x] var key1 = node_key_format % [i1.y, i1.x] - if is_instance_valid(nodes[key0]): - nodes_copy[key1] = nodes[key0] - nodes_copy[key1].name = key1 - else: - print_debug("Ошибка: нод ", key0, " был освобожден") + nodes_copy[key1] = nodes[key0] + nodes_copy[key1].name = key1 ## Переназначает ключи в соответствии с размерами таблицы.