From b7a871399b3b0570bd23bcb31c524465819ac6a9 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Thu, 29 May 2025 13:36:22 +0300 Subject: [PATCH 01/21] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80.=20=D0=A3=D0=B1=D1=80=D0=B0=D0=BD=D0=BE=20=D0=BD?= =?UTF-8?q?=D0=B5=D0=BD=D1=83=D0=B6=D0=BD=D0=BE=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 29 ++++++++++++----------------- scenes/tilemap/tilemap.tscn | 1 - 2 files changed, 12 insertions(+), 18 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 5884b2f..9af9005 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -78,7 +78,6 @@ var image: = Image.new() var image_load_proc: Callable var now: = 0 var visible_marks_count: = 0 -var mouse_wheel_count: = 0 var map_server_available: = false @@ -200,10 +199,10 @@ func _input(e) -> void: if e is InputEventMouseButton: if e.pressed: if e.button_index == MOUSE_BUTTON_WHEEL_DOWN: - mouse_wheel_count -= 1 + increment_zoom(-zoom_step, lmp) queue_redraw() elif e.button_index == MOUSE_BUTTON_WHEEL_UP: - mouse_wheel_count += 1 + increment_zoom( zoom_step, lmp) queue_redraw() if e.button_index == MOUSE_BUTTON_LEFT: @@ -236,10 +235,15 @@ func multiply_zoom(multiplier: float, pivot: Vector2) -> void: _xyz.y -= p2.y - p1.y -func set_zoom(zoom: float, pivot=null) -> void: - if pivot == null: - pivot = $canvas.size / 2.0 +func increment_zoom(increment: float, pivot: Vector2) -> void: + var p1: = screen_to_world(_xyz, pivot.x, pivot.y) + _xyz.z = clampf(_xyz.z + increment, min_zoom_level, max_zoom_level) + var p2: = screen_to_world(_xyz, pivot.x, pivot.y) + _xyz.x -= p2.x - p1.x + _xyz.y -= p2.y - p1.y + +func set_zoom(zoom: float, pivot: Vector2) -> void: var p1: = screen_to_world(_xyz, pivot.x, pivot.y) _xyz.z = clampf(zoom, max_zoom_level, min_zoom_level) var p2: = screen_to_world(_xyz, pivot.x, pivot.y) @@ -248,15 +252,6 @@ func set_zoom(zoom: float, pivot=null) -> void: func _draw() -> void: - - var lmp = get_local_mouse_position() - if mouse_wheel_count > 0: - multiply_zoom(1.0 + zoom_step, lmp) - mouse_wheel_count -= 1 - elif mouse_wheel_count < 0: - multiply_zoom(1.0 - zoom_step, lmp) - mouse_wheel_count += 1 - var z = min(max_zoom_level, _xyz.z) var t1 = screen_to_tile(0, 0, z) var t2 = screen_to_tile($canvas.size.x, $canvas.size.y, z) @@ -528,7 +523,7 @@ func xyz_to_idx(x: float, y: float, z: float) -> int: return int(i + (y * n + x)) -func get_tile(x: int, y: int, z: int, create: bool = true) -> Tile: +func get_tile(x: int, y: int, z: int) -> Tile: var n = pow(2, z) if x >= 0: @@ -560,7 +555,7 @@ func get_tile(x: int, y: int, z: int, create: bool = true) -> Tile: return tile var queue_size: = _queue.size() - if create and (not $canvas/player.is_playing()): + if not $canvas/player.is_playing(): if not tile: tile = Tile.new(idx, x, y, z) tile.url = base_url.replace('{x}', str(x)).replace('{y}', str(y)).replace('{z}', str(z)) diff --git a/scenes/tilemap/tilemap.tscn b/scenes/tilemap/tilemap.tscn index aa619a9..c00214d 100644 --- a/scenes/tilemap/tilemap.tscn +++ b/scenes/tilemap/tilemap.tscn @@ -31,7 +31,6 @@ script = ExtResource("1_l64tp") base_url = "http://192.168.11.105:8001/osm_tiles/{z}/{x}/{y}.png" max_zoom_level = 15 max_zoom_level_server = 10 -az = 2.0 [node name="canvas" type="TextureRect" parent="." groups=["gui_items"]] clip_contents = true From 4e5df25019a75b6bc7640344947aecb332b4aa73 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Thu, 29 May 2025 13:37:02 +0300 Subject: [PATCH 02/21] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 9af9005..e4b94aa 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -209,7 +209,6 @@ func _input(e) -> void: _dragging = e.pressed _drag_pos = screen_to_world(_xyz, lmp.x, lmp.y) - elif e is InputEventMouseMotion: if _dragging: var wp = screen_to_world(_xyz, lmp.x, lmp.y) @@ -311,7 +310,7 @@ func _clean_cache() -> void: func _process(delta) -> void: now += delta - # if cache is overflowing - clean it + # Если кэш переполнен - очистить его. if not _last_cache_check or now - _last_cache_check > 5: _last_cache_check = now _clean_cache() @@ -611,7 +610,7 @@ func haversine_m(lat1: float, lon1: float, lat2: float, lon2: float) -> float: var rlon1: = deg_to_rad(lon1) var rlat2: = deg_to_rad(lat2) var rlon2: = deg_to_rad(lon2) - # вычисления длины большого круга + # вычисление длины большого круга var cl1: = cos(rlat1) var cl2: = cos(rlat2) var sl1: = sin(rlat1) From 2f050d34c3fcfc37e32249f2bc52610705098c8d Mon Sep 17 00:00:00 2001 From: sasha80 Date: Thu, 29 May 2025 13:38:37 +0300 Subject: [PATCH 03/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=91=D0=BE=D0=BB=D0=B5=D0=B5=20=D0=B1?= =?UTF-8?q?=D1=8B=D1=81=D1=82=D1=80=D0=BE=D0=B5=20=D0=BC=D0=B0=D1=81=D1=88?= =?UTF-8?q?=D1=82=D0=B0=D0=B1=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8?= =?UTF-8?q?=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.tscn | 1 + 1 file changed, 1 insertion(+) diff --git a/scenes/tilemap/tilemap.tscn b/scenes/tilemap/tilemap.tscn index c00214d..39ff362 100644 --- a/scenes/tilemap/tilemap.tscn +++ b/scenes/tilemap/tilemap.tscn @@ -29,6 +29,7 @@ size = Vector2(400, 400) [node name="tilemap" type="CanvasGroup" groups=["gui_items"]] script = ExtResource("1_l64tp") base_url = "http://192.168.11.105:8001/osm_tiles/{z}/{x}/{y}.png" +zoom_step = 0.1 max_zoom_level = 15 max_zoom_level_server = 10 From fdd3c7dfcafb8b80a76b9a1a8312262a64be52be Mon Sep 17 00:00:00 2001 From: sasha80 Date: Thu, 29 May 2025 13:39:10 +0300 Subject: [PATCH 04/21] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5.=20=D0=97=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B8=D0=BC=D0=B5=D0=BD=D0=B8?= =?UTF-8?q?=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D1=91=D0=BD=D0=BD?= =?UTF-8?q?=D0=BE=D0=B3=D0=BE=20=D0=B3=D0=BB=D0=BE=D0=B1=D0=B0=D0=BB=D1=8C?= =?UTF-8?q?=D0=BD=D0=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/prd.gd | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/prd.gd b/scripts/prd.gd index 7809ffd..151df54 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -341,10 +341,10 @@ func check_dir(): ## Производит приём состояния модулей ФС. -func on_data_capsrpb_received(unit: capsrpb.CapsRpb): - if not unit.json_dic.has('ts'): return - if unit.json_dic['ts'] != 7: return - if not unit.json_dic.has('msfs'): return +func on_data_capsrpb_received(unit0: capsrpb.CapsRpb): + if not unit0.json_dic.has('ts'): return + if unit0.json_dic['ts'] != 7: return + if not unit0.json_dic.has('msfs'): return var msfs = unit.json_dic['msfs'] for fs in msfs: From 2638fad8c1d8fef61c487f0280df301f15516444 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Thu, 29 May 2025 15:18:11 +0300 Subject: [PATCH 05/21] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5.=20=D0=9E=D0=BF=D0=B5=D1=87?= =?UTF-8?q?=D0=B0=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index cf5a99c..6562d51 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ - Запустить скрипт `build.sh` -# Взаимодействие с 5p28 +# Взаимодействие с 5П-28 - Для получения навигационных данных, должно быть настроено дублирование udp-пакетов приходящих на соответствующий порт. Скрипт `ip-tables-navigation.sh` выполняет From cd5a58433cc40bc144a0b5fbb49afac1fcef24d2 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Fri, 30 May 2025 11:37:11 +0300 Subject: [PATCH 06/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=97=D0=B0=D0=BF=D1=80=D0=B5=D1=82?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=B0=D1=80=D1=82=D1=8B=20?= =?UTF-8?q?=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D1=82=D0=B5?= =?UTF-8?q?=D0=BB=D0=B5=D0=BC=20=D0=B7=D0=B0=20=D0=BA=D1=80=D0=B0=D0=B9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 48 +++++++++++++++++++++++++++------------ scenes/работа/работа.tscn | 2 ++ 2 files changed, 35 insertions(+), 15 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index e4b94aa..25f9ca8 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -24,8 +24,8 @@ class_name MercatorTileMap @export_color_no_alpha() var back_color: = Color.BLACK const default_size: = 400.0 var is_centered: = false -var is_anim_playng: = false - +var is_out_border1: = true +var is_out_border2: = true @export var animation_time: float = 0.1: set(val): @@ -65,7 +65,7 @@ var is_anim_playng: = false return _xyz.z -var _xyz: Vector3 = Vector3(0, 0, min_zoom_level) +var _xyz: Vector3 = Vector3(0, 0, 0) var _cache: Dictionary = {} var _queue: Dictionary = {} var _dragging: bool = false @@ -111,6 +111,7 @@ func get_marks_count(): return _marks.size() func _ready() -> void: + _xyz.z = min_zoom_level image_type = 'png' $canvas.connect('mouse_entered', func(): _rollover = true) $canvas.connect('mouse_exited', func(): _rollover = false) @@ -199,12 +200,12 @@ func _input(e) -> void: if e is InputEventMouseButton: if e.pressed: if e.button_index == MOUSE_BUTTON_WHEEL_DOWN: - increment_zoom(-zoom_step, lmp) - queue_redraw() + if (not is_out_border1) and (not is_out_border2): + increment_zoom(-zoom_step, lmp) + queue_redraw() elif e.button_index == MOUSE_BUTTON_WHEEL_UP: increment_zoom( zoom_step, lmp) queue_redraw() - if e.button_index == MOUSE_BUTTON_LEFT: _dragging = e.pressed _drag_pos = screen_to_world(_xyz, lmp.x, lmp.y) @@ -214,7 +215,17 @@ func _input(e) -> void: var wp = screen_to_world(_xyz, lmp.x, lmp.y) var diff = _drag_pos - wp _xyz.x += diff.x - _xyz.y += diff.y + + if (not is_out_border1) and diff.y >= 0: + _xyz.y += diff.y + if is_out_border1 and diff.y <= 0: + _xyz.y += diff.y + + if is_out_border2 and diff.y >= 0: + _xyz.y += diff.y + if (not is_out_border2) and diff.y <= 0: + _xyz.y += diff.y + queue_redraw() if diff.length() > 0: signaller.emmit(signaller.map_user_panning) @@ -253,11 +264,12 @@ func set_zoom(zoom: float, pivot: Vector2) -> void: func _draw() -> void: var z = min(max_zoom_level, _xyz.z) var t1 = screen_to_tile(0, 0, z) - var t2 = screen_to_tile($canvas.size.x, $canvas.size.y, z) - for tx in range(t1.x, t2.x + 1): - for ty in range(t1.y, t2.y + 1): + var t2 = screen_to_tile($canvas.size.x, $canvas.size.y, z) + Vector2(1, 1) + is_out_border1 = true + is_out_border2 = true + for tx in range(t1.x, t2.x): + for ty in range(t1.y, t2.y): _draw_tile(tx, ty, z) - var n = pow(2, z) var dx = n * tile_width var c = $canvas.size / 2.0 @@ -295,7 +307,6 @@ func get_next_in_queue() -> Tile: return tile -# delete oldest tiles from cache func _clean_cache() -> void: var overflow = _cache.size() - max_cached_tiles if overflow <= 0: @@ -365,11 +376,9 @@ func _response(result, code, _headers: Array, body: PackedByteArray, req, tile: push_error('не удалось получить изображение (неверный формат?) из \"%s\"' % tile.url) return - # create texture from image and add it to the cache tile.texture = ImageTexture.create_from_image(image) _cache[tile.i] = tile - # redraw the map queue_redraw() @@ -395,11 +404,19 @@ func _draw_subtile(tx: int, ty: int, tz: int, origx: int, origy: int, origz: flo var rect = Rect2(xrat1 * tile_width, yrat1 * tile_height, xwidth * tile_width, yheight * tile_height) if subtile.texture: + check_borders(p1, p2, $canvas.size.y) draw_texture_rect_region(subtile.texture, Rect2(p1, p2 - p1), rect) return true return false +func check_borders(p1, p2, h): + if p1.y < 0: + is_out_border1 = false + if p1.y + (p2 - p1).y > h: + is_out_border2 = false + + func _draw_tile(tx: int, ty: int, z: float) -> void: var tz = floor(z) var p1 = tile_to_screen(tx, ty, z) @@ -407,6 +424,7 @@ func _draw_tile(tx: int, ty: int, z: float) -> void: var tile = get_tile(tx, ty, tz) if tile: if tile.texture: + check_borders(p1, p2, $canvas.size.y) draw_texture_rect(tile.texture, Rect2(p1, p2 - p1), false, Color.WHITE, false) else: var zzz = tz @@ -416,7 +434,7 @@ func _draw_tile(tx: int, ty: int, z: float) -> void: zzz -= 1 txx = floor(txx / 2.0) tyy = floor(tyy / 2.0) - if _draw_subtile(txx, tyy, zzz, tx, ty,z): + if _draw_subtile(txx, tyy, zzz, tx, ty, z): break diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 9a75da6..736d3d6 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -84,6 +84,8 @@ metadata/_edit_lock_ = true [node name="tilemap" parent="." instance=ExtResource("10_gtwyg")] self_modulate = Color(1, 1, 1, 0.415686) position = Vector2(360, 360) +min_zoom_level = 3 +max_zoom_level_server = 11 [node name="player" type="AnimationPlayer" parent="tilemap"] libraries = { From f0f95d2d87bb54877db95ac0eba5c97e1f9f793a Mon Sep 17 00:00:00 2001 From: sasha80 Date: Fri, 30 May 2025 11:38:38 +0300 Subject: [PATCH 07/21] =?UTF-8?q?=D0=98=D1=81=D0=BF=D1=80=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D0=B8=D0=B5.=20=D0=9B=D0=B8=D1=88=D0=BD?= =?UTF-8?q?=D1=8F=D1=8F=20=D0=BF=D1=80=D0=BE=D0=B2=D0=B5=D1=80=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 25f9ca8..93d5aac 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -572,13 +572,11 @@ func get_tile(x: int, y: int, z: int) -> Tile: return tile var queue_size: = _queue.size() - if not $canvas/player.is_playing(): - if not tile: - tile = Tile.new(idx, x, y, z) - tile.url = base_url.replace('{x}', str(x)).replace('{y}', str(y)).replace('{z}', str(z)) - tile.t = now - if z <= max_zoom_level_server: - _queue[idx] = tile + tile = Tile.new(idx, x, y, z) + tile.url = base_url.replace('{x}', str(x)).replace('{y}', str(y)).replace('{z}', str(z)) + tile.t = now + if z <= max_zoom_level_server: + _queue[idx] = tile if queue_size == 0 and _queue.size(): emit_signal('load_started') From b1e43c5c08a223ef3a4a6eea6766757cec5e8bd2 Mon Sep 17 00:00:00 2001 From: sasha80 Date: Fri, 30 May 2025 11:38:50 +0300 Subject: [PATCH 08/21] Godot4.4 --- scenes/работа/работа.tscn | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 736d3d6..199f182 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -287,6 +287,6 @@ texture_pressed = ExtResource("13_ggrwd") [connection signal="drag_continue" from="." to="." method="_on_drag_continue"] [connection signal="toggled" from="btn_view" to="." method="on_button_view_toggled"] [connection signal="toggled" from="chk_auto" to="." method="on_value_changed"] -[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"] [connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"] +[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate"] [connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"] From 86e9fe8cb1beaa984aef26f138708b327229fdad Mon Sep 17 00:00:00 2001 From: sasha80 Date: Fri, 30 May 2025 13:57:34 +0300 Subject: [PATCH 09/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=92=D1=8B=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D0=B8=D1=82=D1=8C=20=D1=81=D1=82=D1=80=D0=BE=D0=B1=20=D0=B2=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B6=D0=B8=D0=BC=D0=B5=20=D0=BE=D0=B1=D0=B7=D0=BE?= =?UTF-8?q?=D1=80=D0=BD=D0=BE=D0=B9=20=D0=BA=D0=B0=D1=80=D1=82=D1=8B,=20?= =?UTF-8?q?=D1=82.=D0=BA.=20=D0=BE=D0=BD=20=D0=BD=D0=B0=D0=BA=D0=BB=D0=B0?= =?UTF-8?q?=D0=B4=D1=8B=D0=B2=D0=B0=D0=B5=D1=82=D1=81=D1=8F=20=D0=BD=D0=B0?= =?UTF-8?q?=20=D0=BA=D0=B0=D1=80=D1=82=D1=83.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/diagram/diagram.gd | 10 +++++++++- scenes/работа/работа.gd | 12 ++++++++++-- 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/scenes/diagram/diagram.gd b/scenes/diagram/diagram.gd index 7be13d4..008dcd3 100644 --- a/scenes/diagram/diagram.gd +++ b/scenes/diagram/diagram.gd @@ -29,9 +29,17 @@ 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 set_view_mode(val: int): material.set('shader_parameter/mode', val); func set_band_colors(val: Array): material.set('shader_parameter/ant_band_c', val) + +func set_view_mode(val: int): + if val == 1: + $строб.hide() + else: + $строб.show() + material.set('shader_parameter/mode', val) + + ## Закрашивание по умолчанию блоков ФС цветами из настроек. func set_def_colors(): var color0: Vector3 = ProjectSettings.get_setting('application/interfer/default_color0', Vector3(0.38, 0.47, 0.51)) diff --git a/scenes/работа/работа.gd b/scenes/работа/работа.gd index 3096fbf..ea8f936 100644 --- a/scenes/работа/работа.gd +++ b/scenes/работа/работа.gd @@ -29,7 +29,7 @@ var shift_pressed: bool ## Кнопка SHIFT нажата. var strob_band_begin: float ## Ширина строба в момент начала перетаскивания. var strob_dir_begin: float ## Направление антенны в момент начала перетаскивания. var strob_width_begin: float ## Ширина строба по углу в момент начала перетаскивания. - +var view_mode: MapViewMode ## Режим отображения карты signal drag_begin ## Вызывается в момент начала перетаскивания. signal drag_continue ## Вызывается во время продолжения перетаскивания. @@ -59,6 +59,13 @@ enum BtnSel { } +## Режим отображения карты +enum MapViewMode { + RTO = 0, ## Режим приоритет РТО (малая карта, широкие секторы) + RLS = 1 ## Режим приоритет РЛС (большая карта, узкие секторы) + } + + const VAL_TO_EVENT = { false: 'manual_control', ## Выбор целей и установка помех вручную. true: 'full_auto' } ## Выбор целей и установка помех автоматически. @@ -86,6 +93,7 @@ func on_button_view_toggled(toggled: bool): var s = map_sizes[int(toggled)] $tilemap.size = s.size $tilemap.position = s.position + view_mode = MapViewMode.RLS if toggled else MapViewMode.RTO ## Встроенный обратный вызов. @@ -379,7 +387,7 @@ func _on_drag_begin(event) -> void: ## Обработчик событий ввода. Вызывается godot. func _input(event) -> void: if not is_visible_in_tree(): return - if event is InputEventMouseMotion: + if (event is InputEventMouseMotion) and (view_mode == MapViewMode.RTO): if drag_fsm == DragFSM.DRAG: emit_signal('drag_continue', event) elif event is InputEventMouseButton: From 744bb9ebdd1cf8a7a886fb3758f6d32e932dc46d Mon Sep 17 00:00:00 2001 From: sasha80 Date: Mon, 2 Jun 2025 09:20:03 +0300 Subject: [PATCH 10/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=9F=D0=B0=D1=80=D0=B0=D0=BC=D0=B5?= =?UTF-8?q?=D1=82=D1=80=D1=8B=20=D1=83=D1=81=D1=82=D0=B0=D0=BD=D0=B0=D0=B2?= =?UTF-8?q?=D0=BB=D0=B8=D0=B2=D0=B0=D1=8E=D1=82=D1=81=D1=8F=20=D0=B2=20?= =?UTF-8?q?=D1=80=D0=BE=D0=B4=D0=B8=D1=82=D0=B5=D0=BB=D1=8C=D1=81=D0=BA?= =?UTF-8?q?=D0=BE=D0=B9=20=D1=81=D1=86=D0=B5=D0=BD=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.tscn | 3 --- 1 file changed, 3 deletions(-) diff --git a/scenes/tilemap/tilemap.tscn b/scenes/tilemap/tilemap.tscn index 39ff362..3192fa6 100644 --- a/scenes/tilemap/tilemap.tscn +++ b/scenes/tilemap/tilemap.tscn @@ -28,10 +28,7 @@ size = Vector2(400, 400) [node name="tilemap" type="CanvasGroup" groups=["gui_items"]] script = ExtResource("1_l64tp") -base_url = "http://192.168.11.105:8001/osm_tiles/{z}/{x}/{y}.png" zoom_step = 0.1 -max_zoom_level = 15 -max_zoom_level_server = 10 [node name="canvas" type="TextureRect" parent="." groups=["gui_items"]] clip_contents = true From 0dc8e69785a383b2268b6a06954c25b7188af7de Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 3 Jun 2025 13:01:27 +0300 Subject: [PATCH 11/21] =?UTF-8?q?=D0=A0=D0=B5=D1=84=D0=B0=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D1=80.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 104 ++++++++++++++------------------------ 1 file changed, 39 insertions(+), 65 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 93d5aac..6c15e78 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -142,16 +142,12 @@ func _on_resize() -> void: ## Создаёт новую отметку из координат экрана -func add_mark_from_screen_pos(id: int, x: float, y: float, mark: Node) -> bool: +func add_mark_from_screen_pos(id: int, scr_xy: Vector2, mark: Node) -> bool: if _marks.has(id): return false - var wrld_pos = screen_to_world(_xyz, x, y) - var p = world_to_tile(wrld_pos.x, wrld_pos.y, _xyz.z) - var tile_index = xyz_to_idx(p.x, p.y, _xyz.z) - var dot = { 'position': wrld_pos, 'tile_index': tile_index, 'mark': mark } - _marks[id] = dot + var wrld_pos = screen_to_world(_xyz, scr_xy) + _marks[id] = { 'position': wrld_pos, 'mark': mark, 'gap_size': 0.0 } add_child(mark) - fix_mark_position(dot) return true @@ -169,9 +165,7 @@ func add_mark_from_lon_lat(id: int, lon: float, lat: float, mark: Node, gap_size if _marks.has(id): return false var wrld_pos = lonlat_to_world(lon, lat) - var scr_pos = world_to_screen(wrld_pos.x, wrld_pos.y) - mark.set_global_position(scr_pos) - _marks[id] = {'position': wrld_pos, 'mark': mark, 'gap_size': gap_size } + _marks[id] = {'position': wrld_pos, 'mark': mark, 'gap_size': gap_size} add_child(mark) queue_redraw() return true @@ -189,7 +183,7 @@ func fix_mark_position(dot) -> void: func is_mark_visible(dot) -> bool: - var screen_pos = world_to_screen(dot.position.x, dot.position.y) + var screen_pos = world_to_screen(dot.position) return screen_pos.x > 0 and screen_pos.x < $canvas.size.x @@ -208,11 +202,11 @@ func _input(e) -> void: queue_redraw() if e.button_index == MOUSE_BUTTON_LEFT: _dragging = e.pressed - _drag_pos = screen_to_world(_xyz, lmp.x, lmp.y) + _drag_pos = screen_to_world(_xyz, lmp) elif e is InputEventMouseMotion: if _dragging: - var wp = screen_to_world(_xyz, lmp.x, lmp.y) + var wp = screen_to_world(_xyz, lmp) var diff = _drag_pos - wp _xyz.x += diff.x @@ -231,40 +225,34 @@ func _input(e) -> void: signaller.emmit(signaller.map_user_panning) -## Возвращает true, если видна область за краем карты -func is_border_visible(): - var z = min(max_zoom_level, _xyz.z) - return screen_to_tile(0, 0, z).y != 0 - - func multiply_zoom(multiplier: float, pivot: Vector2) -> void: - var p1: = screen_to_world(_xyz, pivot.x, pivot.y) + var p1: = screen_to_world(_xyz, pivot) _xyz.z = clampf(_xyz.z * multiplier, min_zoom_level, max_zoom_level) - var p2: = screen_to_world(_xyz, pivot.x, pivot.y) + var p2: = screen_to_world(_xyz, pivot) _xyz.x -= p2.x - p1.x _xyz.y -= p2.y - p1.y func increment_zoom(increment: float, pivot: Vector2) -> void: - var p1: = screen_to_world(_xyz, pivot.x, pivot.y) + var p1: = screen_to_world(_xyz, pivot) _xyz.z = clampf(_xyz.z + increment, min_zoom_level, max_zoom_level) - var p2: = screen_to_world(_xyz, pivot.x, pivot.y) + var p2: = screen_to_world(_xyz, pivot) _xyz.x -= p2.x - p1.x _xyz.y -= p2.y - p1.y func set_zoom(zoom: float, pivot: Vector2) -> void: - var p1: = screen_to_world(_xyz, pivot.x, pivot.y) + var p1: = screen_to_world(_xyz, pivot) _xyz.z = clampf(zoom, max_zoom_level, min_zoom_level) - var p2: = screen_to_world(_xyz, pivot.x, pivot.y) + var p2: = screen_to_world(_xyz, pivot) _xyz.x -= p2.x - p1.x _xyz.y -= p2.y - p1.y func _draw() -> void: var z = min(max_zoom_level, _xyz.z) - var t1 = screen_to_tile(0, 0, z) - var t2 = screen_to_tile($canvas.size.x, $canvas.size.y, z) + Vector2(1, 1) + var t1 = screen_to_tile(Vector2(0, 0), z) + var t2 = screen_to_tile($canvas.size, z) + Vector2(1, 1) is_out_border1 = true is_out_border2 = true for tx in range(t1.x, t2.x): @@ -272,29 +260,21 @@ func _draw() -> void: _draw_tile(tx, ty, z) var n = pow(2, z) var dx = n * tile_width - var c = $canvas.size / 2.0 - var r = min($canvas.size.x, $canvas.size.y) / 2.0 + var c: Vector2 = $canvas.size / 2.0 + var r = c.length() visible_marks_count = 0 for dot in _marks.values(): - var pos = world_to_screen(dot.position.x, dot.position.y) - if pos.x >= 0: - pos.x = fmod(pos.x, dx) - else: - pos.x = -pos.x - 1 - pos.x = int(dx - 1) - fmod(pos.x, dx) - dot.mark.position = pos - dot.mark.visible = c.distance_to(pos) < (r - dot.gap_size) + var scr_pos = world_to_screen(dot.position) + scr_pos.x = posmod(scr_pos.x, dx) + dot.mark.position = scr_pos + dot.mark.visible = c.distance_to(scr_pos) < (r - dot.gap_size) visible_marks_count += int(dot.mark.visible) func _clean_all() -> void: _queue.clear() _cache.clear() - _marks.clear() _req_count = 0 - for c in get_children().filter(func (item): return not item.is_in_group('gui_items')): - remove_child(c) - c.queue_free() # get the tile from queue with the newest timestamp @@ -449,7 +429,7 @@ func lonlat_to_world(lon: float, lat: float) -> Vector2: ## convert lon/lat to screen coords func lonlat_to_screen(lon: float, lat: float) -> Vector2: var w = lonlat_to_world(lon, lat) - return world_to_screen(w.x, w.y) + return world_to_screen(w) ## convert lon/lat to tile coords @@ -466,8 +446,8 @@ func world_to_lonlat(wx: float, wy: float) -> Vector2: ## convert screen coords to lon/lat -func screen_to_lonlat(sx: float, sy: float) -> Vector2: - var w = screen_to_world(_xyz, sx, sy) +func screen_to_lonlat(scr_xy: Vector2) -> Vector2: + var w = screen_to_world(_xyz, scr_xy) return world_to_lonlat(w.x, w.y) @@ -478,12 +458,12 @@ func tile_to_lonlat(tx: float, ty: float, tz: float) -> Vector2: ## convert screen coords to world coords -func screen_to_world(xyz: Vector3, sx: float, sy: float) -> Vector2: +func screen_to_world(xyz: Vector3, s: Vector2) -> Vector2: var n = pow(2.0, xyz.z) var span_w = n * tile_width var span_h = n * tile_height - var px = sx - $canvas.size.x / 2 + span_w / 2 - var py = sy - $canvas.size.y / 2 + span_h / 2 + var px = s.x - $canvas.size.x / 2 + span_w / 2 + var py = s.y - $canvas.size.y / 2 + span_h / 2 var xr = px / span_w var yr = py / span_h var x = (xr * 2.0 - 1.0) + xyz.x @@ -492,15 +472,15 @@ func screen_to_world(xyz: Vector3, sx: float, sy: float) -> Vector2: ## convert screen coords to tile coords -func screen_to_tile(sx: float, sy: float, z: float) -> Vector2: - var world = screen_to_world(_xyz, sx, sy) +func screen_to_tile(scr_xy: Vector2, z: float) -> Vector2: + var world = screen_to_world(_xyz, scr_xy) return world_to_tile(world.x, world.y, z) ## convert tile coords to screen coords func tile_to_screen(tx: float, ty: float, tz: float) -> Vector2: var w = tile_to_world(tx, ty, tz) - return world_to_screen(w.x, w.y) + return world_to_screen(w) ## convert tile coords to world coords @@ -513,30 +493,24 @@ func tile_to_world(tx: float, ty: float, tz: float) -> Vector2: ## convert world coords to tile coords func world_to_tile(wx: float, wy: float, z: float) -> Vector2: - var n: = pow(2.0, floor(z)) - var tx: = ((wx + 1.0) / 2.0) * n - var ty: = ((-wy + 1.0) / 2.0) * n - tx = floor(tx) - ty = floor(ty) + var n: float = pow(2.0, floor(z)) + var tx: float = floor(((wx + 1.0) / 2.0) * n) + var ty: float = floor(((-wy + 1.0) / 2.0) * n) return Vector2(tx, ty) ## convert world coords to screen coords -func world_to_screen(wx: float, wy: float) -> Vector2: +func world_to_screen(pos: Vector2) -> Vector2: var n: = pow(2.0, _xyz.z) - var w: = n * tile_width - var h: = n * tile_height - var xr: = ((wx - _xyz.x) + 1.0) / 2.0 - var yr: = (-(wy - _xyz.y) + 1.0) / 2.0 - var x = w * xr - w / 2.0 + $canvas.size.x / 2.0 - var y = h * yr - h / 2.0 + $canvas.size.y / 2.0 - return Vector2(x, y) + var wh: = Vector2(n * tile_width, n * tile_height) + var rxy: = Vector2(((pos.x - _xyz.x) + 1.0) / 2.0, (-(pos.y - _xyz.y) + 1.0) / 2.0) + return wh * rxy + ($canvas.size - wh) / 2.0 ## get the tile index from xyz tile coords func xyz_to_idx(x: float, y: float, z: float) -> int: var i: = (pow(4.0, z) - 1.0) / 3.0 - var n: = pow(2.0, z) + var n: = pow(2.0, z) return int(i + (y * n + x)) @@ -655,7 +629,7 @@ func find_at_screen_position(screen_pos: Vector2) -> Node: var closest_dot = null var closest_distance = INF for mark in _marks.values(): - var dot_screen_pos = world_to_screen(mark.position.x, mark.position.y) + var dot_screen_pos = world_to_screen(mark.position) var distance = dot_screen_pos.distance_to(screen_pos) if distance < closest_distance: closest_distance = distance From e4814472d982626c5810b73b97645f0691857e9a Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 3 Jun 2025 13:58:44 +0300 Subject: [PATCH 12/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B8=D0=BD=D0=B4=D0=B8=D0=BA=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BA=D0=B0=D1=80=D1=82=D1=8B=20=D0=BA=20=D0=BA?= =?UTF-8?q?=D1=80=D0=B0=D1=8E.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 36 +++++++++++++++++++++++++++--------- scenes/tilemap/tilemap.tscn | 1 + scenes/работа/работа.tscn | 1 + 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 6c15e78..302c103 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -13,7 +13,7 @@ class_name MercatorTileMap _clean_all() queue_redraw() -@export var zoom_step: float = 0.025 +@export var zoom_step: float = 0.1 @export var tile_width: float = 256.0 @export var tile_height: float = 256.0 @export_range(1, 1000, 1) var max_concurrent_requests:int = 5 @@ -79,7 +79,7 @@ var image_load_proc: Callable var now: = 0 var visible_marks_count: = 0 var map_server_available: = false - +var border: ImageTexture ## Вызывается после того, как загрузка плиток завершена signal load_completed() @@ -111,6 +111,13 @@ func get_marks_count(): return _marks.size() func _ready() -> void: + var img: = Image.create($canvas.size.x, $canvas.size.y / 10, false, Image.FORMAT_RGBA8) + var sz = img.get_size() + for x in sz.x: + for y in sz.y: + img.set_pixel(x, y, Color.CORAL) + border = ImageTexture.create_from_image(img) + _xyz.z = min_zoom_level image_type = 'png' $canvas.connect('mouse_entered', func(): _rollover = true) @@ -190,6 +197,7 @@ func is_mark_visible(dot) -> bool: func _input(e) -> void: var lmp = get_local_mouse_position() if not _rollover: + _dragging = false return if e is InputEventMouseButton: if e.pressed: @@ -250,6 +258,7 @@ func set_zoom(zoom: float, pivot: Vector2) -> void: func _draw() -> void: + # Рисование плиток var z = min(max_zoom_level, _xyz.z) var t1 = screen_to_tile(Vector2(0, 0), z) var t2 = screen_to_tile($canvas.size, z) + Vector2(1, 1) @@ -258,6 +267,7 @@ func _draw() -> void: for tx in range(t1.x, t2.x): for ty in range(t1.y, t2.y): _draw_tile(tx, ty, z) + # Рисование отметок var n = pow(2, z) var dx = n * tile_width var c: Vector2 = $canvas.size / 2.0 @@ -269,6 +279,14 @@ func _draw() -> void: dot.mark.position = scr_pos dot.mark.visible = c.distance_to(scr_pos) < (r - dot.gap_size) visible_marks_count += int(dot.mark.visible) + # Рисование границ + var p1 = $canvas.position + var p2 = $canvas.size / Vector2(1, 20) + if is_out_border1 and _dragging: + draw_texture_rect(border, Rect2(p1, p2), false, Color.WHITE, false) + p1.y = p1.y + $canvas.size.y - p2.y + if is_out_border2 and _dragging: + draw_texture_rect(border, Rect2(p1, p2), false, Color.WHITE, false) func _clean_all() -> void: @@ -398,18 +416,18 @@ func check_borders(p1, p2, h): func _draw_tile(tx: int, ty: int, z: float) -> void: - var tz = floor(z) - var p1 = tile_to_screen(tx, ty, z) - var p2 = tile_to_screen(tx + 1, ty + 1, z) - var tile = get_tile(tx, ty, tz) + var tz: float = floor(z) + var p1: = tile_to_screen(tx, ty, z) + var p2: = tile_to_screen(tx + 1, ty + 1, z) + var tile: = get_tile(tx, ty, tz) if tile: if tile.texture: check_borders(p1, p2, $canvas.size.y) draw_texture_rect(tile.texture, Rect2(p1, p2 - p1), false, Color.WHITE, false) else: - var zzz = tz - var txx = tx - var tyy = ty + var zzz: float = tz + var txx: = tx + var tyy: = ty while zzz > 1: zzz -= 1 txx = floor(txx / 2.0) diff --git a/scenes/tilemap/tilemap.tscn b/scenes/tilemap/tilemap.tscn index 3192fa6..40e8eb5 100644 --- a/scenes/tilemap/tilemap.tscn +++ b/scenes/tilemap/tilemap.tscn @@ -28,6 +28,7 @@ size = Vector2(400, 400) [node name="tilemap" type="CanvasGroup" groups=["gui_items"]] script = ExtResource("1_l64tp") +border_scene = "uid://bumg0moa26skt" zoom_step = 0.1 [node name="canvas" type="TextureRect" parent="." groups=["gui_items"]] diff --git a/scenes/работа/работа.tscn b/scenes/работа/работа.tscn index 199f182..442c2dc 100644 --- a/scenes/работа/работа.tscn +++ b/scenes/работа/работа.tscn @@ -86,6 +86,7 @@ self_modulate = Color(1, 1, 1, 0.415686) position = Vector2(360, 360) min_zoom_level = 3 max_zoom_level_server = 11 +az = 3.0 [node name="player" type="AnimationPlayer" parent="tilemap"] libraries = { From 921ac8eef327888ea9e91850d991030cc22b346c Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 3 Jun 2025 14:19:28 +0300 Subject: [PATCH 13/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D0=B8=D0=BD=D0=B4=D0=B8=D0=BA=D0=B0=D1=86=D0=B8?= =?UTF-8?q?=D1=8E=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC=D0=B5=D1=89=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BA=D0=B0=D1=80=D1=82=D1=8B=20=D0=BA=20=D0=BA?= =?UTF-8?q?=D1=80=D0=B0=D1=8E.=20=D0=93=D1=80=D0=B0=D0=B4=D0=B8=D0=B5?= =?UTF-8?q?=D0=BD=D1=82=20=D0=B4=D0=BB=D1=8F=20=D0=B8=D0=BD=D0=B4=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=BE=D1=80=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/tilemap.gd | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index 302c103..4e4ec18 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -79,7 +79,8 @@ var image_load_proc: Callable var now: = 0 var visible_marks_count: = 0 var map_server_available: = false -var border: ImageTexture +var border1: ImageTexture +var border2: ImageTexture ## Вызывается после того, как загрузка плиток завершена signal load_completed() @@ -111,12 +112,13 @@ func get_marks_count(): return _marks.size() func _ready() -> void: - var img: = Image.create($canvas.size.x, $canvas.size.y / 10, false, Image.FORMAT_RGBA8) - var sz = img.get_size() - for x in sz.x: - for y in sz.y: - img.set_pixel(x, y, Color.CORAL) - border = ImageTexture.create_from_image(img) + var img: = Image.create(1, 2, false, Image.FORMAT_RGBA8) + img.set_pixel(0, 0, Color.CORAL) + img.set_pixel(0, 1, Color(1, 1, 1, 0)) + border1 = ImageTexture.create_from_image(img) + img.set_pixel(0, 0, Color(1, 1, 1, 0)) + img.set_pixel(0, 1, Color.CORAL) + border2 = ImageTexture.create_from_image(img) _xyz.z = min_zoom_level image_type = 'png' @@ -283,10 +285,10 @@ func _draw() -> void: var p1 = $canvas.position var p2 = $canvas.size / Vector2(1, 20) if is_out_border1 and _dragging: - draw_texture_rect(border, Rect2(p1, p2), false, Color.WHITE, false) + draw_texture_rect(border1, Rect2(p1, p2), false, Color.WHITE, false) p1.y = p1.y + $canvas.size.y - p2.y if is_out_border2 and _dragging: - draw_texture_rect(border, Rect2(p1, p2), false, Color.WHITE, false) + draw_texture_rect(border2, Rect2(p1, p2), false, Color.WHITE, false) func _clean_all() -> void: From 41d73ac026082bcde46e613c127460930a244e5f Mon Sep 17 00:00:00 2001 From: sasha80 Date: Tue, 3 Jun 2025 14:20:10 +0300 Subject: [PATCH 14/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0.=20=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B4=D0=BB?= =?UTF-8?q?=D1=8F=20=D0=BE=D1=82=D0=BC=D0=B5=D1=82=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/tilemap/dot.png | Bin 0 -> 1113 bytes scenes/tilemap/dot.png.import | 34 ++++++++++++++++++++++++++++++++++ scenes/tilemap/mark.gd | 4 ++++ scenes/tilemap/mark.gd.uid | 1 + scenes/tilemap/mark.tscn | 13 +++++++++++++ 5 files changed, 52 insertions(+) create mode 100644 scenes/tilemap/dot.png create mode 100644 scenes/tilemap/dot.png.import create mode 100644 scenes/tilemap/mark.gd create mode 100644 scenes/tilemap/mark.gd.uid create mode 100644 scenes/tilemap/mark.tscn diff --git a/scenes/tilemap/dot.png b/scenes/tilemap/dot.png new file mode 100644 index 0000000000000000000000000000000000000000..2ad2af72b5b5e6642d45916e89b127dabe1a10e5 GIT binary patch literal 1113 zcmV-f1g86mP)240gym#+8-~H~-cb+jt-h4alAeZay zH^v0;vliV>2!_u9>jXom1Orb6ov*sL&2quaHNlMq!PE@!14g}o7iN9Fo^E4IX3qiu z!6o=v4IzVqWv>N~4hWvTA=p?USo2IU78X3xuY3R2Ex42toVzMGwJP}TvEWLV;93g; z*NF}m5s+WI9smdjao;dzHZFLqO7POO;KfqGI?QOKU9hxK@DMVZb zMxNmLPv|DLOTvxSPfU-)amjd!q3*M>) z^tj_sbBqA$M){(vsCke31aIODF)&5diEsUEJuYh!yXyijJ0X-qhg? zTE}+Y5~$V38FzJVZe=)z%=|tJFBFJ*&6B*TgSx2G7{^-k6Z#zIamHQU_r^-WgVq9? zCwaR%2B?#|nE_FKbK?bu=QxiucUM2?txEHz4(gLs|N$}1~xZoI&_=eXY^0q|?y z)InX;X<`gOrM|24%F3IYXJ)=YCQt`;QKzYN^v#S#3h(N?vbr}nueFHQL0th?7XuK~ z)ftNv_pToDXaGW52X(nsXwWHkKY#&9>w27JDXTNLNby?R&^oA#I!)Tq)fbHj*5fQo z-RjJ1Eva=-SH{)F03@^nLnDIqIIA$vwPme?x~S76SPU(}P*{Nj)1-}vauh?p29Mka zvf4*TPHJa~7MuCS42Wybjn)$#7#b0t$%JLin>whAI!)Zs9vaO?dTz9y=)mO8v;ZzK2>%tGqSp0j>B=u zgS^O-yj`0-?|Z?2Tl`bekCx)s`EbCwC7BTCb Date: Wed, 18 Jun 2025 12:37:53 +0300 Subject: [PATCH 15/21] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D1=8D=D1=82=D0=B0=D0=BF=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=98=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.gd | 78 +++++++++++++++++++++ scenes/pribor-prd-n/pribor-prd-n.gd.uid | 1 + scenes/pribor-prd-n/pribor-prd-n.tscn | 92 +++++++------------------ scenes/pribor-prd-v/pribor_prd_v.gd | 5 +- scenes/контроль/блок-а.tscn | 4 +- scenes/контроль/кассета-у-5.gd | 6 +- scenes/контроль/элемент-в.tscn | 6 +- scripts/prd.gd | 10 +-- 8 files changed, 121 insertions(+), 81 deletions(-) create mode 100644 scenes/pribor-prd-n/pribor-prd-n.gd create mode 100644 scenes/pribor-prd-n/pribor-prd-n.gd.uid diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd new file mode 100644 index 0000000..f5169ab --- /dev/null +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -0,0 +1,78 @@ +@tool +extends "res://scenes/контроль/прибор.gd" + +enum STATE_VAL { + NONE = 0, + GOOD = 1, + ERROR = 2 } + +# Called when the node enters the scene tree for the first time. +func _ready() -> void: + var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) + var unit_prd = network.units[unit_key] + unit_prd.connect('data_received', Callable(self, 'on_data_received')) + unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) + set_default_state() + + +func set_default_state(): + for group in get_tree().get_nodes_in_group('power_amplifier'): + group.state = STATE_VAL.NONE + + +func on_line_changed(unit_prd): + if not unit_prd.online: + set_default_state() + + +func on_data_received(unit_prd): + ## Касета П1 + var ug_online = (unit_prd.status[0] >> 1) & 1 + if ug_online: + const BYTE_DRY_CONTACT: int = 27 + const BIT_MAA2000_1: int = 0 + const BIT_MAA2000_2: int = 1 + const BIT_IP9_50_1: int = 2 + const BIT_IP9_50_2: int = 3 + const BIT_IP12_50_1: int = 4 + + var maa2000_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 + var maa2000_2 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 + var ip9_50_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 + var ip9_50_2 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 + var ip12_50_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1 + + $maa2000_A23.state = STATE_VAL.ERROR if maa2000_1 else STATE_VAL.GOOD + $maa2000_A22.state = STATE_VAL.ERROR if maa2000_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A26.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A23.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A24.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD + else: + $maa2000_A23.state = STATE_VAL.NONE + $maa2000_A22.state = STATE_VAL.NONE + $kasseta_P_1/ref_A26.state = STATE_VAL.NONE + $kasseta_P_1/ref_A23.state = STATE_VAL.NONE + $kasseta_P_1/ref_A24.state = STATE_VAL.NONE + + ## Температуры УМ + const CONST_MIN_TEMP: int = -25 + const MAXIMUM_CODE_ADC: int = 3796 + const MINIMUM_CODE_AD: int = 2660 + const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD) + const TEMPERATURE_UKP_1: int = 47 + const TEMPERATURE_UKP_2: int = 79 + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + + var ukp1_online: int = (unit_prd.status[0] >> 2) & 1 + if ukp1_online: + for i_temp in range(6): + var temperature_ukp_1: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) + var tmp_1: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) + power_amplifier[i_temp].value0 = tmp_1 + + var ukp2_online = (unit_prd.status[0] >> 3) & 1 + if ukp2_online: + for i_temp in range(6): + var temperature_ukp_2: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) + var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) + power_amplifier[i_temp+6].value0 = tmp_2 diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd.uid b/scenes/pribor-prd-n/pribor-prd-n.gd.uid new file mode 100644 index 0000000..b3c223e --- /dev/null +++ b/scenes/pribor-prd-n/pribor-prd-n.gd.uid @@ -0,0 +1 @@ +uid://cto2r4ipew65m diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 718c338..42d66e3 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -1,6 +1,6 @@ [gd_scene load_steps=9 format=3 uid="uid://dnuexoef2nnv5"] -[ext_resource type="Script" uid="uid://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_mcea3"] +[ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_td743"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_lpj3d"] [ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_i1no5"] [ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="5_ej152"] @@ -16,7 +16,16 @@ offset_left = 15.0 offset_top = 30.0 offset_right = 15.0 offset_bottom = 30.0 -script = ExtResource("1_mcea3") +script = ExtResource("1_td743") + +[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")] +layout_mode = 2 +offset_left = 8.0 +offset_top = 877.0 +offset_right = 175.0 +offset_bottom = 949.0 +fname = "MAA2000" +rname = "A23" [node name="maa2000_A22" parent="." instance=ExtResource("2_lpj3d")] layout_mode = 2 @@ -36,15 +45,6 @@ offset_bottom = 877.0 fname = "ДОУ-2" rname = "A5" -[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")] -layout_mode = 2 -offset_left = 8.0 -offset_top = 877.0 -offset_right = 175.0 -offset_bottom = 949.0 -fname = "MAA2000" -rname = "A23" - [node name="dou2_A6" parent="." instance=ExtResource("2_lpj3d")] layout_mode = 2 offset_left = 8.0 @@ -194,16 +194,12 @@ text = "Кассета П-1" horizontal_alignment = 1 vertical_alignment = 1 -[node name="um1535_A7" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 offset_top = 242.0 offset_right = 652.0 offset_bottom = 337.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -211,16 +207,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A7" -[node name="um1535_A8" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 offset_top = 337.0 offset_right = 652.0 offset_bottom = 432.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -228,16 +220,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A8" -[node name="um1535_A9" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 offset_top = 432.0 offset_right = 652.0 offset_bottom = 527.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -245,7 +233,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A9" -[node name="um1535_A10" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 offset_top = 527.0 @@ -262,16 +250,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A10" -[node name="um1535_A11" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 offset_top = 622.0 offset_right = 652.0 offset_bottom = 717.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -279,16 +263,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A11" -[node name="um1535_A12" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 485.0 offset_top = 717.0 offset_right = 652.0 offset_bottom = 812.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -296,18 +276,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A12" -[node name="um1535_A13" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 8.0 offset_top = 242.0 offset_right = 175.0 offset_bottom = 337.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -315,16 +289,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A13" -[node name="um1535_A14" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 8.0 offset_top = 337.0 offset_right = 175.0 offset_bottom = 432.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -332,16 +302,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A14" -[node name="um1535_A15" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 8.0 offset_top = 432.0 offset_right = 175.0 offset_bottom = 527.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -349,16 +315,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A15" -[node name="um1535_A16" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 8.0 offset_top = 527.0 offset_right = 175.0 offset_bottom = 622.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -366,16 +328,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A16" -[node name="um1535_A17" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 8.0 offset_top = 622.0 offset_right = 175.0 offset_bottom = 717.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -383,16 +341,12 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A17" -[node name="um1535_A18" parent="." instance=ExtResource("8_u7eqo")] +[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] layout_mode = 0 offset_left = 8.0 offset_top = 717.0 offset_right = 175.0 offset_bottom = 812.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index 5fcc0fd..c919ba1 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -1,3 +1,4 @@ +@tool extends "res://scenes/контроль/прибор.gd" enum STATE_VAL { @@ -35,8 +36,8 @@ func on_line_changed(unit_prd): func on_data_received(unit_prd): - var ukp1_online = (unit_prd.status[0] >> 2) & 1 - var ukp2_online = (unit_prd.status[0] >> 3) & 1 + var _ukp1_online = (unit_prd.status[0] >> 2) & 1 + var _ukp2_online = (unit_prd.status[0] >> 3) & 1 var ug_online = (unit_prd.status[0] >> 1) & 1 if ug_online: pass diff --git a/scenes/контроль/блок-а.tscn b/scenes/контроль/блок-а.tscn index 896525f..37af25a 100644 --- a/scenes/контроль/блок-а.tscn +++ b/scenes/контроль/блок-а.tscn @@ -219,7 +219,7 @@ vertical_alignment = 1 layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 6 -theme_override_font_sizes/font_size = 22 +theme_override_font_sizes/font_size = 18 horizontal_alignment = 2 vertical_alignment = 1 @@ -231,10 +231,12 @@ size_flags_vertical = 6 layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +max_value = 100.0 [node name="indicator1" parent="margin/vbox/grid1" instance=ExtResource("5_3i5am")] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +max_value = 3000.0 [connection signal="pressed" from="button" to="." method="_on_button_pressed"] diff --git a/scenes/контроль/кассета-у-5.gd b/scenes/контроль/кассета-у-5.gd index bf45fa1..c31de48 100644 --- a/scenes/контроль/кассета-у-5.gd +++ b/scenes/контроль/кассета-у-5.gd @@ -1,3 +1,4 @@ +@tool extends "res://scenes/контроль/кассета.gd" enum STATE_VAL { @@ -39,6 +40,9 @@ func on_data_received(unit_prd): $ref_A35.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 2) & 1 else STATE_VAL.ERROR $ref_A36.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 3) & 1 else STATE_VAL.ERROR if ug_online: - $ref_A31.state = STATE_VAL.GOOD if (unit_prd.status[27] >> 7) & 1 else STATE_VAL.ERROR + var byte_dry_contact: int = 27 + var bit_ip5_25: int = 7 + var ip5_25 = unit_prd.status[byte_dry_contact] >> bit_ip5_25 & 1 + $ref_A31.state = STATE_VAL.ERROR if ip5_25 else STATE_VAL.GOOD else: $ref_A31.state = STATE_VAL.NONE diff --git a/scenes/контроль/элемент-в.tscn b/scenes/контроль/элемент-в.tscn index 702b757..f0ab41b 100644 --- a/scenes/контроль/элемент-в.tscn +++ b/scenes/контроль/элемент-в.tscn @@ -89,7 +89,7 @@ layout_mode = 0 offset_top = 8.0 offset_right = 50.0 offset_bottom = 34.0 -theme_override_font_sizes/font_size = 22 +theme_override_font_sizes/font_size = 18 text = "A1" horizontal_alignment = 1 vertical_alignment = 1 @@ -97,9 +97,9 @@ vertical_alignment = 1 [node name="lbl_fname" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.627451) layout_mode = 0 -offset_top = 111.0 +offset_top = 119.0 offset_right = 84.0 -offset_bottom = 161.0 +offset_bottom = 169.0 rotation = -1.5708 theme_override_font_sizes/font_size = 17 text = "Ячейка" diff --git a/scripts/prd.gd b/scripts/prd.gd index 3627094..98751d3 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -53,7 +53,7 @@ const PRD_NAMES: Array = [ 'уарэп-яу07-4в', 'уарэп-яу07-4к', ] -## Соответствие модулей ФС их нахождуению в приборе ПРД и номеру от КАПС РПБ +## Соответствие модулей ФС их нахождению в приборе ПРД и номеру от КАПС РПБ const FS_PRD: Dictionary = { 0: ['уарэп-яу07-1к', 17], 1: ['уарэп-яу07-4к', 65], @@ -79,10 +79,10 @@ const FS_PRD: Dictionary = { 21: ['уарэп-яу07-4к', 70], 22: ['уарэп-яу07-3к', 54], 23: ['уарэп-яу07-2к', 38], - 24: ['уарэп-яу07-1к', 31], - 25: ['уарэп-яу07-4к', 87], - 26: ['уарэп-яу07-3к', 63], - 27: ['уарэп-яу07-2к', 47], } + 24: ['уарэп-яу07-1к', 23], + 25: ['уарэп-яу07-4к', 71], + 26: ['уарэп-яу07-3к', 55], + 27: ['уарэп-яу07-2к', 39], } var fs_dict: Dictionary ## Словарь с модулями ФС var prd_dict: Dictionary ## Словарь с приборами ПРД From e077ebacb5c59de7a240b0f5c604845cadc8e143 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 12:51:42 +0300 Subject: [PATCH 16/21] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D1=8B=D0=B9=20?= =?UTF-8?q?=D1=8D=D1=82=D0=B0=D0=BF=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=98=D0=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.gd | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd index f5169ab..074d17f 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -26,7 +26,11 @@ func on_line_changed(unit_prd): func on_data_received(unit_prd): - ## Касета П1 + var tree = get_tree() + if not tree: + return + + ## Касета П1 и ИП МА2000 var ug_online = (unit_prd.status[0] >> 1) & 1 if ug_online: const BYTE_DRY_CONTACT: int = 27 @@ -76,3 +80,14 @@ func on_data_received(unit_prd): var temperature_ukp_2: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) power_amplifier[i_temp+6].value0 = tmp_2 + + ## ДКМ + const DKM: int = 28 + const bit_dkm_1: int = 1 + const bit_dkm_2: int = 2 + + var status_dkm_1 = unit_prd.status[DKM] >> bit_dkm_1 & 1 + var status_dkm_2 = unit_prd.status[DKM] >> bit_dkm_2 & 1 + + $dou2_A5.state = STATE_VAL.GOOD if status_dkm_1 else STATE_VAL.ERROR + $dou2_A6.state = STATE_VAL.GOOD if status_dkm_2 else STATE_VAL.ERROR From 8bc3989334cf34481d5bc57c47f88cb91b2c9909 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 13:50:13 +0300 Subject: [PATCH 17/21] =?UTF-8?q?=D0=A3=D0=B4=D0=B0=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=83=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=D1=86=D0=B8?= =?UTF-8?q?=D0=B5=D0=B9=20=D0=A3=D0=9C=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20?= =?UTF-8?q?=D0=AD=D0=9C=D0=A1-=D0=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/prd.gd | 7 ------- 1 file changed, 7 deletions(-) diff --git a/scripts/prd.gd b/scripts/prd.gd index 98751d3..733fee0 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -318,19 +318,12 @@ func update_fs_state(ecms): get_fs_index(ecm, fs_ids) for fs_index in fs_ids: var fs = fs_dict[fs_index] - fs.set_modulation(ecm.modulation) fs.set_um_code(ecm.um) for prd_module in prd_dict.values(): ## Отправка команды на исполнение в ПРД if prd_module.state != PrdState.WORK: continue if not prd_module.unit_yau07.online: continue var um_data_array: Array = [] for fs in prd_module.fs_dic.values(): - var dev_mode = prd_module.yemsg_board.get_dev_mode(fs.index) - var fs_state = 2 - if fs.modulation: - fs_state = 3 - if (dev_mode != fs_state) or (fs_state == 3): - fs.emit_signal('update_modulation') if not prd_module.ug_online: continue if prd_module.set_ug_state: fs.set_um_data(um_data_array, prd_module.unit_yau07) From d850f49e65662615e42f1be5fef34065ad8a70b4 Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 18 Jun 2025 23:19:10 +0300 Subject: [PATCH 18/21] =?UTF-8?q?=D0=9F=D0=BE=D0=BB=D1=83=D1=87=D0=B0?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BC=D0=BE=D1=89=D0=BD=D0=BE=D1=81?= =?UTF-8?q?=D1=82=D0=B5=D0=B9=20=D0=BE=D1=82=20=D0=A3=D0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-k/pribor-prd-k.tscn | 4 +- scenes/pribor-prd-k/pribor_prd_k.gd | 182 ++++++++++++++++++ scenes/pribor-prd-k/pribor_prd_k.gd.uid | 1 + scenes/pribor-prd-n/pribor-prd-n.gd | 150 ++++++++++++--- .../{pribor-prd-n.tscn => pribor_prd_n.tscn} | 135 +++++++++++-- scenes/контроль/кассета-у-5-к.tscn | 12 +- scenes/контроль/кассета-у-5-нв.tscn | 16 +- scenes/контроль/кассета-у-5.gd | 26 +-- 8 files changed, 445 insertions(+), 81 deletions(-) create mode 100644 scenes/pribor-prd-k/pribor_prd_k.gd create mode 100644 scenes/pribor-prd-k/pribor_prd_k.gd.uid rename scenes/pribor-prd-n/{pribor-prd-n.tscn => pribor_prd_n.tscn} (73%) diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index 8dfe864..610e343 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -1,7 +1,7 @@ [gd_scene load_steps=11 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://6m053dpg2lbh" path="res://scenes/контроль/прибор.gd" id="1_ufjwe"] +[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="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="3_wip3a"] @@ -18,7 +18,7 @@ offset_left = 15.0 offset_top = 30.0 offset_right = 15.0 offset_bottom = 30.0 -script = ExtResource("1_ufjwe") +script = ExtResource("1_tpdyp") [node name="kasseta_u5" parent="." instance=ExtResource("2_tb85r")] layout_mode = 0 diff --git a/scenes/pribor-prd-k/pribor_prd_k.gd b/scenes/pribor-prd-k/pribor_prd_k.gd new file mode 100644 index 0000000..34fef09 --- /dev/null +++ b/scenes/pribor-prd-k/pribor_prd_k.gd @@ -0,0 +1,182 @@ +@tool +extends "res://scenes/контроль/прибор.gd" +var timer_03: Timer = Timer.new() +var count_packet_1:int = 0 +var power_array_1: Array = [] +var count_packet_2:int = 0 +var power_array_2: Array = [] + +enum STATE_VAL { + NONE = 0, + GOOD = 1, + ERROR = 2 } + + +func _ready() -> void: + var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) + var unit_prd = network.units[unit_key] + unit_prd.connect('data_received', Callable(self, 'on_data_received')) + unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) + set_default_state() + self.add_child(timer_03) + timer_03.connect('timeout', Callable(self, 'on_timer_03')) + #on_timer_03(unit_key) + + +func set_default_state() -> void: + for group in get_tree().get_nodes_in_group('power_amplifier'): + group.state = STATE_VAL.NONE + + +func on_line_changed(unit_prd: Object): + if not unit_prd.online: + set_default_state() + + +func on_data_received(unit_prd: Object): + var tree = get_tree() + if not tree: + return + + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + ## Контроль ЭМС + const IN_BLANK_PRD: int = 1 + const OUT_BLANK_PRD: int = 13 + const CI_2_OT_FS: int = 9 + const CI_3_OT_FS: int = 10 + const CI_2_B_UF: int = 1 + const CI_3_B_UF: int = 2 + + var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) + var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) + + $Monitoring_panel/in_fs_1.frame = (in_blank >> CI_2_OT_FS) & 1 + $Monitoring_panel/in_fs_2.frame = (in_blank >> CI_3_OT_FS) & 1 + + $Monitoring_panel/out_ems_1.frame = (out_blank >> CI_2_B_UF) & 1 + $Monitoring_panel/out_ems_2.frame = (out_blank >> CI_3_B_UF) & 1 + + ## Мощность УМ от УКП 1 + if (in_blank >> CI_2_OT_FS) & 1: + const bit_dkm_1: int = 1 + check_dkm(unit_prd.status, bit_dkm_1) + const POWER_UKP_1: int = 31 + var arr_power_ukp_1: Array = [] + + if (unit_prd.status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_1 = unit_prd.status.decode_u16(POWER_UKP_1 + 2 * i_power) + arr_power_ukp_1.append(power_ukp_1) + + if count_packet_1 == 0: + power_array_1 = arr_power_ukp_1 + else: + for i in arr_power_ukp_1.size(): + if arr_power_ukp_1[i] > power_array_1[i]: + power_array_1[i] = arr_power_ukp_1[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i].value1 = '%d' % power_array_1[i] + + count_packet_1 += 1 + + ## Мощность УМ от УКП 2 + if (in_blank >> CI_3_OT_FS) & 1: + const bit_dkm_2: int = 2 + check_dkm(unit_prd.status, bit_dkm_2) + const POWER_UKP_2: int = 63 + var arr_power_ukp_2: Array = [] + + if (unit_prd.status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_2 = unit_prd.status.decode_u16(POWER_UKP_2 + 2 * i_power) + arr_power_ukp_2.append(power_ukp_2) + + if count_packet_2 == 0: + power_array_2 = arr_power_ukp_2 + else: + for i in arr_power_ukp_2.size(): + if arr_power_ukp_2[i] > power_array_2[i]: + power_array_2[i] = arr_power_ukp_2[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i+6].value1 = '%d' % power_array_2[i] + + count_packet_2 += 1 + + +## Проверка касет П1 и ИП МА2000 +func check_block_ip(status_prd: PackedByteArray) -> void : + var ug_online: bool = (status_prd[0] >> 1) & 1 + if ug_online: + const BYTE_DRY_CONTACT: int = 27 + const BIT_MAA2000_1: int = 0 + const BIT_MAA2000_2: int = 1 + const BIT_IP9_50_1: int = 2 + const BIT_IP9_50_2: int = 3 + const BIT_IP12_50_1: int = 4 + + var maa2000_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 + var maa2000_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 + var ip9_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 + var ip9_50_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 + var ip12_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1 + + $maa2000_A23.state = STATE_VAL.ERROR if maa2000_1 else STATE_VAL.GOOD + $maa2000_A22.state = STATE_VAL.ERROR if maa2000_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A20.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A21.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A19.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD + else: + $maa2000_A23.state = STATE_VAL.NONE + $maa2000_A22.state = STATE_VAL.NONE + $kasseta_P_1/ref_A19.state = STATE_VAL.NONE + $kasseta_P_1/ref_A20.state = STATE_VAL.NONE + $kasseta_P_1/ref_A21.state = STATE_VAL.NONE + + +## Проверка температур УМ от УКП +func check_temperature_um(status_prd: PackedByteArray) -> void: + const CONST_MIN_TEMP: int = -25 + const MAXIMUM_CODE_ADC: int = 3796 + const MINIMUM_CODE_AD: int = 2660 + const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD) + const TEMPERATURE_UKP_1: int = 47 + const TEMPERATURE_UKP_2: int = 79 + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + + var ukp1_online: int = (status_prd[0] >> 2) & 1 + if ukp1_online: + for i_temp in range(6): + var temperature_ukp_1: int = status_prd.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) + var tmp_1: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) + power_amplifier[i_temp].value0 = tmp_1 + + var ukp2_online = (status_prd[0] >> 3) & 1 + if ukp2_online: + for i_temp in range(6): + var temperature_ukp_2: int = status_prd.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) + var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) + power_amplifier[i_temp+6].value0 = tmp_2 + + +## Проверка ДКМ +func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: + const DKM: int = 28 + + var status_dkm = status_prd[DKM] >> bit_dkm & 1 + + if bit_dkm == 1: + $dou2_A5.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + elif bit_dkm == 2: + $dou2_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + + +#func on_timer_03(unit_name): + #print(unit_name) diff --git a/scenes/pribor-prd-k/pribor_prd_k.gd.uid b/scenes/pribor-prd-k/pribor_prd_k.gd.uid new file mode 100644 index 0000000..3493cb8 --- /dev/null +++ b/scenes/pribor-prd-k/pribor_prd_k.gd.uid @@ -0,0 +1 @@ +uid://cwvikiygf8b1m diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd index 074d17f..2d589c3 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -1,37 +1,116 @@ @tool extends "res://scenes/контроль/прибор.gd" +var timer_03: Timer = Timer.new() +var count_packet_1:int = 0 +var power_array_1: Array = [] +var count_packet_2:int = 0 +var power_array_2: Array = [] enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 } -# Called when the node enters the scene tree for the first time. + func _ready() -> void: var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) var unit_prd = network.units[unit_key] unit_prd.connect('data_received', Callable(self, 'on_data_received')) unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) set_default_state() + self.add_child(timer_03) + timer_03.connect('timeout', Callable(self, 'on_timer_03')) + #on_timer_03(unit_key) -func set_default_state(): +func set_default_state() -> void: for group in get_tree().get_nodes_in_group('power_amplifier'): group.state = STATE_VAL.NONE -func on_line_changed(unit_prd): +func on_line_changed(unit_prd: Object): if not unit_prd.online: set_default_state() -func on_data_received(unit_prd): - var tree = get_tree() - if not tree: +func on_data_received(unit_prd: Object): + if get_tree() == null: return - ## Касета П1 и ИП МА2000 - var ug_online = (unit_prd.status[0] >> 1) & 1 + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + ## Контроль ЭМС + const IN_BLANK_PRD: int = 1 + const OUT_BLANK_PRD: int = 13 + const CI_2_OT_FS: int = 9 + const CI_3_OT_FS: int = 10 + const CI_2_B_UF: int = 1 + const CI_3_B_UF: int = 2 + + var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) + var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) + + $Monitoring_panel/in_fs_1.frame = (in_blank >> CI_2_OT_FS) & 1 + $Monitoring_panel/in_fs_2.frame = (in_blank >> CI_3_OT_FS) & 1 + + $Monitoring_panel/out_ems_1.frame = (out_blank >> CI_2_B_UF) & 1 + $Monitoring_panel/out_ems_2.frame = (out_blank >> CI_3_B_UF) & 1 + + ## Мощность УМ от УКП 1 + if (in_blank >> CI_2_OT_FS) & 1: + const bit_dkm_1: int = 1 + check_dkm(unit_prd.status, bit_dkm_1) + const POWER_UKP_1: int = 31 + var arr_power_ukp_1: Array = [] + + if (unit_prd.status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_1 = unit_prd.status.decode_u16(POWER_UKP_1 + 2 * i_power) + arr_power_ukp_1.append(power_ukp_1) + + if count_packet_1 == 0: + power_array_1 = arr_power_ukp_1 + else: + for i in arr_power_ukp_1.size(): + if arr_power_ukp_1[i] > power_array_1[i]: + power_array_1[i] = arr_power_ukp_1[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i].value1 = '%d' % power_array_1[i] + + count_packet_1 += 1 + + ## Мощность УМ от УКП 2 + if (in_blank >> CI_3_OT_FS) & 1: + const bit_dkm_2: int = 2 + check_dkm(unit_prd.status, bit_dkm_2) + const POWER_UKP_2: int = 63 + var arr_power_ukp_2: Array = [] + + if (unit_prd.status[0] >> 2) & 1: + for i_power in range(6): + var power_ukp_2 = unit_prd.status.decode_u16(POWER_UKP_2 + 2 * i_power) + arr_power_ukp_2.append(power_ukp_2) + + if count_packet_2 == 0: + power_array_2 = arr_power_ukp_2 + else: + for i in arr_power_ukp_2.size(): + if arr_power_ukp_2[i] > power_array_2[i]: + power_array_2[i] = arr_power_ukp_2[i] + + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + for i in 6: + power_amplifier[i+6].value1 = '%d' % power_array_2[i] + + count_packet_2 += 1 + + +## Проверка касет П1 и ИП МА2000 +func check_block_ip(status_prd: PackedByteArray) -> void : + var ug_online: bool = (status_prd[0] >> 1) & 1 if ug_online: const BYTE_DRY_CONTACT: int = 27 const BIT_MAA2000_1: int = 0 @@ -40,25 +119,27 @@ func on_data_received(unit_prd): const BIT_IP9_50_2: int = 3 const BIT_IP12_50_1: int = 4 - var maa2000_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 - var maa2000_2 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 - var ip9_50_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 - var ip9_50_2 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 - var ip12_50_1 = unit_prd.status[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1 + var maa2000_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 + var maa2000_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 + var ip9_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 + var ip9_50_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 + var ip12_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1 $maa2000_A23.state = STATE_VAL.ERROR if maa2000_1 else STATE_VAL.GOOD $maa2000_A22.state = STATE_VAL.ERROR if maa2000_2 else STATE_VAL.GOOD - $kasseta_P_1/ref_A26.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD - $kasseta_P_1/ref_A23.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD - $kasseta_P_1/ref_A24.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A20.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A21.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A19.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD else: $maa2000_A23.state = STATE_VAL.NONE $maa2000_A22.state = STATE_VAL.NONE - $kasseta_P_1/ref_A26.state = STATE_VAL.NONE - $kasseta_P_1/ref_A23.state = STATE_VAL.NONE - $kasseta_P_1/ref_A24.state = STATE_VAL.NONE + $kasseta_P_1/ref_A19.state = STATE_VAL.NONE + $kasseta_P_1/ref_A20.state = STATE_VAL.NONE + $kasseta_P_1/ref_A21.state = STATE_VAL.NONE - ## Температуры УМ + +## Проверка температур УМ от УКП +func check_temperature_um(status_prd: PackedByteArray) -> void: const CONST_MIN_TEMP: int = -25 const MAXIMUM_CODE_ADC: int = 3796 const MINIMUM_CODE_AD: int = 2660 @@ -67,27 +148,34 @@ func on_data_received(unit_prd): const TEMPERATURE_UKP_2: int = 79 var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - var ukp1_online: int = (unit_prd.status[0] >> 2) & 1 + var ukp1_online: int = (status_prd[0] >> 2) & 1 if ukp1_online: for i_temp in range(6): - var temperature_ukp_1: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) + var temperature_ukp_1: int = status_prd.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) var tmp_1: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) power_amplifier[i_temp].value0 = tmp_1 - var ukp2_online = (unit_prd.status[0] >> 3) & 1 + var ukp2_online = (status_prd[0] >> 3) & 1 if ukp2_online: for i_temp in range(6): - var temperature_ukp_2: int = unit_prd.status.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) + var temperature_ukp_2: int = status_prd.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) power_amplifier[i_temp+6].value0 = tmp_2 - ## ДКМ + +## Проверка ДКМ +func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: const DKM: int = 28 - const bit_dkm_1: int = 1 - const bit_dkm_2: int = 2 - var status_dkm_1 = unit_prd.status[DKM] >> bit_dkm_1 & 1 - var status_dkm_2 = unit_prd.status[DKM] >> bit_dkm_2 & 1 + var status_dkm = status_prd[DKM] >> bit_dkm & 1 - $dou2_A5.state = STATE_VAL.GOOD if status_dkm_1 else STATE_VAL.ERROR - $dou2_A6.state = STATE_VAL.GOOD if status_dkm_2 else STATE_VAL.ERROR + if bit_dkm == 1: + $dou2_A5.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + elif bit_dkm == 2: + $dou2_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + + +#func on_timer_03(unit_name): + #print(unit_name) diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor_prd_n.tscn similarity index 73% rename from scenes/pribor-prd-n/pribor-prd-n.tscn rename to scenes/pribor-prd-n/pribor_prd_n.tscn index 42d66e3..ca863ab 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor_prd_n.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=9 format=3 uid="uid://dnuexoef2nnv5"] +[gd_scene load_steps=14 format=3 uid="uid://dnuexoef2nnv5"] [ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_td743"] [ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_lpj3d"] @@ -8,6 +8,31 @@ [ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b1cob"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_dqc3e"] [ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_u7eqo"] +[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_bnnv3"] +[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_is25t"] +[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_meukj"] + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bnnv3"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_xkifg"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("9_bnnv3") +}, { +"duration": 1.0, +"texture": ExtResource("10_is25t") +}, { +"duration": 1.0, +"texture": ExtResource("11_meukj") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] [node name="pribor_prd_n" type="Control"] layout_mode = 3 @@ -113,23 +138,23 @@ text = "Кассета ФС-НД" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 offset_bottom = 182.0 -fname = "Модуль ФС" -rname = "A1" +fname = "Блок ФС-3" +rname = "A3" -[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A1" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 -fname = "Блок ФС-2" -rname = "A3" +fname = "Модуль ФС" +rname = "A1" -[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -137,12 +162,12 @@ offset_bottom = 182.0 fname = "Модуль ФС" rname = "A2" -[node name="ref_A6" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 -fname = "Блок ФС-3" +fname = "Блок ФС-2" rname = "A4" [node name="kasseta_P_1" type="NinePatchRect" parent="."] @@ -159,15 +184,15 @@ patch_margin_bottom = 16 script = ExtResource("6_b1cob") fname = "Кассета П-1" -[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A21" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 offset_bottom = 183.0 -fname = "ИП9-50" -rname = "A19" +fname = "ИП12-50" +rname = "A21" -[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A20" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -175,13 +200,13 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A20" -[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A19" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 offset_bottom = 183.0 -fname = "ИП12-50" -rname = "A21" +fname = "ИП9-50" +rname = "A19" [node name="lbl_fname" type="Label" parent="kasseta_P_1"] self_modulate = Color(1, 1, 1, 0.62) @@ -239,10 +264,6 @@ offset_left = 485.0 offset_top = 527.0 offset_right = 652.0 offset_bottom = 622.0 -value0 = 27.0 -value1 = 56.0 -max_value0 = 100.0 -max_value1 = 100.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -353,3 +374,75 @@ name_min_size0 = Vector2i(35, 20) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A18" + +[node name="Monitoring_panel" type="Panel" parent="."] +layout_mode = 0 +theme_override_styles/panel = SubResource("StyleBoxTexture_bnnv3") + +[node name="in_fs_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="in_fs_1" type="Label" parent="Monitoring_panel/in_fs_1"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="in_fs_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="in_fs_2" type="Label" parent="Monitoring_panel/in_fs_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 2" +horizontal_alignment = 1 + +[node name="out_ems_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_1"] +anchors_preset = -1 +anchor_left = 0.0185185 +anchor_right = 0.0185185 +anchor_bottom = 0.555556 +offset_left = -18.5 +offset_top = 14.0 +offset_right = 17.5 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="out_ems_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_xkifg") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 2" +horizontal_alignment = 1 diff --git a/scenes/контроль/кассета-у-5-к.tscn b/scenes/контроль/кассета-у-5-к.tscn index 5f117cc..f527779 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -25,7 +25,7 @@ text = "Кассета" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A31" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A24" parent="." instance=ExtResource("3_wtlpi")] offset_left = 5.0 offset_top = 32.0 offset_right = 55.0 @@ -33,7 +33,7 @@ offset_bottom = 182.0 fname = "ИП5-25" rname = "A31" -[node name="ref_A37" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A30" parent="." instance=ExtResource("3_wtlpi")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 @@ -41,7 +41,7 @@ offset_bottom = 182.0 fname = "ЯУ-07Б" rname = "A37" -[node name="ref_A33" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A26" parent="." instance=ExtResource("3_wtlpi")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 @@ -49,7 +49,7 @@ offset_bottom = 182.0 fname = "ЭМС-Г" rname = "A33" -[node name="ref_A34" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A27" parent="." instance=ExtResource("3_wtlpi")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -57,7 +57,7 @@ offset_bottom = 182.0 fname = "УГ" rname = "A34" -[node name="ref_A35" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A28" parent="." instance=ExtResource("3_wtlpi")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 @@ -65,7 +65,7 @@ offset_bottom = 182.0 fname = "УКП" rname = "A36" -[node name="ref_A36" parent="." instance=ExtResource("3_wtlpi")] +[node name="ref_A29" parent="." instance=ExtResource("3_wtlpi")] offset_left = 254.0 offset_top = 32.0 offset_right = 304.0 diff --git a/scenes/контроль/кассета-у-5-нв.tscn b/scenes/контроль/кассета-у-5-нв.tscn index d1ed6ce..c79ec09 100644 --- a/scenes/контроль/кассета-у-5-нв.tscn +++ b/scenes/контроль/кассета-у-5-нв.tscn @@ -25,7 +25,7 @@ text = "Кассета" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A31" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A24" parent="." instance=ExtResource("3_picsk")] offset_left = 5.0 offset_top = 32.0 offset_right = 55.0 @@ -33,7 +33,7 @@ offset_bottom = 182.0 fname = "ИП5-25" rname = "A24" -[node name="ref_A37" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A30" parent="." instance=ExtResource("3_picsk")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 @@ -41,7 +41,7 @@ offset_bottom = 182.0 fname = "ЯУ-07Б" rname = "A30" -[node name="ref_A33" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A26" parent="." instance=ExtResource("3_picsk")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 @@ -49,7 +49,7 @@ offset_bottom = 182.0 fname = "ЭМС-Г" rname = "A26" -[node name="ref_A34" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A27" parent="." instance=ExtResource("3_picsk")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -57,18 +57,18 @@ offset_bottom = 182.0 fname = "УГ" rname = "A27" -[node name="ref_A35" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A28" parent="." instance=ExtResource("3_picsk")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A29" +rname = "A28" -[node name="ref_A36" parent="." instance=ExtResource("3_picsk")] +[node name="ref_A29" parent="." instance=ExtResource("3_picsk")] offset_left = 254.0 offset_top = 32.0 offset_right = 304.0 offset_bottom = 182.0 fname = "УКП" -rname = "A28" +rname = "A29" diff --git a/scenes/контроль/кассета-у-5.gd b/scenes/контроль/кассета-у-5.gd index c31de48..252cc41 100644 --- a/scenes/контроль/кассета-у-5.gd +++ b/scenes/контроль/кассета-у-5.gd @@ -16,12 +16,12 @@ func _ready() -> void: func set_default_state(): - $ref_A37.state = STATE_VAL.ERROR - $ref_A31.state = STATE_VAL.NONE - $ref_A33.state = STATE_VAL.NONE - $ref_A34.state = STATE_VAL.NONE - $ref_A35.state = STATE_VAL.NONE - $ref_A36.state = STATE_VAL.NONE + $ref_A30.state = STATE_VAL.ERROR # ЯУ-07Б + $ref_A24.state = STATE_VAL.NONE # ИП5-25 + $ref_A26.state = STATE_VAL.NONE # ЭМС-Г + $ref_A27.state = STATE_VAL.NONE # УГ + $ref_A28.state = STATE_VAL.NONE # УКП + $ref_A29.state = STATE_VAL.NONE # УКП func on_line_changed(unit_prd): @@ -30,19 +30,19 @@ func on_line_changed(unit_prd): func on_data_received(unit_prd): - $ref_A37.state = STATE_VAL.GOOD + $ref_A30.state = STATE_VAL.GOOD var ems_online = unit_prd.status[0] & 1 var bit_load = 4 var ems_load = (unit_prd.status[0] >> bit_load) & 1 var ug_online = (unit_prd.status[0] >> 1) & 1 - $ref_A33.state = STATE_VAL.GOOD if ems_online and ems_load else STATE_VAL.ERROR - $ref_A34.state = STATE_VAL.GOOD if ug_online else STATE_VAL.ERROR - $ref_A35.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 2) & 1 else STATE_VAL.ERROR - $ref_A36.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 3) & 1 else STATE_VAL.ERROR + $ref_A26.state = STATE_VAL.GOOD if ems_online and ems_load else STATE_VAL.ERROR + $ref_A27.state = STATE_VAL.GOOD if ug_online else STATE_VAL.ERROR + $ref_A28.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 2) & 1 else STATE_VAL.ERROR + $ref_A29.state = STATE_VAL.GOOD if (unit_prd.status[0] >> 3) & 1 else STATE_VAL.ERROR if ug_online: var byte_dry_contact: int = 27 var bit_ip5_25: int = 7 var ip5_25 = unit_prd.status[byte_dry_contact] >> bit_ip5_25 & 1 - $ref_A31.state = STATE_VAL.ERROR if ip5_25 else STATE_VAL.GOOD + $ref_A24.state = STATE_VAL.ERROR if ip5_25 else STATE_VAL.GOOD else: - $ref_A31.state = STATE_VAL.NONE + $ref_A24.state = STATE_VAL.NONE From cd46491a1fd2566a02b1db716022c7e8bff27cfe Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 20 Jun 2025 13:44:18 +0300 Subject: [PATCH 19/21] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=B4=D0=BB=D1=8F=20=D0=B0=D1=81=D1=82=D1=80=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-k/kasseta-fs-kd.tscn | 16 +- scenes/pribor-prd-k/pribor-prd-k.tscn | 90 +-------- scenes/pribor-prd-k/pribor_prd_k.gd | 190 ++---------------- scenes/pribor-prd-n/kasseta-fs-nd.tscn | 10 +- .../{pribor_prd_n.tscn => pribor-prd-n.tscn} | 90 ++++----- .../{pribor-prd-n.gd => pribor_prd_n.gd} | 23 ++- ...ribor-prd-n.gd.uid => pribor_prd_n.gd.uid} | 0 scenes/pribor-prd-v/pribor-prd-v.tscn | 70 ------- scenes/контроль/кассета-п-2.tscn | 8 +- scenes/контроль/кассета-у-5-к.tscn | 6 +- scenes/контроль/кассета-у-5-нв.tscn | 2 +- scripts/sch3.gd | 2 +- 12 files changed, 107 insertions(+), 400 deletions(-) rename scenes/pribor-prd-n/{pribor_prd_n.tscn => pribor-prd-n.tscn} (86%) rename scenes/pribor-prd-n/{pribor-prd-n.gd => pribor_prd_n.gd} (95%) rename scenes/pribor-prd-n/{pribor-prd-n.gd.uid => pribor_prd_n.gd.uid} (100%) diff --git a/scenes/pribor-prd-k/kasseta-fs-kd.tscn b/scenes/pribor-prd-k/kasseta-fs-kd.tscn index dd269f6..9bab5bf 100644 --- a/scenes/pribor-prd-k/kasseta-fs-kd.tscn +++ b/scenes/pribor-prd-k/kasseta-fs-kd.tscn @@ -22,7 +22,7 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 303.0 offset_bottom = 33.0 -text = "Кассета" +text = "Кассета ФС-КД" horizontal_alignment = 1 vertical_alignment = 1 @@ -31,23 +31,23 @@ offset_left = 5.0 offset_top = 33.0 offset_right = 55.0 offset_bottom = 183.0 -fname = "Модуль ФС" -rname = "A1" +fname = "Блок ФС-1" +rname = "A4" [node name="ref_A3" parent="." instance=ExtResource("3_kqnvt")] offset_left = 55.0 offset_top = 33.0 offset_right = 105.0 offset_bottom = 183.0 -fname = "Блок ФС-1" -rname = "A4" +fname = "Модуль ФС" +rname = "A1" [node name="ref_A4" parent="." instance=ExtResource("3_kqnvt")] offset_left = 105.0 offset_top = 33.0 offset_right = 155.0 offset_bottom = 183.0 -fname = "Модуль ФС" +fname = "Блок ФС-2" rname = "A2" [node name="ref_A6" parent="." instance=ExtResource("3_kqnvt")] @@ -55,7 +55,7 @@ offset_left = 155.0 offset_top = 33.0 offset_right = 205.0 offset_bottom = 183.0 -fname = "Блок ФС-6" +fname = "Модуль ФС" rname = "A5" [node name="ref_A5" parent="." instance=ExtResource("3_kqnvt")] @@ -71,5 +71,5 @@ offset_left = 255.0 offset_top = 33.0 offset_right = 305.0 offset_bottom = 183.0 -fname = "Блок ФС-2" +fname = "Блок ФС-6" rname = "A6" diff --git a/scenes/pribor-prd-k/pribor-prd-k.tscn b/scenes/pribor-prd-k/pribor-prd-k.tscn index 610e343..ca1858b 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.tscn +++ b/scenes/pribor-prd-k/pribor-prd-k.tscn @@ -36,7 +36,7 @@ offset_top = 907.0 offset_right = 652.0 offset_bottom = 949.0 fname = "MAA2000" -rname = "A27" +rname = "A28" [node name="dou2_A7" parent="." instance=ExtResource("1_8dmgr")] layout_mode = 0 @@ -54,7 +54,7 @@ offset_top = 907.0 offset_right = 175.0 offset_bottom = 949.0 fname = "MAA2000" -rname = "A28" +rname = "A27" [node name="dou2_A8" parent="." instance=ExtResource("1_8dmgr")] layout_mode = 0 @@ -95,12 +95,6 @@ offset_left = 485.0 offset_top = 242.0 offset_right = 652.0 offset_bottom = 337.0 -value0 = 28.0 -value1 = 70.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -114,12 +108,6 @@ offset_left = 485.0 offset_top = 337.0 offset_right = 652.0 offset_bottom = 432.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -133,12 +121,6 @@ offset_left = 485.0 offset_top = 432.0 offset_right = 652.0 offset_bottom = 527.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -152,12 +134,6 @@ offset_left = 485.0 offset_top = 527.0 offset_right = 652.0 offset_bottom = 622.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -171,12 +147,6 @@ offset_left = 485.0 offset_top = 622.0 offset_right = 652.0 offset_bottom = 717.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -190,12 +160,6 @@ offset_left = 485.0 offset_top = 717.0 offset_right = 652.0 offset_bottom = 812.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -209,12 +173,6 @@ offset_left = 485.0 offset_top = 812.0 offset_right = 652.0 offset_bottom = 907.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -228,12 +186,6 @@ offset_left = 8.0 offset_top = 242.0 offset_right = 175.0 offset_bottom = 337.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -247,12 +199,6 @@ offset_left = 8.0 offset_top = 337.0 offset_right = 173.0 offset_bottom = 432.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -266,12 +212,6 @@ offset_left = 8.0 offset_top = 432.0 offset_right = 175.0 offset_bottom = 527.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -285,12 +225,6 @@ offset_left = 8.0 offset_top = 527.0 offset_right = 175.0 offset_bottom = 622.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -304,12 +238,6 @@ offset_left = 8.0 offset_top = 622.0 offset_right = 175.0 offset_bottom = 717.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -323,12 +251,6 @@ offset_left = 8.0 offset_top = 717.0 offset_right = 175.0 offset_bottom = 812.0 -value0 = 28.0 -value1 = 57.0 -max_value0 = 99.0 -max_value1 = 99.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -363,8 +285,8 @@ offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 offset_bottom = 183.0 -fname = "ИП12-50" -rname = "A26" +fname = "ИП9-50" +rname = "A23" [node name="ref_A23" parent="kasseta_p_1" instance=ExtResource("8_la5yt")] offset_left = 59.0 @@ -379,8 +301,8 @@ offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 offset_bottom = 183.0 -fname = "ИП9-50" -rname = "A23" +fname = "ИП12-50" +rname = "A26" [node name="lbl_fname" type="Label" parent="kasseta_p_1"] self_modulate = Color(1, 1, 1, 0.62) diff --git a/scenes/pribor-prd-k/pribor_prd_k.gd b/scenes/pribor-prd-k/pribor_prd_k.gd index 34fef09..0a10721 100644 --- a/scenes/pribor-prd-k/pribor_prd_k.gd +++ b/scenes/pribor-prd-k/pribor_prd_k.gd @@ -1,10 +1,5 @@ @tool extends "res://scenes/контроль/прибор.gd" -var timer_03: Timer = Timer.new() -var count_packet_1:int = 0 -var power_array_1: Array = [] -var count_packet_2:int = 0 -var power_array_2: Array = [] enum STATE_VAL { NONE = 0, @@ -13,170 +8,25 @@ enum STATE_VAL { func _ready() -> void: - var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) - var unit_prd = network.units[unit_key] - unit_prd.connect('data_received', Callable(self, 'on_data_received')) - unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) - set_default_state() - self.add_child(timer_03) - timer_03.connect('timeout', Callable(self, 'on_timer_03')) - #on_timer_03(unit_key) + pass + #var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) + #var unit_prd = network.units[unit_key] + #unit_prd.connect('data_received', Callable(self, 'on_data_received')) + #unit_prd.connect('line_changed', Callable(self, 'on_line_changed')) + #set_default_state() -func set_default_state() -> void: - for group in get_tree().get_nodes_in_group('power_amplifier'): - group.state = STATE_VAL.NONE - - -func on_line_changed(unit_prd: Object): - if not unit_prd.online: - set_default_state() - - -func on_data_received(unit_prd: Object): - var tree = get_tree() - if not tree: - return - - check_block_ip(unit_prd.status) - check_temperature_um(unit_prd.status) - - ## Контроль ЭМС - const IN_BLANK_PRD: int = 1 - const OUT_BLANK_PRD: int = 13 - const CI_2_OT_FS: int = 9 - const CI_3_OT_FS: int = 10 - const CI_2_B_UF: int = 1 - const CI_3_B_UF: int = 2 - - var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) - var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) - - $Monitoring_panel/in_fs_1.frame = (in_blank >> CI_2_OT_FS) & 1 - $Monitoring_panel/in_fs_2.frame = (in_blank >> CI_3_OT_FS) & 1 - - $Monitoring_panel/out_ems_1.frame = (out_blank >> CI_2_B_UF) & 1 - $Monitoring_panel/out_ems_2.frame = (out_blank >> CI_3_B_UF) & 1 - - ## Мощность УМ от УКП 1 - if (in_blank >> CI_2_OT_FS) & 1: - const bit_dkm_1: int = 1 - check_dkm(unit_prd.status, bit_dkm_1) - const POWER_UKP_1: int = 31 - var arr_power_ukp_1: Array = [] - - if (unit_prd.status[0] >> 2) & 1: - for i_power in range(6): - var power_ukp_1 = unit_prd.status.decode_u16(POWER_UKP_1 + 2 * i_power) - arr_power_ukp_1.append(power_ukp_1) - - if count_packet_1 == 0: - power_array_1 = arr_power_ukp_1 - else: - for i in arr_power_ukp_1.size(): - if arr_power_ukp_1[i] > power_array_1[i]: - power_array_1[i] = arr_power_ukp_1[i] - - var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - for i in 6: - power_amplifier[i].value1 = '%d' % power_array_1[i] - - count_packet_1 += 1 - - ## Мощность УМ от УКП 2 - if (in_blank >> CI_3_OT_FS) & 1: - const bit_dkm_2: int = 2 - check_dkm(unit_prd.status, bit_dkm_2) - const POWER_UKP_2: int = 63 - var arr_power_ukp_2: Array = [] - - if (unit_prd.status[0] >> 2) & 1: - for i_power in range(6): - var power_ukp_2 = unit_prd.status.decode_u16(POWER_UKP_2 + 2 * i_power) - arr_power_ukp_2.append(power_ukp_2) - - if count_packet_2 == 0: - power_array_2 = arr_power_ukp_2 - else: - for i in arr_power_ukp_2.size(): - if arr_power_ukp_2[i] > power_array_2[i]: - power_array_2[i] = arr_power_ukp_2[i] - - var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - for i in 6: - power_amplifier[i+6].value1 = '%d' % power_array_2[i] - - count_packet_2 += 1 - - -## Проверка касет П1 и ИП МА2000 -func check_block_ip(status_prd: PackedByteArray) -> void : - var ug_online: bool = (status_prd[0] >> 1) & 1 - if ug_online: - const BYTE_DRY_CONTACT: int = 27 - const BIT_MAA2000_1: int = 0 - const BIT_MAA2000_2: int = 1 - const BIT_IP9_50_1: int = 2 - const BIT_IP9_50_2: int = 3 - const BIT_IP12_50_1: int = 4 - - var maa2000_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 - var maa2000_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 - var ip9_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 - var ip9_50_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 - var ip12_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1 - - $maa2000_A23.state = STATE_VAL.ERROR if maa2000_1 else STATE_VAL.GOOD - $maa2000_A22.state = STATE_VAL.ERROR if maa2000_2 else STATE_VAL.GOOD - $kasseta_P_1/ref_A20.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD - $kasseta_P_1/ref_A21.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD - $kasseta_P_1/ref_A19.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD - else: - $maa2000_A23.state = STATE_VAL.NONE - $maa2000_A22.state = STATE_VAL.NONE - $kasseta_P_1/ref_A19.state = STATE_VAL.NONE - $kasseta_P_1/ref_A20.state = STATE_VAL.NONE - $kasseta_P_1/ref_A21.state = STATE_VAL.NONE - - -## Проверка температур УМ от УКП -func check_temperature_um(status_prd: PackedByteArray) -> void: - const CONST_MIN_TEMP: int = -25 - const MAXIMUM_CODE_ADC: int = 3796 - const MINIMUM_CODE_AD: int = 2660 - const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD) - const TEMPERATURE_UKP_1: int = 47 - const TEMPERATURE_UKP_2: int = 79 - var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') - - var ukp1_online: int = (status_prd[0] >> 2) & 1 - if ukp1_online: - for i_temp in range(6): - var temperature_ukp_1: int = status_prd.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) - var tmp_1: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) - power_amplifier[i_temp].value0 = tmp_1 - - var ukp2_online = (status_prd[0] >> 3) & 1 - if ukp2_online: - for i_temp in range(6): - var temperature_ukp_2: int = status_prd.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) - var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) - power_amplifier[i_temp+6].value0 = tmp_2 - - -## Проверка ДКМ -func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: - const DKM: int = 28 - - var status_dkm = status_prd[DKM] >> bit_dkm & 1 - - if bit_dkm == 1: - $dou2_A5.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR - $kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR - elif bit_dkm == 2: - $dou2_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR - $kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR - - -#func on_timer_03(unit_name): - #print(unit_name) +func set_default_state(): + $utm80_A9.state = STATE_VAL.NONE + $um1535_A10.state = STATE_VAL.NONE + $um1535_A11.state = STATE_VAL.NONE + $um1535_A12.state = STATE_VAL.NONE + $um1535_A13.state = STATE_VAL.NONE + $um1535_A14.state = STATE_VAL.NONE + $um1535_A15.state = STATE_VAL.NONE + $um1535_A16.state = STATE_VAL.NONE + $um1535_A17.state = STATE_VAL.NONE + $um1535_A18.state = STATE_VAL.NONE + $um1535_A19.state = STATE_VAL.NONE + $um1535_A20.state = STATE_VAL.NONE + $um1535_A21.state = STATE_VAL.NONE diff --git a/scenes/pribor-prd-n/kasseta-fs-nd.tscn b/scenes/pribor-prd-n/kasseta-fs-nd.tscn index 1af690c..b69f57e 100644 --- a/scenes/pribor-prd-n/kasseta-fs-nd.tscn +++ b/scenes/pribor-prd-n/kasseta-fs-nd.tscn @@ -22,7 +22,7 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 303.0 offset_bottom = 33.0 -text = "Кассета" +text = "Кассета ФС-ВД" horizontal_alignment = 1 vertical_alignment = 1 @@ -31,16 +31,16 @@ offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 offset_bottom = 182.0 -fname = "Модуль ФС" -rname = "A1" +fname = "Блок ФС-3" +rname = "A3" [node name="ref_A3" parent="." instance=ExtResource("2_mkgdh")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 offset_bottom = 182.0 -fname = "Блок ФС-3" -rname = "A3" +fname = "Модуль ФС" +rname = "A1" [node name="ref_A4" parent="." instance=ExtResource("2_mkgdh")] offset_left = 155.0 diff --git a/scenes/pribor-prd-n/pribor_prd_n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn similarity index 86% rename from scenes/pribor-prd-n/pribor_prd_n.tscn rename to scenes/pribor-prd-n/pribor-prd-n.tscn index ca863ab..1e23a7e 100644 --- a/scenes/pribor-prd-n/pribor_prd_n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -1,16 +1,16 @@ [gd_scene load_steps=14 format=3 uid="uid://dnuexoef2nnv5"] -[ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_td743"] -[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_lpj3d"] -[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_i1no5"] -[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="5_ej152"] -[ext_resource type="Script" uid="uid://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="5_hne5j"] -[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b1cob"] -[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_dqc3e"] -[ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_u7eqo"] -[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_bnnv3"] -[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_is25t"] -[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_meukj"] +[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://dow4nqi6hbak8" path="res://scenes/контроль/кассета-у-5.gd" id="5_1wf07"] +[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b5wvk"] +[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_eoqf2"] +[ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="8_sia5h"] +[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_k1x0o"] +[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_7dcjd"] +[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_ius1v"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_bnnv3"] @@ -18,13 +18,13 @@ animations = [{ "frames": [{ "duration": 1.0, -"texture": ExtResource("9_bnnv3") +"texture": ExtResource("9_k1x0o") }, { "duration": 1.0, -"texture": ExtResource("10_is25t") +"texture": ExtResource("10_7dcjd") }, { "duration": 1.0, -"texture": ExtResource("11_meukj") +"texture": ExtResource("11_ius1v") }, { "duration": 1.0, "texture": null @@ -41,9 +41,9 @@ offset_left = 15.0 offset_top = 30.0 offset_right = 15.0 offset_bottom = 30.0 -script = ExtResource("1_td743") +script = ExtResource("1_bnnv3") -[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")] +[node name="maa2000_A23" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 8.0 offset_top = 877.0 @@ -52,7 +52,7 @@ offset_bottom = 949.0 fname = "MAA2000" rname = "A23" -[node name="maa2000_A22" parent="." instance=ExtResource("2_lpj3d")] +[node name="maa2000_A22" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 485.0 offset_top = 877.0 @@ -61,7 +61,7 @@ offset_bottom = 949.0 fname = "MAA2000" rname = "A22" -[node name="dou2_A5" parent="." instance=ExtResource("2_lpj3d")] +[node name="dou2_A5" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 485.0 offset_top = 812.0 @@ -70,7 +70,7 @@ offset_bottom = 877.0 fname = "ДОУ-2" rname = "A5" -[node name="dou2_A6" parent="." instance=ExtResource("2_lpj3d")] +[node name="dou2_A6" parent="." instance=ExtResource("2_is25t")] layout_mode = 2 offset_left = 8.0 offset_top = 812.0 @@ -85,7 +85,7 @@ offset_left = 175.0 offset_top = 812.0 offset_right = 485.0 offset_bottom = 949.0 -texture = ExtResource("4_i1no5") +texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 @@ -103,13 +103,13 @@ text = "Панель horizontal_alignment = 1 vertical_alignment = 1 -[node name="kasseta_U5" parent="." instance=ExtResource("5_ej152")] +[node name="kasseta_U5" parent="." instance=ExtResource("4_xkifg")] layout_mode = 0 offset_left = 175.0 offset_top = 242.0 offset_right = 485.0 offset_bottom = 432.0 -script = ExtResource("5_hne5j") +script = ExtResource("5_1wf07") fname = "Кассета У5" [node name="kasseta_FS_ND" type="NinePatchRect" parent="."] @@ -118,12 +118,12 @@ offset_left = 175.0 offset_top = 432.0 offset_right = 485.0 offset_bottom = 622.0 -texture = ExtResource("4_i1no5") +texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -script = ExtResource("6_b1cob") +script = ExtResource("6_b5wvk") fname = "Кассета ФС-НД" metadata/Fname = "" @@ -138,7 +138,7 @@ text = "Кассета ФС-НД" horizontal_alignment = 1 vertical_alignment = 1 -[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A3" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 55.0 offset_top = 32.0 offset_right = 105.0 @@ -146,7 +146,7 @@ offset_bottom = 182.0 fname = "Блок ФС-3" rname = "A3" -[node name="ref_A1" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A1" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 105.0 offset_top = 32.0 offset_right = 155.0 @@ -154,7 +154,7 @@ offset_bottom = 182.0 fname = "Модуль ФС" rname = "A1" -[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A2" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 155.0 offset_top = 32.0 offset_right = 205.0 @@ -162,7 +162,7 @@ offset_bottom = 182.0 fname = "Модуль ФС" rname = "A2" -[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")] +[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_eoqf2")] offset_left = 205.0 offset_top = 32.0 offset_right = 255.0 @@ -176,15 +176,15 @@ offset_left = 175.0 offset_top = 622.0 offset_right = 485.0 offset_bottom = 812.0 -texture = ExtResource("4_i1no5") +texture = ExtResource("3_meukj") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -script = ExtResource("6_b1cob") +script = ExtResource("6_b5wvk") fname = "Кассета П-1" -[node name="ref_A21" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A21" parent="kasseta_P_1" instance=ExtResource("7_eoqf2")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 @@ -192,7 +192,7 @@ offset_bottom = 183.0 fname = "ИП12-50" rname = "A21" -[node name="ref_A20" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A20" parent="kasseta_P_1" instance=ExtResource("7_eoqf2")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -200,7 +200,7 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A20" -[node name="ref_A19" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")] +[node name="ref_A19" parent="kasseta_P_1" instance=ExtResource("7_eoqf2")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 @@ -219,7 +219,7 @@ text = "Кассета П-1" horizontal_alignment = 1 vertical_alignment = 1 -[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 242.0 @@ -232,7 +232,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A7" -[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 337.0 @@ -245,7 +245,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A8" -[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 432.0 @@ -258,7 +258,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A9" -[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 527.0 @@ -271,7 +271,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A10" -[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 622.0 @@ -284,7 +284,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A11" -[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 485.0 offset_top = 717.0 @@ -297,7 +297,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A12" -[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 8.0 offset_top = 242.0 @@ -310,7 +310,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A13" -[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 8.0 offset_top = 337.0 @@ -323,7 +323,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A14" -[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 8.0 offset_top = 432.0 @@ -336,7 +336,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A15" -[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 8.0 offset_top = 527.0 @@ -349,7 +349,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A16" -[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 8.0 offset_top = 622.0 @@ -362,7 +362,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A17" -[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_u7eqo")] +[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_sia5h")] layout_mode = 0 offset_left = 8.0 offset_top = 717.0 diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor_prd_n.gd similarity index 95% rename from scenes/pribor-prd-n/pribor-prd-n.gd rename to scenes/pribor-prd-n/pribor_prd_n.gd index 2d589c3..89f8775 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor_prd_n.gd @@ -1,5 +1,15 @@ @tool extends "res://scenes/контроль/прибор.gd" + +const IN_BLANK_PRD: int = 1 +const OUT_BLANK_PRD: int = 13 +const CI_2_OT_FS: int = 9 +const CI_3_OT_FS: int = 10 +const CI_2_B_UF: int = 1 +const CI_3_B_UF: int = 2 +const POWER_UKP_1: int = 31 +const POWER_UKP_2: int = 63 + var timer_03: Timer = Timer.new() var count_packet_1:int = 0 var power_array_1: Array = [] @@ -34,19 +44,14 @@ func on_line_changed(unit_prd: Object): func on_data_received(unit_prd: Object): - if get_tree() == null: + if not is_inside_tree(): return check_block_ip(unit_prd.status) check_temperature_um(unit_prd.status) ## Контроль ЭМС - const IN_BLANK_PRD: int = 1 - const OUT_BLANK_PRD: int = 13 - const CI_2_OT_FS: int = 9 - const CI_3_OT_FS: int = 10 - const CI_2_B_UF: int = 1 - const CI_3_B_UF: int = 2 + #_process_ems_data(unit_prd) var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) @@ -61,7 +66,7 @@ func on_data_received(unit_prd: Object): if (in_blank >> CI_2_OT_FS) & 1: const bit_dkm_1: int = 1 check_dkm(unit_prd.status, bit_dkm_1) - const POWER_UKP_1: int = 31 + var arr_power_ukp_1: Array = [] if (unit_prd.status[0] >> 2) & 1: @@ -86,7 +91,7 @@ func on_data_received(unit_prd: Object): if (in_blank >> CI_3_OT_FS) & 1: const bit_dkm_2: int = 2 check_dkm(unit_prd.status, bit_dkm_2) - const POWER_UKP_2: int = 63 + var arr_power_ukp_2: Array = [] if (unit_prd.status[0] >> 2) & 1: diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd.uid b/scenes/pribor-prd-n/pribor_prd_n.gd.uid similarity index 100% rename from scenes/pribor-prd-n/pribor-prd-n.gd.uid rename to scenes/pribor-prd-n/pribor_prd_n.gd.uid diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index 31a0b30..b6b22cb 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -151,10 +151,6 @@ offset_left = 485.0 offset_top = 242.0 offset_right = 652.0 offset_bottom = 337.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 step0 = 1.0 step1 = 1.0 value_name0 = "°C" @@ -170,12 +166,6 @@ offset_left = 485.0 offset_top = 337.0 offset_right = 652.0 offset_bottom = 432.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -189,12 +179,6 @@ offset_left = 485.0 offset_top = 432.0 offset_right = 652.0 offset_bottom = 527.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -208,12 +192,6 @@ offset_left = 485.0 offset_top = 527.0 offset_right = 652.0 offset_bottom = 622.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -227,12 +205,6 @@ offset_left = 485.0 offset_top = 622.0 offset_right = 652.0 offset_bottom = 717.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -246,12 +218,6 @@ offset_left = 485.0 offset_top = 717.0 offset_right = 652.0 offset_bottom = 812.0 -value0 = 91.0 -value1 = 22.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -265,12 +231,6 @@ offset_left = 8.0 offset_top = 242.0 offset_right = 175.0 offset_bottom = 337.0 -value0 = 91.0 -value1 = 33.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -284,12 +244,6 @@ offset_left = 8.0 offset_top = 337.0 offset_right = 175.0 offset_bottom = 432.0 -value0 = 91.0 -value1 = 33.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -303,12 +257,6 @@ offset_left = 8.0 offset_top = 432.0 offset_right = 175.0 offset_bottom = 527.0 -value0 = 91.0 -value1 = 33.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -322,12 +270,6 @@ offset_left = 8.0 offset_top = 527.0 offset_right = 175.0 offset_bottom = 622.0 -value0 = 91.0 -value1 = 33.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -341,12 +283,6 @@ offset_left = 8.0 offset_top = 622.0 offset_right = 175.0 offset_bottom = 717.0 -value0 = 91.0 -value1 = 33.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) @@ -360,12 +296,6 @@ offset_left = 8.0 offset_top = 717.0 offset_right = 175.0 offset_bottom = 812.0 -value0 = 91.0 -value1 = 33.0 -max_value0 = 100.0 -max_value1 = 100.0 -step0 = 1.0 -step1 = 1.0 value_name0 = "°C" value_name1 = "P, %" name_min_size0 = Vector2i(35, 20) diff --git a/scenes/контроль/кассета-п-2.tscn b/scenes/контроль/кассета-п-2.tscn index bfa0835..077b080 100644 --- a/scenes/контроль/кассета-п-2.tscn +++ b/scenes/контроль/кассета-п-2.tscn @@ -19,16 +19,16 @@ offset_left = 10.0 offset_top = 30.0 offset_right = 60.0 offset_bottom = 180.0 -fname = "ИП12-50" -rname = "A25" +fname = "ИП9-50" +rname = "A22" [node name="ref_A23" parent="." instance=ExtResource("3_4a27g")] offset_left = 60.0 offset_top = 30.0 offset_right = 110.0 offset_bottom = 180.0 -fname = "ИП9-50" -rname = "A22" +fname = "ИП12-50" +rname = "A25" [node name="lbl_fname" type="Label" parent="."] self_modulate = Color(1, 1, 1, 0.62) diff --git a/scenes/контроль/кассета-у-5-к.tscn b/scenes/контроль/кассета-у-5-к.tscn index f527779..19d0607 100644 --- a/scenes/контроль/кассета-у-5-к.tscn +++ b/scenes/контроль/кассета-у-5-к.tscn @@ -21,7 +21,7 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 305.0 offset_bottom = 35.0 -text = "Кассета" +text = "Кассета У5" horizontal_alignment = 1 vertical_alignment = 1 @@ -63,7 +63,7 @@ offset_top = 32.0 offset_right = 255.0 offset_bottom = 182.0 fname = "УКП" -rname = "A36" +rname = "A35" [node name="ref_A29" parent="." instance=ExtResource("3_wtlpi")] offset_left = 254.0 @@ -71,4 +71,4 @@ offset_top = 32.0 offset_right = 304.0 offset_bottom = 182.0 fname = "УКП" -rname = "A35" +rname = "A36" diff --git a/scenes/контроль/кассета-у-5-нв.tscn b/scenes/контроль/кассета-у-5-нв.tscn index c79ec09..21c75f4 100644 --- a/scenes/контроль/кассета-у-5-нв.tscn +++ b/scenes/контроль/кассета-у-5-нв.tscn @@ -21,7 +21,7 @@ offset_left = 5.0 offset_top = 7.0 offset_right = 305.0 offset_bottom = 35.0 -text = "Кассета" +text = "Кассета У5" horizontal_alignment = 1 vertical_alignment = 1 diff --git a/scripts/sch3.gd b/scripts/sch3.gd index abedfbf..eb13478 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 From ffd22b59f46189a7dadf5e62bb0d7cd280b4af6b Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 24 Jun 2025 14:25:42 +0300 Subject: [PATCH 20/21] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=BA=D0=BE=D0=BD=D1=82=D1=80=D0=BE?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=9F=D0=A0=D0=94-=D0=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scenes/pribor-prd-n/pribor-prd-n.tscn | 1 + scenes/pribor-prd-n/pribor_prd_n.gd | 4 +- scenes/pribor-prd-v/pribor-prd-v.tscn | 130 +++++++++++++++++++++---- scenes/pribor-prd-v/pribor_prd_v.gd | 131 +++++++++++++++++++++----- 4 files changed, 226 insertions(+), 40 deletions(-) diff --git a/scenes/pribor-prd-n/pribor-prd-n.tscn b/scenes/pribor-prd-n/pribor-prd-n.tscn index 1e23a7e..f97936e 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.tscn +++ b/scenes/pribor-prd-n/pribor-prd-n.tscn @@ -376,6 +376,7 @@ fname = "УМ1535А" rname = "A18" [node name="Monitoring_panel" type="Panel" parent="."] +visible = false layout_mode = 0 theme_override_styles/panel = SubResource("StyleBoxTexture_bnnv3") diff --git a/scenes/pribor-prd-n/pribor_prd_n.gd b/scenes/pribor-prd-n/pribor_prd_n.gd index 89f8775..6f822dd 100644 --- a/scenes/pribor-prd-n/pribor_prd_n.gd +++ b/scenes/pribor-prd-n/pribor_prd_n.gd @@ -38,12 +38,12 @@ func set_default_state() -> void: group.state = STATE_VAL.NONE -func on_line_changed(unit_prd: Object): +func on_line_changed(unit_prd: Object) -> void: if not unit_prd.online: set_default_state() -func on_data_received(unit_prd: Object): +func on_data_received(unit_prd: Object) -> void: if not is_inside_tree(): return diff --git a/scenes/pribor-prd-v/pribor-prd-v.tscn b/scenes/pribor-prd-v/pribor-prd-v.tscn index b6b22cb..a86227f 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.tscn +++ b/scenes/pribor-prd-v/pribor-prd-v.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=10 format=3 uid="uid://cvskpe1ti3p45"] +[gd_scene load_steps=15 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"] @@ -9,8 +9,33 @@ [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://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="7_e22c6"] +[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="10_4e87c"] +[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="11_g8fvp"] +[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="12_gsby4"] -[node name="pribor_prd_n" type="Control"] +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_vxfkm"] + +[sub_resource type="SpriteFrames" id="SpriteFrames_s5gcy"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("10_4e87c") +}, { +"duration": 1.0, +"texture": ExtResource("11_g8fvp") +}, { +"duration": 1.0, +"texture": ExtResource("12_gsby4") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[node name="pribor_prd_v" type="Control"] layout_mode = 3 anchors_preset = 0 offset_left = 15.0 @@ -110,7 +135,7 @@ patch_margin_bottom = 16 script = ExtResource("6_os4mt") fname = "Кассета П-1В" -[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +[node name="ref_A19" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] offset_left = 9.0 offset_top = 33.0 offset_right = 59.0 @@ -118,7 +143,7 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A19" -[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +[node name="ref_A20" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] offset_left = 59.0 offset_top = 33.0 offset_right = 109.0 @@ -126,7 +151,7 @@ offset_bottom = 183.0 fname = "ИП9-50" rname = "A20" -[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] +[node name="ref_A21" parent="kasseta_P_1" instance=ExtResource("7_38u2b")] offset_left = 109.0 offset_top = 33.0 offset_right = 159.0 @@ -145,7 +170,7 @@ text = "Кассета П-1В" horizontal_alignment = 1 vertical_alignment = 1 -[node name="um1535_A7" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 242.0 @@ -160,7 +185,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A7" -[node name="um1535_A8" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 337.0 @@ -173,7 +198,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A8" -[node name="um1535_A9" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 432.0 @@ -186,7 +211,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A9" -[node name="um1535_A10" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 527.0 @@ -199,7 +224,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A10" -[node name="um1535_A11" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 622.0 @@ -212,7 +237,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A11" -[node name="um1535_A12" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 485.0 offset_top = 717.0 @@ -225,7 +250,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A12" -[node name="um1535_A13" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 242.0 @@ -238,7 +263,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A13" -[node name="um1535_A14" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 337.0 @@ -251,7 +276,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A14" -[node name="um1535_A15" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 432.0 @@ -264,7 +289,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A15" -[node name="um1535_A16" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 527.0 @@ -277,7 +302,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A16" -[node name="um1535_A17" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 622.0 @@ -290,7 +315,7 @@ name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A17" -[node name="um1535_A18" parent="." instance=ExtResource("7_e22c6")] +[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_e22c6")] layout_mode = 0 offset_left = 8.0 offset_top = 717.0 @@ -302,3 +327,74 @@ name_min_size0 = Vector2i(35, 20) name_min_size1 = Vector2i(35, 20) fname = "УМ1535А" rname = "A18" + +[node name="Monitoring_panel" type="Panel" parent="."] +theme_override_styles/panel = SubResource("StyleBoxTexture_vxfkm") + +[node name="in_fs_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="in_fs_1" type="Label" parent="Monitoring_panel/in_fs_1"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="in_fs_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 577) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="in_fs_2" type="Label" parent="Monitoring_panel/in_fs_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "In FS 2" +horizontal_alignment = 1 + +[node name="out_ems_1" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(454, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_1"] +anchors_preset = -1 +anchor_left = 0.0185185 +anchor_right = 0.0185185 +anchor_bottom = 0.555556 +offset_left = -18.5 +offset_top = 14.0 +offset_right = 17.5 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 1" +horizontal_alignment = 1 +metadata/_edit_use_anchors_ = true + +[node name="out_ems_2" type="AnimatedSprite2D" parent="Monitoring_panel"] +position = Vector2(207, 465) +scale = Vector2(1.2, 1.2) +sprite_frames = SubResource("SpriteFrames_s5gcy") + +[node name="Out_ems_1" type="Label" parent="Monitoring_panel/out_ems_2"] +offset_left = -15.1667 +offset_top = 14.0 +offset_right = 14.8333 +offset_bottom = 33.0 +theme_override_colors/font_color = Color(0.890196, 0.486275, 0.196078, 1) +theme_override_font_sizes/font_size = 10 +text = "Out +ems 2" +horizontal_alignment = 1 diff --git a/scenes/pribor-prd-v/pribor_prd_v.gd b/scenes/pribor-prd-v/pribor_prd_v.gd index c919ba1..7a94735 100644 --- a/scenes/pribor-prd-v/pribor_prd_v.gd +++ b/scenes/pribor-prd-v/pribor_prd_v.gd @@ -1,12 +1,28 @@ @tool extends "res://scenes/контроль/прибор.gd" +const IN_BLANK_PRD: int = 1 +const OUT_BLANK_PRD: int = 13 +const CI_4_OT_FS: int = 11 +const CI_5_OT_FS: int = 12 +const CI_4_B_UF: int = 1 +const CI_5_B_UF: int = 2 +const POWER_UKP_1: int = 31 +const POWER_UKP_2: int = 63 +const bit_dkm_3: int = 3 +const bit_dkm_4: int = 4 + +var count_packet_1:int = 0 +var power_array_1: Array = [] +var count_packet_2:int = 0 +var power_array_2: Array = [] + enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 } -# Called when the node enters the scene tree for the first time. + func _ready() -> void: var unit_key = settings.get_unit_key(get_meta('unit_name')[0]) var unit_prd = network.units[unit_key] @@ -15,31 +31,104 @@ func _ready() -> void: set_default_state() -func set_default_state(): - $um1535_A7.state = STATE_VAL.NONE - $um1535_A8.state = STATE_VAL.NONE - $um1535_A9.state = STATE_VAL.NONE - $um1535_A10.state = STATE_VAL.NONE - $um1535_A11.state = STATE_VAL.NONE - $um1535_A12.state = STATE_VAL.NONE - $um1535_A13.state = STATE_VAL.NONE - $um1535_A14.state = STATE_VAL.NONE - $um1535_A15.state = STATE_VAL.NONE - $um1535_A16.state = STATE_VAL.NONE - $um1535_A17.state = STATE_VAL.NONE - $um1535_A18.state = STATE_VAL.NONE +func set_default_state() -> void: + for group in get_tree().get_nodes_in_group('power_amplifier'): + group.state = STATE_VAL.NONE -func on_line_changed(unit_prd): +func on_line_changed(unit_prd: Object) -> void: if not unit_prd.online: set_default_state() -func on_data_received(unit_prd): - var _ukp1_online = (unit_prd.status[0] >> 2) & 1 - var _ukp2_online = (unit_prd.status[0] >> 3) & 1 - var ug_online = (unit_prd.status[0] >> 1) & 1 +func on_data_received(unit_prd: Object) -> void: + if not is_inside_tree(): + return + + check_block_ip(unit_prd.status) + check_temperature_um(unit_prd.status) + + ## Контроль ЭМС + var in_blank: int = unit_prd.status.decode_u16(IN_BLANK_PRD) + var out_blank: int = unit_prd.status.decode_u16(OUT_BLANK_PRD) + + $Monitoring_panel/in_fs_1.frame = (in_blank >> CI_4_OT_FS) & 1 + $Monitoring_panel/in_fs_2.frame = (in_blank >> CI_5_OT_FS) & 1 + + $Monitoring_panel/out_ems_1.frame = (out_blank >> CI_4_B_UF) & 1 + $Monitoring_panel/out_ems_2.frame = (out_blank >> CI_5_B_UF) & 1 + + ## Мощность УМ от УКП 1 + if (in_blank >> CI_4_OT_FS) & 1: + check_dkm(unit_prd.status, bit_dkm_3) + + ## Мощность УМ от УКП 2 + if (in_blank >> CI_5_OT_FS) & 1: + check_dkm(unit_prd.status, bit_dkm_4) + + +## Проверка касет П1 и ИП МА2000 +func check_block_ip(status_prd: PackedByteArray) -> void : + var ug_online: bool = (status_prd[0] >> 1) & 1 if ug_online: - pass + const BYTE_DRY_CONTACT: int = 27 + const BIT_MAA2000_1: int = 0 + const BIT_MAA2000_2: int = 1 + const BIT_IP9_50_1: int = 2 + const BIT_IP9_50_2: int = 3 + const BIT_IP12_50_1: int = 4 + + var maa2000_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_1 & 1 + var maa2000_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_MAA2000_2 & 1 + var ip9_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_1 & 1 + var ip9_50_2 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP9_50_2 & 1 + var ip12_50_1 = status_prd[BYTE_DRY_CONTACT] >> BIT_IP12_50_1 & 1 + + $maa2000_A23.state = STATE_VAL.ERROR if maa2000_1 else STATE_VAL.GOOD + $maa2000_A22.state = STATE_VAL.ERROR if maa2000_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A19.state = STATE_VAL.ERROR if ip9_50_1 else STATE_VAL.GOOD + $kasseta_P_1/ref_A20.state = STATE_VAL.ERROR if ip9_50_2 else STATE_VAL.GOOD + $kasseta_P_1/ref_A21.state = STATE_VAL.ERROR if ip12_50_1 else STATE_VAL.GOOD else: - pass + $maa2000_A23.state = STATE_VAL.NONE + $maa2000_A22.state = STATE_VAL.NONE + $kasseta_P_1/ref_A19.state = STATE_VAL.NONE + $kasseta_P_1/ref_A20.state = STATE_VAL.NONE + $kasseta_P_1/ref_A21.state = STATE_VAL.NONE + + +## Проверка температур УМ от УКП +func check_temperature_um(status_prd: PackedByteArray) -> void: + const CONST_MIN_TEMP: int = -25 + const MAXIMUM_CODE_ADC: int = 3796 + const MINIMUM_CODE_AD: int = 2660 + const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD) + const TEMPERATURE_UKP_1: int = 47 + const TEMPERATURE_UKP_2: int = 79 + var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier') + + var ukp1_online: int = (status_prd[0] >> 2) & 1 + if ukp1_online: + for i_temp in range(6): + var temperature_ukp_1: int = status_prd.decode_u16(TEMPERATURE_UKP_1 + 2 * i_temp) + var tmp_1: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_1) * TEMP + 3) + power_amplifier[i_temp].value0 = tmp_1 + + var ukp2_online = (status_prd[0] >> 3) & 1 + if ukp2_online: + for i_temp in range(6): + var temperature_ukp_2: int = status_prd.decode_u16(TEMPERATURE_UKP_2 + 2 * i_temp) + var tmp_2: int = round(CONST_MIN_TEMP + (MAXIMUM_CODE_ADC - temperature_ukp_2) * TEMP + 3) + power_amplifier[i_temp+6].value0 = tmp_2 + + +## Проверка ДКМ +func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> void: + const DKM: int = 28 + var status_dkm = status_prd[DKM] >> bit_dkm & 1 + if bit_dkm == bit_dkm_3: + $dou4_A5.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + elif bit_dkm == bit_dkm_4: + $dou5_A6.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR + $kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if status_dkm else STATE_VAL.ERROR From 5c9c31b4c86731f736f5d30b7ecdc134ee600936 Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 27 Jun 2025 01:58:31 +0300 Subject: [PATCH 21/21] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=BA=D0=B0,=20=D0=BE=D1=82=D0=BB=D0=B0=D0=B4=D0=BA?= =?UTF-8?q?=D0=B0=20=D0=A93,=20=D1=83=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5?= =?UTF-8?q?=D0=BD=D0=B0=20=D0=BF=D1=80=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D0=B0?= =?UTF-8?q?=20=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 31c3bfb..348f45a 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 a86227f..fa34230 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 3346f3a..9fe5654 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 f74e094..a175a03 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 eb13478..abedfbf 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