Merge remote-tracking branch 'sasha/master'

# Conflicts:
#	modbus/server-serial-modbus.py
#	scripts/yems-boards.gd
This commit is contained in:
MaD_CaT
2024-10-28 11:31:33 +03:00
49 changed files with 1668 additions and 323 deletions

View File

@@ -1,3 +1,4 @@
@tool
# Copyright (c) 2020-2023 Mansur Isaev and contributors - MIT License
# See `LICENSE.md` included in the source distribution for details.

View File

@@ -1,9 +1,10 @@
#!/usr/bin/env bash
#
# Описание
#
# Этот скрипт создаёт исполняемый файл (загружаемый модуль) из файла проекта Godot
# ** Описание **
#
# - Этот скрипт создаёт исполняемый файл (загружаемый модуль) из файла проекта Godot.
# - Путь к шаблонам экспорта прописан в файле "export_presets.cfg".
# Параметр "--export-release" должен иметь имя указанное в поле "name"
# Имя выходного исполняемого файла (загружаемый модуль)
TARGET_BIN="uarep-ctl.linux.x86_64"
@@ -12,13 +13,9 @@ TARGET_BIN="uarep-ctl.linux.x86_64"
TARGET_PATH="./bin"
# Путь к исполняемому файлу редактора Godot
EDITOR="/opt/godot/Godot_v4.2.2-stable_linux.x86_64"
# Если используется своя сборка движка, то соответствующий файл
# (исполняемый модуль движка, шаблон экспорта) нужно заменить
# в этой папке: "~/.local/share/godot/export_templates/4.2.2.stable/"
EDITOR="/opt/godot/godot.linuxbsd.editor.x86_64.llvm"
# Путь к файлу проекта Godot
PROJECT_PATH="$(pwd)"
${EDITOR} --path "${PROJECT_PATH}" --export-release "Linux-X11" "${TARGET_PATH}/${TARGET_BIN}"
${EDITOR} --headless --path "${PROJECT_PATH}" --export-release "Linux-X11" "${TARGET_PATH}/${TARGET_BIN}"

View File

@@ -7,13 +7,13 @@
# для GoDot Engine.
#
# Инструкция по применению
#
#
# 1. В папке ./git/hooks создать файлы:
# - post-checkout
# - post-commit
# - post-merge
# 2. В каждый файл записать строку:
# ./git-hook.sh
# ./git-hook.sh
# 3. Теперь модуль scripts/commit.gd будет содержать данные
# о текущей версии, после выполнения следующих операций СКВ:
# - переключение ветки;

View File

@@ -22,8 +22,7 @@ EXCEPT_MSGS = {
'write': 'ошибка: запись в регистры не выполнена',
'read_holding': 'ошибка: чтение регистров хранения не выполнено',
'read_input': 'ошибка: чтение регистров входов не выполнено',
'<unknown>': 'ошибка: получена неверная команда'
}
'<unknown>': 'ошибка: получена неверная команда'}
def on_timer(*args):
@@ -35,6 +34,7 @@ def on_timer(*args):
sock.sendto(bytes(tx_data, 'utf-8'), (udp_addr, udp_port_tx))
Timer(1, on_timer, args).start()
def main():
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--modbus-unit', default=1, type=int, help='Номер устройства Modbus')
@@ -68,7 +68,6 @@ def run_sync_client(udp_addr, udp_port_rx, udp_port_tx, serial_port, serial_baud
udp_data = udp_data.decode('utf-8')
message = json_decoder.decode(udp_data) # type: dict
if 'code' not in message:
message['code'] = '<unknown>'

View File

@@ -45,10 +45,11 @@ config/unit_rr_request_period=1.0
commit="*res://scripts/commit.gd"
log="*res://addons/godot-logger/scripts/logger.gd"
unit="*res://scripts/unit.gd"
tools="*res://scripts/tools.gd"
signaller="*res://scripts/signaller.gd"
repsettings="*res://scripts/repsettings.gd"
repnetwork="*res://scripts/repnetwork.gd"
repsettings="*res://scripts/settings.gd"
repnetwork="*res://scripts/network.gd"
yau07="*res://scripts/yau07.gd"
capsrpb="*res://scripts/capsrpb.gd"
table="*res://table/table.gd"
@@ -62,6 +63,7 @@ mercator="*res://scripts/mercator.gd"
modbus="*res://scripts/modbus.gd"
tcp5p28="*res://scripts/tcp5p28.gd"
sch3="*res://scripts/sch3.gd"
spt25="*res://scripts/spt25.gd"
[debug]

View File

@@ -48,7 +48,7 @@ offset_left = 8.0
offset_top = 245.0
offset_right = 472.0
offset_bottom = 281.0
columns = 4
columns = 5
[node name="btn_srn" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")]
layout_mode = 2
@@ -77,10 +77,19 @@ strips_rotation = 15.0
text = "КУПД"
metadata/rfi_name = "ozp1"
[node name="btn_panika" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
tooltip_text = "Кнопка для принудительного включения группы секторов в режим КУПД"
strips_rotation = 15.0
text = "Паника"
metadata/rfi_name = "ozp1"
[node name="btn_cancel" parent="grd_forced" groups=["прин-секторы-срн"] instance=ExtResource("4_7ys3c")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
strips_rotation = 15.0
text = "Отключить все"
text = "Очистить"
metadata/rfi_name = "<off>"

View File

@@ -5,7 +5,7 @@
[node name="grd_btns" type="GridContainer"]
offset_right = 1096.0
offset_bottom = 54.0
columns = 16
columns = 15
[node name="btn_off" parent="." groups=["группа-режим-помехи"] instance=ExtResource("1_oy80h")]
layout_mode = 2
@@ -17,16 +17,6 @@ disabled = true
toggle_mode = true
metadata/rfi_name = "off"
[node name="btn_auto_rfi" parent="." groups=["группа-режим-помехи"] instance=ExtResource("1_oy80h")]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
strips_rotation = 30.0
text = "Запрет"
disabled = true
toggle_mode = true
metadata/rfi_name = "auto"
[node name="btn_p12" parent="." groups=["группа-режим-помехи"] instance=ExtResource("1_oy80h")]
layout_mode = 2
size_flags_horizontal = 3

View File

@@ -56,7 +56,7 @@ offset_top = 33.0
offset_right = 205.0
offset_bottom = 183.0
fname = "Блок ФС-6"
rname = "A4"
rname = "A5"
[node name="ref_A5" parent="." instance=ExtResource("3_kqnvt")]
offset_left = 205.0

View File

@@ -1,13 +1,14 @@
[gd_scene load_steps=9 format=3 uid="uid://m5s87q7m66lj"]
[gd_scene load_steps=10 format=3 uid="uid://m5s87q7m66lj"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"]
[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_ufjwe"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_14h25"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5.tscn" id="3_7orfk"]
[ext_resource type="PackedScene" uid="uid://cm5jd4gjrrpba" path="res://scenes/контроль/кассета-у-5.tscn" id="2_tb85r"]
[ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://scenes/контроль/блок-а.tscn" id="6_fmhtx"]
[ext_resource type="PackedScene" uid="uid://dbxdb7lo7kofv" path="res://scenes/контроль/кассета-п-1.tscn" id="7_cjjs2"]
[ext_resource type="PackedScene" uid="uid://bmagw8nd0ulhj" path="res://scenes/pribor-prd-k/kasseta-fs-kd.tscn" id="7_ia27q"]
[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"]
[ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"]
[node name="pribor_prd_k" type="Control"]
layout_mode = 3
@@ -18,10 +19,18 @@ offset_right = 15.0
offset_bottom = 30.0
script = ExtResource("1_ufjwe")
[node name="kasseta_u5" parent="." instance=ExtResource("2_tb85r")]
layout_mode = 0
offset_left = 175.0
offset_top = 242.0
offset_right = 485.0
offset_bottom = 432.0
fname = "Кассета У5"
[node name="lbl_header" type="Label" parent="."]
layout_mode = 0
offset_left = 20.0
offset_top = 210.0
offset_top = 214.0
offset_right = 640.0
offset_bottom = 240.0
theme_override_font_sizes/font_size = 22
@@ -32,36 +41,36 @@ vertical_alignment = 1
[node name="maa2000_A22" parent="." instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 485.0
offset_top = 877.0
offset_right = 645.0
offset_bottom = 942.0
offset_top = 907.0
offset_right = 652.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A22"
rname = "A27"
[node name="dou2_A7" parent="." instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 485.0
offset_top = 812.0
offset_right = 645.0
offset_bottom = 877.0
offset_left = 8.0
offset_top = 862.0
offset_right = 175.0
offset_bottom = 907.0
fname = "ДОУ-6"
rname = "A7"
[node name="maa2000_A23" parent="." instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 15.0
offset_top = 877.0
offset_left = 8.0
offset_top = 907.0
offset_right = 175.0
offset_bottom = 942.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A23"
rname = "A28"
[node name="dou2_A8" parent="." instance=ExtResource("1_8dmgr")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 812.0
offset_right = 175.0
offset_bottom = 877.0
offset_bottom = 860.0
fname = "ДОУ-7"
rname = "A8"
@@ -70,7 +79,7 @@ layout_mode = 0
offset_left = 175.0
offset_top = 812.0
offset_right = 485.0
offset_bottom = 942.0
offset_bottom = 949.0
texture = ExtResource("2_14h25")
patch_margin_left = 16
patch_margin_top = 16
@@ -93,7 +102,7 @@ vertical_alignment = 1
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 337.0
value0 = 28.0
value1 = 70.0
@@ -112,7 +121,7 @@ rname = "A10"
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 432.0
value0 = 28.0
value1 = 57.0
@@ -131,7 +140,7 @@ rname = "A11"
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 527.0
value0 = 28.0
value1 = 57.0
@@ -150,7 +159,7 @@ rname = "A12"
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 622.0
value0 = 28.0
value1 = 57.0
@@ -169,7 +178,7 @@ rname = "A13"
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 717.0
value0 = 28.0
value1 = 57.0
@@ -188,7 +197,7 @@ rname = "A14"
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 812.0
value0 = 28.0
value1 = 57.0
@@ -203,9 +212,28 @@ name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
rname = "A15"
[node name="utm80_A9" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
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)
name_min_size1 = Vector2i(35, 20)
fname = "УТМ80"
rname = "A9"
[node name="um1535_A16" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
@@ -219,14 +247,14 @@ value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
fname = "РМ16-20М"
rname = "A16"
[node name="um1535_A17" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_right = 173.0
offset_bottom = 432.0
value0 = 28.0
value1 = 57.0
@@ -238,12 +266,12 @@ value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
fname = "РМ16-20М"
rname = "A17"
[node name="um1535_A18" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
@@ -257,12 +285,12 @@ value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
fname = "РМ16-20М"
rname = "A18"
[node name="um1535_A19" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
@@ -276,12 +304,12 @@ value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
fname = "РМ16-20М"
rname = "A19"
[node name="um1535_A20" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
@@ -295,12 +323,12 @@ value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
fname = "РМ16-20М"
rname = "A20"
[node name="um1535_A21" parent="." instance=ExtResource("6_fmhtx")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0
@@ -314,17 +342,9 @@ value_name0 = "°C"
value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535Б"
fname = "РМ16-20М"
rname = "A21"
[node name="kasseta_u5" parent="." instance=ExtResource("3_7orfk")]
layout_mode = 0
offset_left = 175.0
offset_top = 242.0
offset_right = 485.0
offset_bottom = 432.0
fname = "Кассета У5"
[node name="kasseta_fs_kd" parent="." instance=ExtResource("7_ia27q")]
layout_mode = 0
offset_left = 175.0
@@ -333,14 +353,55 @@ offset_right = 485.0
offset_bottom = 622.0
fname = "Кассета ФС-КД"
[node name="kasseta_p_1" parent="." instance=ExtResource("7_cjjs2")]
[node name="kasseta_p_1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 622.0
offset_right = 340.0
offset_bottom = 812.0
texture = ExtResource("2_14h25")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("7_xpa2n")
fname = "Кассета П-1"
[node name="ref_A26" parent="kasseta_p_1" instance=ExtResource("8_la5yt")]
offset_left = 9.0
offset_top = 33.0
offset_right = 59.0
offset_bottom = 183.0
fname = "ИП12-50"
rname = "A26"
[node name="ref_A23" parent="kasseta_p_1" instance=ExtResource("8_la5yt")]
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A24"
[node name="ref_A24" parent="kasseta_p_1" instance=ExtResource("8_la5yt")]
offset_left = 109.0
offset_top = 33.0
offset_right = 159.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A23"
[node name="lbl_fname" type="Label" parent="kasseta_p_1"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 7.0
offset_top = 8.0
offset_right = 159.0
offset_bottom = 33.0
text = "Кассета П-1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="kasseta_p_2" parent="." instance=ExtResource("8_6fdp7")]
layout_mode = 0
offset_left = 365.0

View File

@@ -39,7 +39,7 @@ offset_left = 105.0
offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "Блок ФС-2"
fname = "Блок ФС-3"
rname = "A3"
[node name="ref_A4" parent="." instance=ExtResource("2_mkgdh")]

View File

@@ -3,9 +3,9 @@
[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_mcea3"]
[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="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="6_1p3pi"]
[ext_resource type="PackedScene" uid="uid://dbxdb7lo7kofv" path="res://scenes/контроль/кассета-п-1.tscn" id="7_klldp"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="5_ej152"]
[ext_resource type="Script" 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"]
[node name="pribor_prd_n" type="Control"]
@@ -21,8 +21,8 @@ script = ExtResource("1_mcea3")
layout_mode = 2
offset_left = 485.0
offset_top = 877.0
offset_right = 645.0
offset_bottom = 942.0
offset_right = 652.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A22"
@@ -30,23 +30,23 @@ rname = "A22"
layout_mode = 2
offset_left = 485.0
offset_top = 812.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 877.0
fname = "ДОУ-2"
rname = "A5"
[node name="maa2000_A23" parent="." instance=ExtResource("2_lpj3d")]
layout_mode = 2
offset_left = 15.0
offset_left = 8.0
offset_top = 877.0
offset_right = 175.0
offset_bottom = 942.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A23"
[node name="dou2_A6" parent="." instance=ExtResource("2_lpj3d")]
layout_mode = 2
offset_left = 15.0
offset_left = 8.0
offset_top = 812.0
offset_right = 175.0
offset_bottom = 877.0
@@ -58,7 +58,7 @@ layout_mode = 0
offset_left = 175.0
offset_top = 812.0
offset_right = 485.0
offset_bottom = 942.0
offset_bottom = 949.0
texture = ExtResource("4_i1no5")
patch_margin_left = 16
patch_margin_top = 16
@@ -96,27 +96,118 @@ offset_right = 485.0
offset_bottom = 432.0
fname = "Кассета У5"
[node name="kasseta_FS_ND" parent="." instance=ExtResource("6_1p3pi")]
[node name="kasseta_FS_ND" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 432.0
offset_right = 485.0
offset_bottom = 622.0
texture = ExtResource("4_i1no5")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("6_b1cob")
fname = "Кассета ФС-НД"
metadata/Fname = ""
[node name="kasseta_P_1" parent="." instance=ExtResource("7_klldp")]
[node name="lbl_fname" type="Label" parent="kasseta_FS_ND"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 5.0
offset_top = 7.0
offset_right = 303.0
offset_bottom = 33.0
text = "Кассета ФС-НД"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ref_A2" 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"
[node name="ref_A3" 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"
[node name="ref_A4" parent="kasseta_FS_ND" instance=ExtResource("7_dqc3e")]
offset_left = 155.0
offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "Модуль ФС"
rname = "A2"
[node name="ref_A6" 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"
rname = "A4"
[node name="kasseta_P_1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 622.0
offset_right = 485.0
offset_bottom = 812.0
texture = ExtResource("4_i1no5")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("6_b1cob")
fname = "Кассета П-1"
[node name="ref_A26" 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"
[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_dqc3e")]
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A20"
[node name="ref_A24" 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"
[node name="lbl_fname" type="Label" parent="kasseta_P_1"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 7.0
offset_top = 8.0
offset_right = 159.0
offset_bottom = 33.0
text = "Кассета П-1"
horizontal_alignment = 1
vertical_alignment = 1
[node name="um1535_A7" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 337.0
value0 = 27.0
value1 = 56.0
@@ -133,7 +224,7 @@ rname = "A7"
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 432.0
value0 = 27.0
value1 = 56.0
@@ -150,7 +241,7 @@ rname = "A8"
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 527.0
value0 = 27.0
value1 = 56.0
@@ -167,7 +258,7 @@ rname = "A9"
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 622.0
value0 = 27.0
value1 = 56.0
@@ -184,7 +275,7 @@ rname = "A10"
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 717.0
value0 = 27.0
value1 = 56.0
@@ -201,7 +292,7 @@ rname = "A11"
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 812.0
value0 = 27.0
value1 = 56.0
@@ -212,11 +303,11 @@ value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A11"
rname = "A12"
[node name="um1535_A13" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
@@ -235,7 +326,7 @@ rname = "A13"
[node name="um1535_A14" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_bottom = 432.0
@@ -252,7 +343,7 @@ rname = "A14"
[node name="um1535_A15" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
@@ -269,7 +360,7 @@ rname = "A15"
[node name="um1535_A16" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
@@ -286,7 +377,7 @@ rname = "A16"
[node name="um1535_A17" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
@@ -303,7 +394,7 @@ rname = "A17"
[node name="um1535_A18" parent="." instance=ExtResource("8_u7eqo")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0

View File

@@ -1,11 +1,12 @@
[gd_scene load_steps=8 format=3 uid="uid://cvskpe1ti3p45"]
[gd_scene load_steps=9 format=3 uid="uid://cvskpe1ti3p45"]
[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_dl7rt"]
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_xpo4b"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_wyy1b"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5.tscn" id="4_gl2bl"]
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_gl2bl"]
[ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="5_nhd2k"]
[ext_resource type="PackedScene" uid="uid://dbxdb7lo7kofv" path="res://scenes/контроль/кассета-п-1.tscn" id="6_d3awr"]
[ext_resource type="Script" 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"]
[node name="pribor_prd_n" type="Control"]
@@ -21,8 +22,8 @@ script = ExtResource("1_dl7rt")
layout_mode = 2
offset_left = 485.0
offset_top = 877.0
offset_right = 645.0
offset_bottom = 942.0
offset_right = 652.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A22"
@@ -30,23 +31,23 @@ rname = "A22"
layout_mode = 2
offset_left = 485.0
offset_top = 812.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 877.0
fname = "ДОУ-4"
rname = "A5"
[node name="maa2000_A23" parent="." instance=ExtResource("2_xpo4b")]
layout_mode = 2
offset_left = 15.0
offset_left = 8.0
offset_top = 877.0
offset_right = 175.0
offset_bottom = 942.0
offset_bottom = 949.0
fname = "MAA2000"
rname = "A23"
[node name="dou5_A6" parent="." instance=ExtResource("2_xpo4b")]
layout_mode = 2
offset_left = 15.0
offset_left = 8.0
offset_top = 812.0
offset_right = 175.0
offset_bottom = 877.0
@@ -58,7 +59,7 @@ layout_mode = 0
offset_left = 175.0
offset_top = 812.0
offset_right = 485.0
offset_bottom = 942.0
offset_bottom = 949.0
texture = ExtResource("3_wyy1b")
patch_margin_left = 16
patch_margin_top = 16
@@ -104,19 +105,60 @@ offset_right = 485.0
offset_bottom = 622.0
fname = "Кассета ФС-ВД"
[node name="kasseta_P_1" parent="." instance=ExtResource("6_d3awr")]
[node name="kasseta_P_1" type="NinePatchRect" parent="."]
layout_mode = 0
offset_left = 175.0
offset_top = 622.0
offset_right = 485.0
offset_bottom = 812.0
fname = "Кассета П-1"
texture = ExtResource("3_wyy1b")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("6_os4mt")
fname = "Кассета П-1В"
[node name="ref_A26" parent="kasseta_P_1" instance=ExtResource("7_38u2b")]
offset_left = 9.0
offset_top = 33.0
offset_right = 59.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A19"
[node name="ref_A23" parent="kasseta_P_1" instance=ExtResource("7_38u2b")]
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A20"
[node name="ref_A24" parent="kasseta_P_1" instance=ExtResource("7_38u2b")]
offset_left = 109.0
offset_top = 33.0
offset_right = 159.0
offset_bottom = 183.0
fname = "ИП12-50"
rname = "A21"
[node name="lbl_fname" type="Label" parent="kasseta_P_1"]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 7.0
offset_top = 8.0
offset_right = 159.0
offset_bottom = 33.0
text = "Кассета П-1В"
horizontal_alignment = 1
vertical_alignment = 1
[node name="um1535_A7" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 485.0
offset_top = 242.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 337.0
value0 = 91.0
value1 = 22.0
@@ -135,7 +177,7 @@ rname = "A7"
layout_mode = 0
offset_left = 485.0
offset_top = 337.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 432.0
value0 = 91.0
value1 = 22.0
@@ -154,7 +196,7 @@ rname = "A8"
layout_mode = 0
offset_left = 485.0
offset_top = 432.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 527.0
value0 = 91.0
value1 = 22.0
@@ -173,7 +215,7 @@ rname = "A9"
layout_mode = 0
offset_left = 485.0
offset_top = 527.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 622.0
value0 = 91.0
value1 = 22.0
@@ -192,7 +234,7 @@ rname = "A10"
layout_mode = 0
offset_left = 485.0
offset_top = 622.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 717.0
value0 = 91.0
value1 = 22.0
@@ -211,7 +253,7 @@ rname = "A11"
layout_mode = 0
offset_left = 485.0
offset_top = 717.0
offset_right = 645.0
offset_right = 652.0
offset_bottom = 812.0
value0 = 91.0
value1 = 22.0
@@ -224,11 +266,11 @@ value_name1 = "P, %"
name_min_size0 = Vector2i(35, 20)
name_min_size1 = Vector2i(35, 20)
fname = "УМ1535А"
rname = "A11"
rname = "A12"
[node name="um1535_A13" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 242.0
offset_right = 175.0
offset_bottom = 337.0
@@ -247,7 +289,7 @@ rname = "A13"
[node name="um1535_A14" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 337.0
offset_right = 175.0
offset_bottom = 432.0
@@ -266,7 +308,7 @@ rname = "A14"
[node name="um1535_A15" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 432.0
offset_right = 175.0
offset_bottom = 527.0
@@ -285,7 +327,7 @@ rname = "A15"
[node name="um1535_A16" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 527.0
offset_right = 175.0
offset_bottom = 622.0
@@ -304,7 +346,7 @@ rname = "A16"
[node name="um1535_A17" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 622.0
offset_right = 175.0
offset_bottom = 717.0
@@ -323,7 +365,7 @@ rname = "A17"
[node name="um1535_A18" parent="." instance=ExtResource("7_e22c6")]
layout_mode = 0
offset_left = 15.0
offset_left = 8.0
offset_top = 717.0
offset_right = 175.0
offset_bottom = 812.0

View File

@@ -102,7 +102,7 @@ func map_value_to_item(data, item, value_name: StringName):
## 1. Поле [b]'ErCode'[/b] содержит [b]0[/b] - если нет ошибки, и другое значение - если есть ошибка.[br]
## 2. Для каждого проверяемого параметра устройства есть своё поле [b]'ErCode'[/b].[br]
## 3. Есть только один индикатор исправности при отображении состояния устройства.[br]
## 4. [i]Нет результата порверки[/i] - поле [param state] принимает значение [b]0[/b], [i]всё
## 4. [i]Нет результата проверки[/i] - поле [param state] принимает значение [b]0[/b], [i]всё
## исправно[/i] - [b]1[/b], [i]хотябы один[/i] параметр с ошибкой - [b]2[/b].[br]
func map_error_codes_to_item(data, item, value_name: StringName):
var metas = item.get_meta(value_name, '')

View File

@@ -0,0 +1,179 @@
[gd_scene load_steps=13 format=3 uid="uid://ku8rdjoyscai"]
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_hot1o"]
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_0xfrj"]
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_vs130"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_lvhef"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"]
[sub_resource type="GDScript" id="GDScript_oj3k3"]
script/source = "@tool
extends PanelContainer
@export var textures: Array
signal pressed(control: PanelContainer)
@export var fname: String:
set(v):
fname = v
$margin/vbox/title/fname.text = v
@export var state0: int:
set(v):
state0 = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/table/state0.texture = textures[v]
@export var state1: int:
set(v):
state1 = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/table/state1.texture = textures[v]
@export var state2: int:
set(v):
state2 = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/table/state2.texture = textures[v]
func _on_button_pressed():
emit_signal('pressed', self)
"
[sub_resource type="GDScript" id="GDScript_45hqb"]
script/source = "@tool
extends MarginContainer
func _enter_tree() -> void:
margins = [8, 8, 8, 8]
@export var margins: Array:
set(vals):
add_theme_constant_override('margin_top', vals[0])
add_theme_constant_override('margin_left', vals[1])
add_theme_constant_override('margin_bottom', vals[2])
add_theme_constant_override('margin_right', vals[3])
get:
var vals = [0, 0, 0, 0]
vals[0] = get_theme_constant('margin_top')
vals[1] = get_theme_constant('margin_left')
vals[2] = get_theme_constant('margin_bottom')
vals[3] = get_theme_constant('margin_right')
return vals
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"]
[node name="block_input" type="PanelContainer"]
editor_description = "Элемент замены из ЗИП"
offset_right = 200.0
offset_bottom = 120.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
script = SubResource("GDScript_oj3k3")
textures = [ExtResource("1_hot1o"), ExtResource("2_0xfrj"), ExtResource("3_vs130")]
[node name="rect" type="NinePatchRect" parent="."]
layout_mode = 2
texture = ExtResource("4_lvhef")
draw_center = false
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 17
patch_margin_top = 17
patch_margin_right = 17
patch_margin_bottom = 15
[node name="margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
script = SubResource("GDScript_45hqb")
margins = [8, 8, 8, 8]
[node name="vbox" type="VBoxContainer" parent="margin"]
layout_mode = 2
alignment = -1
[node name="title" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
[node name="fname" type="Label" parent="margin/vbox/title"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 17
horizontal_alignment = 1
vertical_alignment = 1
[node name="table" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
columns = 2
[node name="state0" type="TextureRect" parent="margin/vbox/table"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("1_hot1o")
expand_mode = 1
[node name="name0" type="Label" parent="margin/vbox/table"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
theme_override_font_sizes/font_size = 17
text = "Входное напряжение"
[node name="state1" type="TextureRect" parent="margin/vbox/table"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
size_flags_horizontal = 4
size_flags_vertical = 4
texture = ExtResource("1_hot1o")
expand_mode = 1
[node name="name1" type="Label" parent="margin/vbox/table"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
theme_override_font_sizes/font_size = 17
text = "Блок инвертора"
[node name="state2" type="TextureRect" parent="margin/vbox/table"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = ExtResource("1_hot1o")
expand_mode = 1
[node name="name2" type="Label" parent="margin/vbox/table"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
theme_override_font_sizes/font_size = 17
text = "Температура"
[node name="button" type="Button" parent="."]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw")
theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms")
theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06")
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View File

@@ -0,0 +1,187 @@
[gd_scene load_steps=13 format=3 uid="uid://bsixhjfesq6r4"]
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_20kkm"]
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_t54t5"]
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_et31i"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_u5qvj"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"]
[sub_resource type="GDScript" id="GDScript_oj3k3"]
script/source = "@tool
extends PanelContainer
@export var textures: Array
signal pressed(control: PanelContainer)
@export var fname: String:
set(v):
fname = v
$margin/vbox/title/fname.text = v
@export var rname: String:
set(v):
rname = v
$margin/vbox/title/rname.text = v
@export var state0: int:
set(v):
state0 = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/table/state0.texture = textures[v]
@export var state1: int:
set(v):
state1 = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/table/state1.texture = textures[v]
@export var state2: int:
set(v):
state1 = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/table/state2.texture = textures[v]
@export var alignment: int:
set(v):
$margin/vbox.alignment = v
func _on_button_pressed():
emit_signal('pressed', self)
"
[sub_resource type="GDScript" id="GDScript_45hqb"]
script/source = "@tool
extends MarginContainer
func _enter_tree() -> void:
margins = [8, 8, 8, 8]
@export var margins: Array:
set(vals):
add_theme_constant_override('margin_top', vals[0])
add_theme_constant_override('margin_left', vals[1])
add_theme_constant_override('margin_bottom', vals[2])
add_theme_constant_override('margin_right', vals[3])
get:
var vals = [0, 0, 0, 0]
vals[0] = get_theme_constant('margin_top')
vals[1] = get_theme_constant('margin_left')
vals[2] = get_theme_constant('margin_bottom')
vals[3] = get_theme_constant('margin_right')
return vals
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"]
[node name="block_output" type="PanelContainer"]
editor_description = "Элемент замены из ЗИП"
offset_right = 210.0
offset_bottom = 70.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
script = SubResource("GDScript_oj3k3")
textures = [ExtResource("1_20kkm"), ExtResource("2_t54t5"), ExtResource("3_et31i")]
[node name="rect" type="NinePatchRect" parent="."]
layout_mode = 2
texture = ExtResource("4_u5qvj")
draw_center = false
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 17
patch_margin_top = 17
patch_margin_right = 17
patch_margin_bottom = 15
[node name="margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
script = SubResource("GDScript_45hqb")
margins = [8, 8, 8, 8]
[node name="vbox" type="VBoxContainer" parent="margin"]
layout_mode = 2
[node name="title" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
[node name="fname" type="Label" parent="margin/vbox/title"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 17
text = "Выход"
horizontal_alignment = 1
vertical_alignment = 1
[node name="table" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
columns = 2
[node name="state0" type="TextureRect" parent="margin/vbox/table"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = ExtResource("1_20kkm")
expand_mode = 1
[node name="name0" type="Label" parent="margin/vbox/table"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
theme_override_font_sizes/font_size = 17
text = "Напряжение"
[node name="state1" type="TextureRect" parent="margin/vbox/table"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = ExtResource("1_20kkm")
expand_mode = 1
[node name="name1" type="Label" parent="margin/vbox/table"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
theme_override_font_sizes/font_size = 17
text = "Нагрузка"
[node name="state2" type="TextureRect" parent="margin/vbox/table"]
custom_minimum_size = Vector2(24, 24)
layout_mode = 2
texture = ExtResource("1_20kkm")
expand_mode = 1
[node name="name2" type="Label" parent="margin/vbox/table"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
theme_override_font_sizes/font_size = 17
text = "Температура"
[node name="button" type="Button" parent="."]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw")
theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms")
theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06")
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View File

@@ -0,0 +1 @@
extends "res://scenes/контроль/прибор.gd"

View File

@@ -1,13 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://bs7h65e7bodp3"]
[gd_scene load_steps=7 format=3 uid="uid://bs7h65e7bodp3"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_6olof"]
[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_b7gyx"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="2_cf6tc"]
[ext_resource type="Script" path="res://scenes/контроль/прибор.gd" id="1_46rp6"]
[ext_resource type="PackedScene" uid="uid://ku8rdjoyscai" path="res://scenes/pribor-uyep/block-input.tscn" id="4_mrvir"]
[ext_resource type="Script" path="res://scenes/pribor-uyep/spt25_view.gd" id="4_v0lil"]
[ext_resource type="PackedScene" uid="uid://bsixhjfesq6r4" path="res://scenes/pribor-uyep/block-output.tscn" id="5_x74mk"]
[ext_resource type="PackedScene" uid="uid://btpc78gucr57f" path="res://scenes/контроль/элемент-я.tscn" id="6_60xs3"]
[node name="pribor_uyep" type="Control"]
layout_mode = 3
anchors_preset = 0
script = ExtResource("1_b7gyx")
script = ExtResource("1_46rp6")
[node name="ref_G1" type="NinePatchRect" parent="."]
layout_mode = 0
@@ -20,52 +23,94 @@ patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
[node name="ref_A1" parent="." instance=ExtResource("2_cf6tc")]
offset_left = 175.0
offset_top = 529.0
offset_right = 335.0
offset_bottom = 984.0
self_size = Vector2i(160, 455)
fname = "МАА150-1С27"
rname = "A1"
[node name="ref_A2" parent="." instance=ExtResource("2_cf6tc")]
offset_left = 496.0
offset_top = 531.0
offset_right = 636.0
offset_bottom = 988.0
self_size = Vector2i(140, 457)
fname = "МАА150-1С27"
rname = "A2"
[node name="ref_A3" parent="." instance=ExtResource("2_cf6tc")]
offset_left = 377.0
offset_top = 531.0
offset_right = 467.0
offset_bottom = 985.0
self_size = Vector2i(90, 454)
fname = "МАА150-1С27"
rname = "A2"
metadata/_edit_lock_ = true
[node name="lbl_header" type="Label" parent="."]
layout_mode = 0
offset_left = 10.0
offset_left = 100.0
offset_top = 156.0
offset_right = 865.0
offset_right = 750.0
offset_bottom = 182.0
theme_override_font_sizes/font_size = 22
text = "Контроль исправности прибора Щ3"
text = "Контроль исправности прибора УЭП"
horizontal_alignment = 1
vertical_alignment = 1
[node name="Label" type="Label" parent="."]
self_modulate = Color(0.835294, 0.141176, 0.286275, 1)
layout_mode = 0
offset_left = 244.0
offset_top = 1039.0
offset_right = 619.0
offset_bottom = 1058.0
offset_left = 135.0
offset_top = 990.0
offset_right = 665.0
offset_bottom = 1009.0
text = "** Позиционные обозначения требуют уточнения **"
horizontal_alignment = 1
vertical_alignment = 1
[node name="spt25_A1" parent="." instance=ExtResource("6_60xs3")]
layout_mode = 0
offset_left = 135.0
offset_top = 485.0
offset_right = 375.0
offset_bottom = 895.0
script = ExtResource("4_v0lil")
unit_name = "уарэп-спт25-1"
fname = "СПТ-25-230-400"
rname = "A1"
[node name="block_input1" parent="spt25_A1" instance=ExtResource("4_mrvir")]
layout_mode = 0
offset_left = 15.0
offset_top = 35.0
offset_right = 225.0
offset_bottom = 155.0
fname = "Сеть 1"
[node name="block_input2" parent="spt25_A1" instance=ExtResource("4_mrvir")]
layout_mode = 0
offset_left = 15.0
offset_top = 155.0
offset_right = 225.0
offset_bottom = 275.0
fname = "Сеть 2"
[node name="block_output" parent="spt25_A1" instance=ExtResource("5_x74mk")]
layout_mode = 0
offset_left = 15.0
offset_top = 275.0
offset_right = 225.0
offset_bottom = 367.0
[node name="spt25_A2" parent="." instance=ExtResource("6_60xs3")]
layout_mode = 0
offset_left = 435.0
offset_top = 485.0
offset_right = 675.0
offset_bottom = 895.0
script = ExtResource("4_v0lil")
unit_name = "уарэп-спт25-2"
fname = "СПТ-25-230-400"
rname = "A2"
[node name="block_input1" parent="spt25_A2" instance=ExtResource("4_mrvir")]
layout_mode = 0
offset_left = 15.0
offset_top = 35.0
offset_right = 225.0
offset_bottom = 155.0
fname = "Сеть 1"
[node name="block_input2" parent="spt25_A2" instance=ExtResource("4_mrvir")]
layout_mode = 0
offset_left = 15.0
offset_top = 155.0
offset_right = 225.0
offset_bottom = 275.0
fname = "Сеть 2"
[node name="block_output" parent="spt25_A2" instance=ExtResource("5_x74mk")]
layout_mode = 0
offset_left = 15.0
offset_top = 275.0
offset_right = 225.0
offset_bottom = 367.0

View File

@@ -0,0 +1,45 @@
@tool
extends "res://scenes/контроль/элемент-я.gd"
@export var unit_name: String = ''
enum STATE_VAL
{
NONE = 0,
GOOD = 1,
ERROR = 2
}
func _enter_tree() -> void:
var unit_key = repsettings.get_unit_key(unit_name)
var unit = repnetwork.units[unit_key]
unit.connect('data_received', on_data_received.bind(unit))
func _exit_tree() -> void:
var unit_key = repsettings.get_unit_key(unit_name)
var unit = repnetwork.units[unit_key]
unit.disconnect('data_received', on_data_received)
func on_data_received(data, unit):
# Неисправность, напряжение на выходе меньше номинального
$block_output.state0 = STATE_VAL.GOOD if (data[4] & (1 << 0)) == 0 else STATE_VAL.ERROR
# Перегрузка и короткое замыкание по выходу
$block_output.state1 = STATE_VAL.GOOD if ((data[5] & (1 << 0)) == 0) or ((data[5] & (1 << 1)) == 0) else STATE_VAL.ERROR
# Критическая температура
$block_output.state2 = STATE_VAL.GOOD if ((data[5] & (1 << 5)) == 0) else STATE_VAL.ERROR
# Сеть 1. Вход
$block_input1.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 1)) == 0) or ((data[4] & (1 << 3)) == 0) else STATE_VAL.ERROR
# Сеть 2. Вход
$block_input2.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 2)) == 0) or ((data[4] & (1 << 4)) == 0) else STATE_VAL.ERROR
# Неисправность блока инвертора 1 канала
$block_input1.state1 = STATE_VAL.GOOD if (data[6] & (1 << 2)) == 0 else STATE_VAL.ERROR
# Неисправность блока инвертора 2 канала
$block_input2.state1 = STATE_VAL.GOOD if (data[6] & (1 << 3)) == 0 else STATE_VAL.ERROR
# Перегрев 1 канала
$block_input1.state2 = STATE_VAL.GOOD if (data[5] & (1 << 3)) == 0 else STATE_VAL.ERROR
# Перегрев 2 канала
$block_input1.state2 = STATE_VAL.GOOD if (data[5] & (1 << 4)) == 0 else STATE_VAL.ERROR

12
scenes/tilemap/Control.gd Normal file
View File

@@ -0,0 +1,12 @@
extends Control
var scene_list=[]
func node_list(node):
scene_list.append(node)
func _enter_tree():
get_tree().node_added.connect(self.node_list)
func _ready():
get_tree().node_added.disconnect(self.node_list) #should be first string in _ready()
print(scene_list)

View File

@@ -0,0 +1,3 @@
[gd_scene format=3 uid="uid://e3sw6q228iai"]
[node name="Navig" type="Node2D"]

View File

@@ -5,7 +5,7 @@
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_gg14a"]
[node name="kasseta_p_1" type="NinePatchRect"]
offset_right = 165.0
offset_right = 173.0
offset_bottom = 190.0
texture = ExtResource("1_sbi2k")
patch_margin_left = 16
@@ -15,36 +15,36 @@ patch_margin_bottom = 16
script = ExtResource("2_7ydqi")
[node name="ref_A26" parent="." instance=ExtResource("3_gg14a")]
offset_left = 7.0
offset_top = 30.0
offset_right = 57.0
offset_bottom = 180.0
offset_left = 9.0
offset_top = 33.0
offset_right = 59.0
offset_bottom = 183.0
fname = "ИП12-50"
rname = "A26"
rname = "A19"
[node name="ref_A23" parent="." instance=ExtResource("3_gg14a")]
offset_left = 57.0
offset_top = 30.0
offset_right = 107.0
offset_bottom = 180.0
fname = "ИП9-50"
rname = "A23"
[node name="ref_A24" parent="." instance=ExtResource("3_gg14a")]
offset_left = 107.0
offset_top = 30.0
offset_right = 157.0
offset_bottom = 180.0
offset_left = 59.0
offset_top = 33.0
offset_right = 109.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A24"
[node name="ref_A24" parent="." instance=ExtResource("3_gg14a")]
offset_left = 109.0
offset_top = 33.0
offset_right = 159.0
offset_bottom = 183.0
fname = "ИП9-50"
rname = "A23"
[node name="lbl_fname" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 5.0
offset_top = 5.0
offset_right = 157.0
offset_bottom = 30.0
offset_left = 7.0
offset_top = 8.0
offset_right = 159.0
offset_bottom = 33.0
text = "Кассета"
horizontal_alignment = 1
vertical_alignment = 1

View File

@@ -0,0 +1,74 @@
[gd_scene load_steps=4 format=3 uid="uid://cm5jd4gjrrpba"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="1_bdojw"]
[ext_resource type="Script" path="res://scenes/контроль/кассета.gd" id="2_csgh4"]
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="3_wtlpi"]
[node name="kasseta_u5" type="NinePatchRect"]
offset_right = 310.0
offset_bottom = 190.0
texture = ExtResource("1_bdojw")
patch_margin_left = 16
patch_margin_top = 16
patch_margin_right = 16
patch_margin_bottom = 16
script = ExtResource("2_csgh4")
[node name="lbl_fname" type="Label" parent="."]
self_modulate = Color(1, 1, 1, 0.62)
layout_mode = 0
offset_left = 5.0
offset_top = 7.0
offset_right = 305.0
offset_bottom = 35.0
text = "Кассета"
horizontal_alignment = 1
vertical_alignment = 1
[node name="ref_A31" parent="." instance=ExtResource("3_wtlpi")]
offset_left = 5.0
offset_top = 32.0
offset_right = 55.0
offset_bottom = 182.0
fname = "ИП5-25"
rname = "A31"
[node name="ref_A37" parent="." instance=ExtResource("3_wtlpi")]
offset_left = 55.0
offset_top = 32.0
offset_right = 105.0
offset_bottom = 182.0
fname = "ЯУ-07Б"
rname = "A37"
[node name="ref_A33" parent="." instance=ExtResource("3_wtlpi")]
offset_left = 105.0
offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "ЭМС-Г"
rname = "A33"
[node name="ref_A34" parent="." instance=ExtResource("3_wtlpi")]
offset_left = 155.0
offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "УГ"
rname = "A34"
[node name="ref_A35" parent="." instance=ExtResource("3_wtlpi")]
offset_left = 205.0
offset_top = 32.0
offset_right = 255.0
offset_bottom = 182.0
fname = "УКП"
rname = "A36"
[node name="ref_A36" parent="." instance=ExtResource("3_wtlpi")]
offset_left = 254.0
offset_top = 32.0
offset_right = 304.0
offset_bottom = 182.0
fname = "УКП"
rname = "A35"

View File

@@ -31,7 +31,7 @@ offset_top = 32.0
offset_right = 55.0
offset_bottom = 182.0
fname = "ИП5-25"
rname = "A31"
rname = "A24"
[node name="ref_A37" parent="." instance=ExtResource("3_picsk")]
offset_left = 55.0
@@ -39,7 +39,7 @@ offset_top = 32.0
offset_right = 105.0
offset_bottom = 182.0
fname = "ЯУ-07Б"
rname = "A37"
rname = "A30"
[node name="ref_A33" parent="." instance=ExtResource("3_picsk")]
offset_left = 105.0
@@ -47,7 +47,7 @@ offset_top = 32.0
offset_right = 155.0
offset_bottom = 182.0
fname = "ЭМС-Г"
rname = "A33"
rname = "A26"
[node name="ref_A34" parent="." instance=ExtResource("3_picsk")]
offset_left = 155.0
@@ -55,7 +55,7 @@ offset_top = 32.0
offset_right = 205.0
offset_bottom = 182.0
fname = "УГ"
rname = "A34"
rname = "A27"
[node name="ref_A35" parent="." instance=ExtResource("3_picsk")]
offset_left = 205.0
@@ -63,7 +63,7 @@ offset_top = 32.0
offset_right = 255.0
offset_bottom = 182.0
fname = "УКП"
rname = "A35"
rname = "A29"
[node name="ref_A36" parent="." instance=ExtResource("3_picsk")]
offset_left = 254.0
@@ -71,4 +71,4 @@ offset_top = 32.0
offset_right = 304.0
offset_bottom = 182.0
fname = "УКП"
rname = "A36"
rname = "A28"

View File

@@ -9,7 +9,8 @@ extends NinePatchRect
@export var fname: String:
set(v):
fname = v
$lbl_fname.text = v
if is_inside_tree():
$lbl_fname.text = v
@export var rname: String:

View File

@@ -21,7 +21,3 @@ extends Control
func set_header_text(header_text: String):
$lbl_header.text = header_text
@export var nodes_mask: String = ''

View File

@@ -0,0 +1,134 @@
[gd_scene load_steps=13 format=3 uid="uid://3nw70a3320yc"]
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_ihl8b"]
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_cji5r"]
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_ecwtv"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_o6o0s"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"]
[sub_resource type="GDScript" id="GDScript_oj3k3"]
script/source = "@tool
extends PanelContainer
@export var textures: Array
signal pressed(control: PanelContainer)
@export var fname: String:
set(v):
fname = v
$margin/vbox/grid/fname.text = v
@export var rname: String:
set(v):
rname = v
$margin/vbox/grid/rname.text = v
@export var state: int:
set(v):
state = tools.clip_value(v, 0, textures.size() - 1)
$margin/vbox/grid/state.texture = textures[v]
@export var alignment: int:
set(v):
$margin/vbox.alignment = v
func _on_button_pressed():
emit_signal('pressed', self)
"
[sub_resource type="GDScript" id="GDScript_45hqb"]
script/source = "@tool
extends MarginContainer
func _enter_tree() -> void:
margins = [8, 8, 8, 8]
@export var margins: Array:
set(vals):
add_theme_constant_override('margin_top', vals[0])
add_theme_constant_override('margin_left', vals[1])
add_theme_constant_override('margin_bottom', vals[2])
add_theme_constant_override('margin_right', vals[3])
get:
var vals = [0, 0, 0, 0]
vals[0] = get_theme_constant('margin_top')
vals[1] = get_theme_constant('margin_left')
vals[2] = get_theme_constant('margin_bottom')
vals[3] = get_theme_constant('margin_right')
return vals
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"]
[node name="yelement_empty" type="PanelContainer"]
editor_description = "Элемент замены из ЗИП"
offset_right = 150.0
offset_bottom = 50.0
theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
script = SubResource("GDScript_oj3k3")
textures = [ExtResource("1_ihl8b"), ExtResource("2_cji5r"), ExtResource("3_ecwtv")]
[node name="rect" type="NinePatchRect" parent="."]
layout_mode = 2
texture = ExtResource("4_o6o0s")
draw_center = false
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 17
patch_margin_top = 17
patch_margin_right = 17
patch_margin_bottom = 15
[node name="margin" type="MarginContainer" parent="."]
layout_mode = 2
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
script = SubResource("GDScript_45hqb")
margins = [8, 8, 8, 8]
[node name="vbox" type="VBoxContainer" parent="margin"]
layout_mode = 2
[node name="grid" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
[node name="fname" type="Label" parent="margin/vbox/grid"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 17
text = "Заголовок"
horizontal_alignment = 1
vertical_alignment = 1
[node name="button" type="Button" parent="."]
layout_mode = 2
theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw")
theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms")
theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06")
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View File

@@ -0,0 +1,34 @@
@tool
extends Control
signal pressed(control: PanelContainer)
func _on_button_pressed():
emit_signal('pressed', self)
@export var fname: String:
set(v):
fname = v
$margin/vbox/grid/fname.text = v
@export var rname: String:
set(v):
rname = v
$margin/vbox/grid/rname.text = v
@export var alignment: int:
set(v):
$margin/vbox.alignment = v
func _enter_tree() -> void: _on_resized()
func _on_resized() -> void:
$rect.size = size
$margin.size = size
$button.size = size

View File

@@ -0,0 +1,112 @@
[gd_scene load_steps=9 format=3 uid="uid://btpc78gucr57f"]
[ext_resource type="Script" path="res://scenes/контроль/элемент-я.gd" id="1_fwxi0"]
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_or1kj"]
[sub_resource type="GDScript" id="GDScript_45hqb"]
script/source = "@tool
extends MarginContainer
func _enter_tree() -> void:
margins = [8, 8, 8, 8]
@export var margins: Array:
set(vals):
add_theme_constant_override('margin_top', vals[0])
add_theme_constant_override('margin_left', vals[1])
add_theme_constant_override('margin_bottom', vals[2])
add_theme_constant_override('margin_right', vals[3])
get:
var vals = [0, 0, 0, 0]
vals[0] = get_theme_constant('margin_top')
vals[1] = get_theme_constant('margin_left')
vals[2] = get_theme_constant('margin_bottom')
vals[3] = get_theme_constant('margin_right')
return vals
"
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ox0yw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_xxyaa"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_cd4fw"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_emtms"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_evx06"]
[node name="yelement_ya" type="Control"]
editor_description = "Элемент замены из ЗИП"
custom_minimum_size = Vector2(32, 32)
layout_mode = 3
anchors_preset = 0
offset_right = 180.0
offset_bottom = 155.0
script = ExtResource("1_fwxi0")
[node name="rect" type="NinePatchRect" parent="."]
layout_mode = 2
offset_right = 180.0
offset_bottom = 155.0
size_flags_horizontal = 3
size_flags_vertical = 3
texture = ExtResource("4_or1kj")
draw_center = false
region_rect = Rect2(0, 0, 63, 63)
patch_margin_left = 17
patch_margin_top = 17
patch_margin_right = 17
patch_margin_bottom = 15
[node name="margin" type="MarginContainer" parent="."]
layout_mode = 2
offset_right = 180.0
offset_bottom = 155.0
theme_override_constants/margin_left = 8
theme_override_constants/margin_top = 8
theme_override_constants/margin_right = 8
theme_override_constants/margin_bottom = 8
script = SubResource("GDScript_45hqb")
margins = [8, 8, 8, 8]
[node name="vbox" type="VBoxContainer" parent="margin"]
layout_mode = 2
[node name="grid" type="GridContainer" parent="margin/vbox"]
layout_mode = 2
columns = 2
[node name="fname" type="Label" parent="margin/vbox/grid"]
self_modulate = Color(1, 1, 1, 0.627451)
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 17
horizontal_alignment = 1
vertical_alignment = 1
[node name="rname" type="Label" parent="margin/vbox/grid"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 6
theme_override_font_sizes/font_size = 22
horizontal_alignment = 2
vertical_alignment = 1
[node name="button" type="Button" parent="."]
layout_mode = 2
offset_right = 180.0
offset_bottom = 155.0
theme_override_styles/normal = SubResource("StyleBoxEmpty_ox0yw")
theme_override_styles/hover = SubResource("StyleBoxEmpty_xxyaa")
theme_override_styles/pressed = SubResource("StyleBoxEmpty_cd4fw")
theme_override_styles/disabled = SubResource("StyleBoxEmpty_emtms")
theme_override_styles/focus = SubResource("StyleBoxEmpty_evx06")
[connection signal="resized" from="." to="." method="_on_resized"]
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]

View File

@@ -0,0 +1 @@
extends "res://table/table.gd"

View File

@@ -0,0 +1,102 @@
[gd_scene load_steps=4 format=3 uid="uid://bnptm4rlp60dq"]
[ext_resource type="Script" path="res://scenes/настройки/настройки.gd" id="1_2l3rd"]
[ext_resource type="Script" path="res://table/table.gd" id="2_ts42i"]
[sub_resource type="GDScript" id="GDScript_anjmx"]
script/source = "extends LineEdit
func _ready() -> void: text = ProjectSettings.get('application/config/map_server_addr')
func _on_text_changed(new_text: String) -> void:
ProjectSettings.set('application/config/map_server_addr', new_text)
ProjectSettings.save_custom('override.cfg')
"
[node name="Настройки" type="Panel"]
script = ExtResource("1_2l3rd")
[node name="table" type="GridContainer" parent="."]
layout_mode = 2
offset_left = 32.0
offset_top = 96.0
offset_right = 241.0
offset_bottom = 535.0
columns = 2
script = ExtResource("2_ts42i")
[node name="Label1" type="Label" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 60.0
offset_right = 434.0
offset_bottom = 82.0
text = "Управление элементами в режиме с ограниченным доступом"
[node name="Label2" type="Label" parent="."]
layout_mode = 0
offset_left = 16.0
offset_top = 20.0
offset_right = 476.0
offset_bottom = 50.0
text = "Текущий режим доступа: полный"
vertical_alignment = 1
[node name="edt_mapaddr" type="LineEdit" parent="."]
layout_mode = 0
offset_left = 660.0
offset_top = 80.0
offset_right = 1032.0
offset_bottom = 110.0
script = SubResource("GDScript_anjmx")
[node name="Label" type="Label" parent="edt_mapaddr"]
layout_mode = 0
offset_left = -180.0
offset_right = -20.0
offset_bottom = 30.0
text = "Адрес сервера карт:"
vertical_alignment = 1
[node name="GridContainer2" type="GridContainer" parent="."]
layout_mode = 0
offset_left = 478.0
offset_top = 154.0
offset_right = 784.0
offset_bottom = 260.0
columns = 2
[node name="external_cu_lbl" type="Label" parent="GridContainer2"]
layout_mode = 2
text = "Внешнее целеуказание."
vertical_alignment = 1
[node name="external_cu_btn" type="CheckButton" parent="GridContainer2"]
layout_mode = 2
[node name="Label19" type="Label" parent="GridContainer2"]
layout_mode = 2
size_flags_horizontal = 3
size_flags_vertical = 3
text = "Кнопка «Подавление».
Отключить отображение этой кнопки,
что бы тип помех применялся сразу."
[node name="CheckButton18" type="CheckButton" parent="GridContainer2"]
layout_mode = 2
size_flags_horizontal = 6
size_flags_vertical = 6
button_pressed = true
[node name="lbl_commit" type="Label" parent="."]
layout_mode = 0
offset_left = 480.0
offset_top = 20.0
offset_right = 1040.0
offset_bottom = 50.0
text = "Текущая версия ПО УАРЭП:"
vertical_alignment = 1
[connection signal="text_changed" from="edt_mapaddr" to="edt_mapaddr" method="_on_text_changed"]
[connection signal="pressed" from="GridContainer2/external_cu_btn" to="." method="_on_external_cu_btn_pressed"]

View File

@@ -0,0 +1,28 @@
class_name characterBody extends CharacterBody2D
const SPEED = 300.0
const JUMP_VELOCITY = -400.0
## Получить гравитацию из настроек проекта для синхронизации с узлами RigidBody.
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
func _physics_process(delta):
# Add the gravity.
if not is_on_floor():
velocity.y += gravity * delta
# Handle jump.
if Input.is_action_just_pressed("ui_accept") and is_on_floor():
velocity.y = JUMP_VELOCITY
# Get the input direction and handle the movement/deceleration.
# As good practice, you should replace UI actions with custom gameplay actions.
var direction = Input.get_axis("ui_left", "ui_right")
if direction:
velocity.x = direction * SPEED
else:
velocity.x = move_toward(velocity.x, 0, SPEED)
move_and_slide()

View File

@@ -66,13 +66,13 @@ const fs_sectors: Dictionary = {
1: [270.0, 360.0] }
const fs_freq: Dictionary = {
0: [400.0, 1200.0],
1: [1200.0, 2000.0],
2: [2000.0, 2800.0],
3: [2800.0, 3600.0],
4: [3600.0, 4400.0],
5: [4400.0, 5200.0],
6: [5200.0, 6000.0] }
0: [370.0, 800.0, 200.0, 250.0],
1: [800.0, 1065.0, 250.0, 300.0],
2: [1065.0, 1180.0, 300.0, 350.0],
3: [1180.0, 1450.0, 350.0, 400.0],
4: [1450.0, 2000.0, 400.0, 450.0],
5: [2000.0, 3500.0, 450.0, 500.0],
6: [3500.0, 6000.0, 500.0, 550.0] }
## Размеры карты для разных режимов РТО и РЛС соответственно
@@ -82,7 +82,6 @@ const map_sizes = [
var fs_band = fs_band_rto ## Текущий режим блоков ФС по частоте
var fs_selected: Dictionary ## Словарь выбранных секторов
var fs_active: Dictionary ## Словарь секторов назначенных на подавление
## Состояние перетаскивания.
enum DragFSM {
DRAG, ## В процессе.
@@ -159,6 +158,7 @@ func _ready():
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all'))
signaller.connect('fs_selected', Callable(self, 'on_fs_selected'))
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
signaller.connect('fs_update_color', Callable(self, 'on_fs_update_color'))
func get_all_nodes(root):
@@ -171,14 +171,28 @@ func get_all_nodes(root):
## Производит отображение цели на диаграмму.
func map_threat_to_bip(th: threats.Threat, bip: Control):
bip.position = tools.pos_calc(
th.freq,
th.aoa,
radius_center,
radius_internal,
radius_outter,
freq_low,
freq_high) - bip.size / 2
var freq = th.freq
var sector_key = null
var sector_width = 50.0
for key in fs_freq:
var freq_range = fs_freq[key]
var num_values = (freq_range[1]- freq_range[0]) / sector_width
if freq_range[0] <= freq and freq <= freq_range[1]:
sector_key = key
break
if sector_key!= null:
radius_internal = fs_freq[sector_key][2]
radius_outter = fs_freq[sector_key][3]
freq_low = fs_freq[sector_key][0]
freq_high = fs_freq[sector_key][1]
bip.position = tools.pos_calc(
th.freq,
th.aoa,
radius_center,
radius_internal,
radius_outter,
freq_low,
freq_high) - bip.size / 2
## Обработчик сигнала обновления цели.
@@ -191,10 +205,10 @@ func on_threat_update(th):
## Обработчик выбора помехи для цели.
func on_interfer_new(ecm):
if interfer.thrs.has(ecm.ispp):
if interfer.thrs.has(ecm.ispp):
var th_id = interfer.thrs[ecm.ispp]
var bip = get_node('%d' % th_id)
if ecm.krp != interfer.INTERFER_OFF:
var th_id = interfer.thrs[ecm.ispp]
var bip = get_node('%d' % th_id)
if bip!= null:
if ecm.krp!= interfer.INTERFER_OFF:
bip.set_track_visible(true)
if ecm.svk == 1:
bip.set_ecm_visible(true)
@@ -202,6 +216,10 @@ func on_interfer_new(ecm):
else:
bip.set_ecm_visible(false)
bip.set_track_visible(false)
else:
interfer.thrs.erase(ecm.ispp)
set_fs_color(ecm)
update_fs_colors()
set_fs_color(ecm)
@@ -215,6 +233,13 @@ func on_interfer_off_all():
update_fs_colors()
func on_interfer_off(ecm_id):
fs_active.erase(ecm_id)
fs_selected.erase(ecm_id)
fs_active.clear()
update_fs_colors()
## Обработчик сигнала обнаружения цели.
func on_threat_new(th) -> void:
var bip = Bip.instantiate()
@@ -474,3 +499,9 @@ func set_btns_disabled(value: bool, btn):
btn.set_disabled(true)
else:
btn.set_disabled(value)
func on_fs_update_color(ecms):
fs_active.clear()
for ecm in ecms.values():
set_fs_color(ecm)
update_fs_colors()

View File

@@ -21,10 +21,10 @@ col_red = Color(1, 0.568627, 0.431373, 0.239216)
drag_scale_band = 0.05
drag_scale_width = 0.5
freq_high = 6000.0
freq_low = 400.0
freq_low = 370.0
radius_center = Vector2(560, 560)
radius_internal = 200.0
radius_outter = 350.0
radius_outter = 200.0
strob_max_band = 15.538
strob_max_width = 90.0
strob_min_band = 0.1

View File

@@ -4,28 +4,28 @@ extends PanelContainer
@export var texture_state0: Texture2D = preload('res://data/кнопка-эмс-1.png'):
set(val): $state.set_texture(val)
set(val): $state.set_texture(val)
@export var texture_state1: Texture2D = preload('res://data/кнопка-эмс-0.png'):
set(val): $state.set_texture(val)
set(val): $state.set_texture(val)
@export var text: String = '':
set(val): $button.set_text(val)
get: return $button.get_text()
set(val): $button.set_text(val)
get: return $button.get_text()
@export var pressed: bool = false:
set(val): $button.set_pressed(val)
get: return $button.is_pressed()
set(val): $button.set_pressed(val)
get: return $button.is_pressed()
@export var toggle_mode: bool = false:
set(val):
if is_inside_tree():
$button.set_toggle_mode(val)
get: return $button.is_toggle_mode()
set(val):
if is_inside_tree():
$button.set_toggle_mode(val)
get: return $button.is_toggle_mode()
func set_text (val: String): $button.set_text(val)
@@ -33,8 +33,8 @@ func set_pressed (val: bool): $button.set_pressed(val)
func set_toggle_mode (val: bool):
if is_inside_tree():
$button.set_toggle_mode(val)
if is_inside_tree():
$button.set_toggle_mode(val)
func get_text(): return $button.get_text()
@@ -43,13 +43,13 @@ func is_toggle_mode(): return $button.is_toggle_mode()
func _on_button_toggled(val: bool):
if val: $state.set_texture(texture_state1)
else: $state.set_texture(texture_state0)
if val: $state.set_texture(texture_state1)
else: $state.set_texture(texture_state0)
func button_connect(button_signal: String, proc: Callable):
$button.connect(button_signal, proc)
$button.connect(button_signal, proc)
func _on_button_mouse_entered():
emit_signal("mouse_entered")
emit_signal("mouse_entered")

View File

@@ -9,30 +9,30 @@ var FILES_ROWS_ALIGNMENT = [ HORIZONTAL_ALIGNMENT_LEFT, HORIZONTAL_ALIGNM
func fill_files_table(tbl: table, folder: String, rows_types: Array):
var dir: = DirAccess.open(folder)
if dir == null:
return
var files: = []
var exclude_names: = ['.', '..']
dir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547
while true:
var file: = dir.get_next()
if file == '':
break
if file in exclude_names:
continue
var file_name = folder + '/' + file
var fd = FileAccess.open(file_name, FileAccess.READ)
if not fd:
continue
var glob_path = ProjectSettings.globalize_path(file_name)
var sz = fd.get_length()
var ut = fd.get_modified_time(file_name)
fd.close()
var mt = Time.get_datetime_dict_from_unix_time(ut)
var file_row = [file, '%d' % sz, '%d-%02d-%02d %02d:%02d' % [mt.year, mt.month, mt.day, mt.hour, mt.minute]]
tbl.add_row(rows_types)
var i_row = tbl.get_rows_count() - 1
tbl.set_row_text(i_row, file_row)
tbl.set_node_meta(0, i_row, 'file_path', glob_path)
dir.list_dir_end()
var dir: = DirAccess.open(folder)
if dir == null:
return
var files: = []
var exclude_names: = ['.', '..']
dir.list_dir_begin() # TODOGODOT4 fill missing arguments https://github.com/godotengine/godot/pull/40547
while true:
var file: = dir.get_next()
if file == '':
break
if file in exclude_names:
continue
var file_name = folder + '/' + file
var fd = FileAccess.open(file_name, FileAccess.READ)
if not fd:
continue
var glob_path = ProjectSettings.globalize_path(file_name)
var sz = fd.get_length()
var ut = fd.get_modified_time(file_name)
fd.close()
var mt = Time.get_datetime_dict_from_unix_time(ut)
var file_row = [file, '%d' % sz, '%d-%02d-%02d %02d:%02d' % [mt.year, mt.month, mt.day, mt.hour, mt.minute]]
tbl.add_row(rows_types)
var i_row = tbl.get_rows_count() - 1
tbl.set_row_text(i_row, file_row)
tbl.set_node_meta(0, i_row, 'file_path', glob_path)
dir.list_dir_end()

View File

@@ -112,6 +112,9 @@ func _ready():
signaller.connect('interfer_rcv', Callable(self, 'on_interfer_rcv').bind(unit_5p28, ecms))
signaller.connect('interfer_new', Callable(self, 'send_ecm').bind(unit))
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all').bind(unit, ecms))
signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update').bind(ecms, unit))
signaller.connect('interfer_off', Callable(self, 'on_interfer_off'))
threats.connect('threat_lost', Callable(self, 'on_threats_lost').bind(ecms, unit))
## Проверяет состояние отправки пакета и если не доставлен, повторяет отправку.
@@ -124,6 +127,18 @@ func on_timer_check_state(unit, ecms, resend_timeout):
ecm.tick_tx = tick
func on_th_aoa_update(threats: Dictionary, ecms: Dictionary, unit):
for thr in threats.values():
var th_id = thr.id
for ecm_i in thrs.keys():
if thrs[ecm_i] == th_id:
var ecm = ecms[ecm_i]
ecm.params['freq'] = thr.freq
ecm.kni = thr.aoa
send_ecm(ecm, unit)
signaller.emit_signal('fs_update_color', ecms)
## Производит приём состояния помех. [param unit] -> [param ecms].
func on_data_capsrpb_received(unit: capsrpb.CapsRpb, ecms: Dictionary):
if not unit.json_dic.has('ts'): return
@@ -248,6 +263,16 @@ func on_interfer_off_all(unit, ecms):
send_ecm(ecm, unit)
signaller.emit_signal('interfer_off',ecm, ecms, thrs)
func on_threats_lost(th, ecms, unit):
for key in interfer.thrs:
if interfer.thrs[key] == th.id:
var ecm_id = key
var ecm = ecms[ecm_id]
ecm.krp = INTERFER_OFF
push_id(ecm.ispp)
send_ecm(ecm, unit)
signaller.emit_signal('interfer_off',ecm, ecms, thrs)
func pop_id():
var id = 0

View File

@@ -1,8 +1,22 @@
@tool
class_name rep_network extends Node
const PROTOCOL_TYPES: = {'yau07tx': yau07.YaU07, 'json-capsrpb': capsrpb.CapsRpb, 'udp-json-mbcs': modbus.ModbusClient}
const TCP_PROTO: = {'5p28': tcp5p28.TCP5P28}
const SERIAL_PROTO: = {'uart': spt25.SPT25 }
class Serial extends SerialPort:
func send_to(data: PackedByteArray):
write_raw(data)
func try_open(parsing_proc: Callable):
if not is_open():
open(port)
if is_open():
data_received.connect(parsing_proc)
start_monitoring(timeout)
class Socket extends PacketPeerUDP:
func send_to(addr, data):
@@ -14,7 +28,7 @@ class SocketTCP extends TCPServer:
const RX_TIMEOUT: int = 1000 ## Время сброса счётчика принятия части пакета.
var peerstream: = PacketPeerStream.new()
var unit_key: Array ## Ключ юнита.
var head_len: int = 8 ## Длинна заголовка команды.
var head_len: int = 8 ## Длина заголовка команды.
var len_place: int = 4 ## Номер начального байта с длинной блока данных.
var type_len: int = 4 ## Количество байт в размере длинны.
var rx_tick: int ## Время приёма последнего пакета.
@@ -31,7 +45,10 @@ class SocketTCP extends TCPServer:
var poll_sockets: Array[Socket]
var tcp_sockets: Array
var units: Dictionary
var units_udp: Dictionary
var units_tcp: Dictionary
var units_serial: Dictionary
var serials: Dictionary
var dst_ports: Dictionary
var unit_keys: Dictionary
var sock_unicast: Socket
@@ -62,6 +79,20 @@ func create_tcpsocket(nm) -> SocketTCP:
return sock
func create_serial(nm) -> Serial:
var port = repsettings.UnitProfiles[nm][1]
var baud = repsettings.UnitProfiles[nm][2][0]
var sp: = Serial.new()
sp.baudrate = baud
sp.timeout = 20000
var rc = sp.open(port)
if rc != Error.OK:
log.message(log.ERROR, 'Невозможно открыть порт \"%s\" для \"%s\"' % [port, nm])
else:
log.message(log.INFO, 'Последовательный порт \"%s\"@%d открыт для \"%s\"' % [port, baud, nm])
return sp
func _ready() -> void:
log.info('Модуль работы с сетью готов')
poll_sockets.append(create_socket('уарэп-яу07-частный'))
@@ -78,6 +109,7 @@ func _ready() -> void:
var unit = PROTOCOL_TYPES[proto].new(unit_name)
var unit_key = repsettings.get_unit_key(unit_name)
units[unit_key] = unit
units_udp[unit_key] = unit
if logger_page:
unit.connect('line_changed', Callable(logger_page, 'on_line_changed').bind(unit_key))
unit.connect('command_fail', Callable(logger_page, 'on_command_fail').bind(unit_key))
@@ -85,7 +117,7 @@ func _ready() -> void:
dst_ports[unit_key] = settings[2][1]
else:
dst_ports[unit_key] = settings[2][0]
if proto in TCP_PROTO:
var unit = TCP_PROTO[proto].new(unit_name)
var unit_key = repsettings.get_unit_key(unit_name)
@@ -94,12 +126,24 @@ func _ready() -> void:
unit.connect('line_changed', Callable(logger_page, 'on_line_changed').bind(unit_key))
unit.connect('command_fail', Callable(logger_page, 'on_command_fail').bind(unit_key))
if proto in SERIAL_PROTO:
var unit = SERIAL_PROTO[proto].new(unit_name)
var unit_key = repsettings.get_unit_key(unit_name)
if logger_page:
unit.connect('line_changed', Callable(logger_page, 'on_line_changed').bind(unit_key))
unit.connect('command_fail', Callable(logger_page, 'on_command_fail').bind(unit_key))
var serial = create_serial(unit_name)
units_serial[unit_key] = unit
units[unit_key] = unit
serials[unit_key] = serial
serial.try_open(unit.parse)
tcp_sockets.append([create_tcpsocket('уарэп-5п28'), units_tcp[repsettings.get_unit_key('уарэп-5п28')]])
for key in units: log.info('%s %s:%d' % [units[key].name, key[0], key[1]])
for key in units: log.info('%s %s:%d' % [units[key].name, key[0], key[1]])
for key in units_tcp: log.info('%s %s:%d' % [units_tcp[key].name, key[0], key[1]])
for key in dst_ports:
unit_keys[dst_ports[key]] = key
for key in dst_ports: unit_keys[dst_ports[key]] = key
func poll_receive(sock: Socket, tick: int) -> bool:
while sock.get_available_packet_count() > 0:
@@ -119,7 +163,6 @@ func poll_receive_tcp(sock: SocketTCP, tick: int) -> bool:
if sock.is_connection_available(): # check if someone's trying to connect
var client = sock.take_connection() # accept connection
sock.peerstream.set_stream_peer(client) # bind peerstream to new client
print_debug('client_is_connected')
var peer = sock.peerstream.get_stream_peer()
if peer:
var peer_len_data = peer.get_available_bytes()
@@ -163,16 +206,22 @@ func get_tcp_data(sock: SocketTCP, peer, len_rx):
func _process(_delta: float) -> void:
var tick = Time.get_ticks_msec()
for addr in units:
for addr in units_udp:
var unit = units[addr]
match unit.process(tick):
Error.OK: sock_unicast.send_to([addr[0], dst_ports[addr]], unit.tx_data)
Error.FAILED: emit_signal('socket_error', 'ошибка: %s %s:%d' % [unit, addr[0], addr[1]])
for key in units_serial:
var unit = units_serial[key]
var serial = serials[key]
match unit.process(tick):
Error.OK: serial.send_to(unit.tx_data)
Error.FAILED: emit_signal('socket_error', 'ошибка: \"%s\"' % unit.name)
for sock_unit in tcp_sockets:
var sock = sock_unit[0]
var unit = sock_unit[1]
match unit.process(tick):
Error.OK: sock.send_to(unit.tx_data)
Error.FAILED: emit_signal('socket_error', 'ошибка: %s' %unit)
Error.FAILED: emit_signal('socket_error', 'ошибка: %s' % unit)
poll_receive_tcp(sock, tick)
poll_sockets.any(func(sock): poll_receive(sock, tick))

View File

@@ -1,3 +1,4 @@
@tool
class_name rep_settings extends Node
## Параметры.
@@ -21,15 +22,15 @@ class_name rep_settings extends Node
'уарэп-яу07-3н': ['yau07tx', '10.1.1.49', [50049], false, false, 'IP-адрес ЯУ-07 прибора ПРД-Н'],
'уарэп-яу07-3к': ['yau07tx', '10.1.1.51', [50051], false, false, 'IP-адрес ЯУ-07 прибора ПРД-Н'],
# Название | Протокол | Адрес | Порт получения | Комментарий
'уарэп-5п28': ['5p28', '127.0.0.1', [50000], 'IP-адрес комплекса 5П-28'],
# Название: [ Протокол, Адрес, Порт получения, Комментарий ]
'уарэп-5п28': [ '5p28', '127.0.0.1', [50000], 'IP-адрес комплекса 5П-28'],
# Название | Протокол | Адрес | Порт получения | Порт отправки | Комментарий
'уарэп-щ3': ['udp-json-mbcs', '127.0.0.1', [48000, 44100], false, true, 'IP-адрес и порты через которые производят обмен сообщения с драйвером клиента Modbus Serial'],
# Название | Протокол | Имя порта | Скорость, бод | Чётность | Комментарий
'уарэп-спт25-1': ['uart', '/dev/tty2', 115200, false, 'Адрес прибора СПТ-25 (G1)'],
'уарэп-спт25-2': ['uart', '/dev/tty3', 115200, false, 'Адрес прибора СПТ-25 (G2)'],
# Название: [ Протокол, Адрес, [ Порт получения, Порт отправки], ??, ??, Комментарий
'уарэп-щ3': ['udp-json-mbcs', '127.0.0.1', [48000, 44100], false, true, 'IP-адрес и порты через которые производят обмен сообщения с драйвером клиента Modbus Serial'],
# Название: [ Протокол, Имя порта, Скорость, Чётность, ??, Комментарий
'уарэп-спт25-1': ['uart', '/home/sasha/dev/tty0', [19200, false, false], 'Адрес прибора СПТ-25 (G1)'],
'уарэп-спт25-2': ['uart', '/home/sasha/dev/tty4', [19200, false, false], 'Адрес прибора СПТ-25 (G2)'],
}
## Параметры цели.

View File

@@ -1,10 +1,20 @@
class_name Signaller extends Node
## Обмен сигналами между узлами. Здесь объявлены сигналы, которые используют.
## Обмен сигналами между узлами. Здесь объявлены сигналы, которые используют
## два и более узла, из разных файлов. Должен быть помещён в автозагрузку.
## Подключает обработчик к событию по его определению
func conn(sgnl: Signal, clbl: Callable): connect(sgnl.get_name(), clbl)
## Вызывает сигнал по его определению
func emmit(sgnl: Signal): emit_signal(sgnl.get_name())
## Вызывается при обнаружение ошибки последовательного порта
signal serial_error()
## Вызывается при переходе в режим [b]Работа[/b].
signal режим_работа()
@@ -60,48 +70,48 @@ signal full_screen(id: int)
## Вызывается, когда пользователь выбирает цель.[br]
## [param th_id] - Отметка цели на экране.
signal rto_threat_sel (th_id: int)
signal rto_threat_sel(th_id: int)
## Вызывается, когда пользователь нажимает на значёк цели.[br]
## [param th_id] - Отметка цели на экране.
signal bip_pressed (th_id: int)
signal bip_pressed(th_id: int)
## Вызывается, когда пользователь снимает выделение с цели.[br]
## [param th_id] - Отметка цели на экране.
signal rto_threat_unsel (th_id: int)
signal rto_threat_unsel(th_id: int)
## Вызывается, когда пользователь снимает выделение со всех целей.
signal rto_threat_unsel_all ()
signal rto_threat_unsel_all()
## Вызывается, когда пользователь выбирает помеху.[br]
## [param btn] - Нажатая кнопка помехи.
signal interfer_init (btn: PanelContainer, fs_arr: Array)
signal interfer_init(btn: PanelContainer, fs_arr: Array)
## Вызывается, когда выбраны цели для постановки помех.[br]
## [param btn] - Нажатая кнопка помехи.[br]
## [param sel_threats] - Cписок целей.
signal interfer_create (btn: PanelContainer, sel_threats: Array, fs_arr: Array)
signal interfer_create(btn: PanelContainer, sel_threats: Array, fs_arr: Array)
## Вызывается, когда создалась новая помеха.[br]
## [param ecm] - Новая помеха.[br]
signal interfer_new (ecm: interfer.Interfer)
signal interfer_new(ecm: interfer.Interfer)
## Вызывается, когда отключается действующая помеха.[br]
## [param ecm] - Новая помеха.[br]
## [param ecms] - словарь помех.[br]
## [param thrs] - словарь id помех и связанных с ними целей.[br]
signal interfer_off (ecm: interfer.Interfer, ecms: Dictionary, thrs: Dictionary)
signal interfer_off(ecm: interfer.Interfer, ecms: Dictionary, thrs: Dictionary)
## Вызывается при нажатии отключить все помехи.
signal interfer_off_all ()
signal interfer_off_all()
## Вызывается при получении внешнего целеуказания.
@@ -111,7 +121,7 @@ signal interfer_rcv(interfer_params: Array)
## Вызывается, когда отключается действующая помеха.[br]
## [param ecm] - Выбранная помеха.
signal interfer_selected (ecm: interfer.Interfer)
signal interfer_selected(ecm: interfer.Interfer)
## Вызывается, когда отключается выбираем помеху по сектору в таблице.[br]
@@ -127,3 +137,8 @@ signal map_coords_changed(lan: float, lat: float)
## Вызывается при изменении размера изображения для отображения карты.[br]
## [param mode] - Вновь установленный режим.
signal map_mode_changed(mode: int)
## Вызывается при обновлении позиции(угла) цели.[br]
signal th_aoa_update(threats: Dictionary)
signal fs_update_color(ecms:Dictionary)

32
scripts/spt25.gd Normal file
View File

@@ -0,0 +1,32 @@
class_name spt25_unit extends Node
class SPT25 extends unit.Unit:
var tx_tick: int = 0
var req_period = 3000
func _to_string() -> String: return String('СПТ-25: %s %s' % [self.name, ['отключен', 'на связи'][int(online)]])
func _init(nm) -> void:
self.name = nm
tx_data.resize(8)
tx_data[0] = 0x7e # Флаги синхронизации пакета
tx_data[1] = 0 # Адрес абонента, которому предназначен пакет
tx_data[2] = 4 # Тип пакета, КОД КОМАНДЫ - Получить информацию о состоянии преобразователя
tx_data[3] = 0 # Данные
tx_data[4] = 0 # Данные
tx_data[5] = 0 # Данные
tx_data[6] = 0 # Контрольная сумма
tx_data[7] = 0x7e # Флаги синхронизации пакета
func parse(rx_data: PackedByteArray):
if not self.online:
self.online = true
emit_signal('line_changed', self)
emit_signal('data_received', rx_data)
func process(delta: float):
tick += delta
if (tick - tx_tick) > req_period:
return Error.OK
return Error.ERR_BUSY

View File

@@ -34,28 +34,20 @@ const CU_STATE: Dictionary = {
4:9, # Неисправность
}
class TCP5P28:
class TCP5P28 extends unit.Unit:
const PACK_TYPE_CMD: int = 1
const PACK_TYPE_RES: int = 2
const CMD_TYPE_STATE: int = 1
const CMD_TYPE_TH: int = 2
const CMD_TYPE_IN: int = 3
signal line_changed(unit: TCP5P28) ## Сигнал состояние связи изменилось.
signal data_received(unit: TCP5P28) ## Сигнал данные приняты.
signal command_fail(unit: TCP5P28) ## Сигнал при не выполнении команды.
signal parse_error(unit: TCP5P28, msg: String) ## Сигнал ошибки разбора сообщения.
signal get_threats(unit: TCP5P28) ## Сигнал запрос целей.
signal get_interfers(unit: TCP5P28) ## Запрос состояния выполнения целеуказания.
var online: = false ## Состояние связи с источником сообщений.
var name: String ## Имя экземпляра.
var rx_tick: = 0 ## Тик время последнего приёма, мс.
var tx_data: = PackedByteArray() ## Пакет для отправки.
var tx_stack: Array ## Массив пакетов для отправки.
func _to_string() -> String: return String('капсрпб: "%s" %s ' % [self.name, ['отключен', 'на связи'][int(online)]])
func _init(nm): self.name = nm
func parse(data: PackedByteArray, now_tick: int):
rx_tick = now_tick
@@ -87,12 +79,12 @@ class TCP5P28:
func pack_threats(ths):
var data = PackedByteArray()
var data_len = 4 + len(ths) * 80 # длинна блока данных в байтах
var tick = Time.get_ticks_msec()
var tick0 = Time.get_ticks_msec()
data.resize(4)
data.encode_u16(0, 0) # Код ошибки
data.encode_u16(2, len(ths)) # Количество целей
for th in ths.values():
data.append_array(get_threats_data(th, int(tick)))
data.append_array(get_threats_data(th, int(tick0)))
var data_to_send: PackedByteArray = create_header(data_len)
data_to_send.append_array(data)
tx_stack.append(data_to_send)
@@ -131,10 +123,10 @@ class TCP5P28:
head_data.encode_u32(4, data_len) # Длинна пакета данных
return head_data
func get_threats_data(th, tick):
func get_threats_data(th, tick0):
var th_data = PackedByteArray()
th_data.resize(80) # Количество байт в массиве
th_data.encode_u64(0, tick)
th_data.encode_u64(0, tick0)
var flags: int = 0 # с 0 по 7 бит рекомендованная помеха
flags |= 0 << 8 # Флаг рекомендуемой помехи
flags |= int(th.fflags['aoa']) << 9 # Флаг доставерности пеленга
@@ -190,4 +182,3 @@ class TCP5P28:
var data_to_send: PackedByteArray = create_header(data_len)
data_to_send.append_array(data_tx)
tx_stack.append(data_to_send)

View File

@@ -51,11 +51,15 @@ func _ready() -> void:
var unit_5p28_key = repsettings.get_unit_key('уарэп-5п28')
var unit_5p28 = repnetwork.units_tcp[unit_5p28_key]
var timer_check_lost: = Timer.new()
var timer_aoa_update: = Timer.new()
add_child(timer_check_lost)
add_child(timer_aoa_update)
unit.connect('data_received', Callable(self, 'on_data_capsrpb_received').bind(threats))
unit_5p28.connect('get_threats', Callable(self, 'on_get_threats').bind(unit_5p28, threats))
timer_check_lost.connect('timeout', Callable(self, 'on_timer_check_lost').bind(repsettings.ThreatParams.time_lost, threats))
timer_check_lost.start(repsettings.ThreatParams.time_lost / 1000.0)
timer_aoa_update.connect('timeout', Callable(self, 'on_timer_aoa_update').bind(threats))
timer_aoa_update.start(0.25)
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(threats))
signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(threats))
signaller.connect('rto_threat_unsel_all', Callable(self, 'on_rto_threat_unsel_all').bind(threats))
@@ -74,10 +78,12 @@ func on_timer_check_lost(time_lost: int, threats: Dictionary):
call_deferred('emit_signal', 'threats_resized', threats)
func on_timer_aoa_update(threats:Dictionary):
signaller.emit_signal('th_aoa_update', threats)
## отправляет словарь целей в юнит, для запаковки и отправки в 5П28.
func on_get_threats(unit, threats): unit.pack_threats(threats)
## Снимает выделение с цели, если нажать по отметке цели.
func on_rto_threat_unsel(th_id, threats): threats[th_id].selected = false

View File

@@ -72,8 +72,9 @@ func get_string_slice(s_in: String, s_out: Array, i0: int, i1: int):
## Производит преобразование из декартовой в полярную систему координат.
func pos_calc(freq: float, aoa: float, pos0: Vector2, r0: float, r1: float, f0: float, f1: float):
var r = ((freq - f0) / (f1 - f0)) * r1 + r0
var r = remap(freq, f0, f1, r0, r1)
var aoa_rad = radians(aoa) - PI / 2.0
return Vector2(cos(aoa_rad), sin(aoa_rad)) * r + pos0

18
scripts/unit.gd Normal file
View File

@@ -0,0 +1,18 @@
class_name base_unit extends Node
## Базовый класс для управления подключаемыми устройствами
class Unit:
signal line_changed(unit) ## Вызывается при изменение состояния связи
signal command_done(unit) ## Вызывается после выполнения команды.
signal command_fail(unit) ## Вызывается если возникла ошибка при выполнении команды и команда не выполнена.
signal parse_failed(unit) ## Вызывается при обнаружении ошибки во входных данных
signal data_received(unit) ## Вызывается по приёму данных
var tick = 0.0 ## Текущее тик-время в мс.
var tx_data: = PackedByteArray() ## Буфер отправленный.
var tx_len = 0 ## Длина последнего отправленного пакета.
var online: bool
var name: String
func _init(nm) -> void: self.name = nm
func _to_string() -> String: return String('устройство: %s %s' % [self.name, ['отключен', 'на связи'][int(online)]])

View File

@@ -9,13 +9,13 @@ const BUFFER_SIZE = 2048 ## Размер буфера для приёма д
## Ячейка ЯУ-07.
class YaU07:
class YaU07 extends unit.Unit:
## Коды выполняемых команд.
enum CmdCode {
READ_ISA = 0, ## Код команды "читать порт ISA" ячейки ЯУ-07.
WRITE_ISA = 1, ## Код команды "записать порт ISA" ячейки ЯУ-07.
WRITE_BLOCK = 60, ## Код команды "записать блок данных ISA" внешней шины ячейки ЯУ-07.
READ_ISA = 0, ## Код команды "читать порт ISA" ячейки ЯУ-07.
WRITE_ISA = 1, ## Код команды "записать порт ISA" ячейки ЯУ-07.
WRITE_BLOCK = 60, ## Код команды "записать блок данных ISA" внешней шины ячейки ЯУ-07.
READ_BLOCK = 61, ## Код команды "читать блок данных ISA" внешней шины ячейки ЯУ-07.
}
@@ -28,27 +28,18 @@ class YaU07:
FAIL ## Команда не выполнена.
}
signal line_changed(unit: YaU07) ## Вызывается когда меняется состояние связи с ячейкой.
signal command_done(unit: YaU07) ## Вызывается после выполнения команды.
signal command_fail(unit: YaU07) ## Вызывается если возникла ошибка при выполнении команды и команда не выполнена.
signal parse_failed(unit: YaU07)
var name: = String()
var cmd_num_rx: = 0 ## Номер команды принятый.
var cmd_num_tx: = 0 ## Номер команды переданный.
var cmd_state = CmdState.UNCK ## Состояние выполнения команды.
var cmd_result: = 1 ## Результат выполнения команды. Устанавливается в ЯУ-07.
var cmd_data: = PackedByteArray() ## Данные команды. Устанавливается в ЯУ-07.
var cmd_retry = 0 ## Счётчик оставшихся попыток выполнить команду.
var tick = 0.0 ## Текущее тик-время в мс.
var cmd_tick_tx = 0.0 ## Время последней отправки команды.
var cmd_tick_rx = 0.0 ## Время последнего приёма команды.
var status: = PackedByteArray() ## Поле "состояние прибора".
var tx_data: = PackedByteArray() ## Буфер отправленный.
var tx_len = 0 ## Длина последнего отправленного пакета.
var isa_ports = {} ## Результат выполнения команды "читать порт".
var isa_block = {} ## Результат выполнения команды "читать массив из порта".
var online = false ## Состояние связи с ячейкой.
func _to_string() -> String: return String('яу07: %s %s' % [self.name, ['отключен', 'на связи'][int(online)]])

5
table/editl.tscn Normal file
View File

@@ -0,0 +1,5 @@
[gd_scene format=3 uid="uid://bvbvtgwps54yr"]
[node name="Editl" type="LineEdit"]
caret_blink = true
caret_blink_interval = 0.5

5
table/empti.tscn Normal file
View File

@@ -0,0 +1,5 @@
[gd_scene format=3 uid="uid://bwesvho0mk6qk"]
[node name="Empti" type="Label"]
offset_right = 48.0
offset_bottom = 19.0

16
table/lable.tscn Normal file
View File

@@ -0,0 +1,16 @@
[gd_scene load_steps=2 format=3 uid="uid://dwphmxstaxn4v"]
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yign5"]
bg_color = Color(0.117647, 0.117647, 0.117647, 0.85098)
border_width_bottom = 2
border_color = Color(0.0562916, 0.0562916, 0.0562916, 1)
corner_radius_top_left = 3
corner_radius_top_right = 3
corner_radius_bottom_right = 3
corner_radius_bottom_left = 5
[node name="Lable" type="Label"]
offset_right = 104.0
offset_bottom = 24.0
theme_override_colors/font_color = Color(1, 0.596078, 0.4, 1)
theme_override_styles/normal = SubResource("StyleBoxFlat_yign5")

13
table/taggle.tscn Normal file
View File

@@ -0,0 +1,13 @@
[gd_scene format=3 uid="uid://dm7hh7ibuin78"]
[node name="Control" type="Control"]
layout_mode = 3
anchors_preset = 0
offset_right = 96.0
offset_bottom = 24.0
[node name="CheckButton" type="CheckButton" parent="."]
layout_mode = 0
offset_left = 30.0
offset_right = 74.0
offset_bottom = 24.0