From 5c9c31b4c86731f736f5d30b7ecdc134ee600936 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 27 Jun 2025 01:58:31 +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=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=A93,=20=D1=83=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0=20?= =?UTF-8?q?=D1=81=D0=B0=D0=BC=D0=BE=D0=BE=D1=82=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BF=D1=80=D0=B8=20=D0=BA=D0=BE?= =?UTF-8?q?=D0=BD=D1=82=D1=80=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project.godot | 1 + scenes/pribor-prd-v/pribor-prd-v.tscn | 1 + scenes/pribor-uyep/sch3-view.gd | 9 +++++++-- scenes/pribor-uyep/sch3.tscn | 14 ++++++++++++++ scripts/sch3.gd | 2 +- 5 files changed, 24 insertions(+), 3 deletions(-) diff --git a/project.godot b/project.godot index 31c3bfb2..348f45aa 100644 --- a/project.godot +++ b/project.godot @@ -84,6 +84,7 @@ gdscript/warnings/integer_division=0 window/size/viewport_width=1600 window/size/viewport_height=1200 +window/size/mode=3 window/subwindows/embed_subwindows=false window/stretch/mode="canvas_items" window/dpi/allow_hidpi=false diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index a86227fe..fa342304 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -329,6 +329,7 @@ fname = "УМ1535А" rname = "A18" [node name="Monitoring_panel" type="Panel" parent="."] +layout_mode = 0 theme_override_styles/panel = SubResource("StyleBoxTexture_vxfkm") [node name="in_fs_1" type="AnimatedSprite2D" parent="Monitoring_panel"] diff --git a/scenes/pribor-uyep/sch3-view.gd b/scenes/pribor-uyep/sch3-view.gd index 3346f3a3..9fe56547 100644 --- a/scenes/pribor-uyep/sch3-view.gd +++ b/scenes/pribor-uyep/sch3-view.gd @@ -17,7 +17,7 @@ extends 'res://scenes/контроль/элемент-я.gd' var regs_input: = {} ## Регистры входные var regs_holding: = {} ## Регистры хранения var switches_sync: = false ## Флаг. Если установлен, то можно переключать - +var external_ctl: = false ## Флаг внешнего управления func on_error(msg, unit_sch3): if unit_sch3.online: @@ -42,7 +42,7 @@ func on_line_changed_sch3(unit_sch3): func on_settings_changed(): - var external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false) + external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false) if not external_ctl: return var items = get_tree().get_nodes_in_group('bits_items_switch') @@ -100,6 +100,7 @@ func _exit_tree() -> void: var unit_sch3 = network.units[unit_key] unit_sch3.disconnect('read', on_read.bind(unit_sch3)) unit_sch3.disconnect('read_input', on_input.bind(unit_sch3)) + external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false) unit_sch3.disconnect('error', on_error) unit_sch3.disconnect('line_changed', on_line_changed_sch3) @@ -114,6 +115,10 @@ func on_read(base_addr: int, data: Array, unit_sch3): regs_holding[base_addr + i] = data[i] # Разрешить работу выключателей только когда прочитано их реальное состояние if not switches_sync: + if not external_ctl: + if regs_holding.has(0) and regs_holding.has(2): + regs_holding[0] = regs_holding[0] | 1 + regs_holding[2] = regs_holding[2] & 0xffe switches_sync = true for item in get_tree().get_nodes_in_group('bits_items_switch'): var bits = item.get_meta('bits') diff --git a/scenes/pribor-uyep/sch3.tscn b/scenes/pribor-uyep/sch3.tscn index f74e0949..a175a03f 100644 --- a/scenes/pribor-uyep/sch3.tscn +++ b/scenes/pribor-uyep/sch3.tscn @@ -142,6 +142,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания УФ" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 0, 2, 0] @@ -171,6 +172,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания РТР" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 1, 2, 1] @@ -199,6 +201,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-Н.1" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 2, 2, 2] @@ -228,6 +231,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-Н.2" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 3, 2, 3] @@ -257,6 +261,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-Н.3" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 4, 2, 4] @@ -286,6 +291,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-Н.4" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 5, 2, 5] @@ -315,6 +321,7 @@ material = SubResource("ShaderMaterial_vdwfd") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-В.1" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 6, 2, 6] @@ -344,6 +351,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-В.2" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 7, 2, 7] @@ -373,6 +381,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-В.3" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 8, 2, 8] @@ -402,6 +411,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-В.4" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 9, 2, 9] @@ -431,6 +441,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-К.1" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 10, 2, 10] @@ -460,6 +471,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-К.2" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [0, 11, 2, 11] @@ -489,6 +501,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 2 tooltip_text = "Выключатель питания ПРД-К.3" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [1, 0, 3, 0] @@ -518,6 +531,7 @@ material = SubResource("ShaderMaterial_c1mqk") layout_mode = 2 size_flags_horizontal = 0 tooltip_text = "Выключатель питания ПРД-К.4" +button_pressed = true action_mode = 0 script = ExtResource("7_l6esm") metadata/bits = [1, 1, 3, 1] diff --git a/scripts/sch3.gd b/scripts/sch3.gd index eb13478e..abedfbf2 100644 --- a/scripts/sch3.gd +++ b/scripts/sch3.gd @@ -78,7 +78,7 @@ class Sch3 extends unit.Unit: step_fsm = Sch3Fsm.WRITE elif step_fsm == Sch3Fsm.CONNECT: try_disconnect() - #try_connect() + try_connect() mbc.request_read_input(base_input_address, regs_input_count) cmd_state = CmdState.WAIT tx_tick = tick