Compare commits
106 Commits
f89540dfdc
...
sasha
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12fbb1fd55 | ||
|
|
fd9cf0317f | ||
|
|
4843d3294a | ||
|
|
b7a5d24de8 | ||
|
|
0c36709b54 | ||
|
|
3eb35faa77 | ||
|
|
167048af54 | ||
|
|
f62dab4e4e | ||
|
|
7e31052148 | ||
|
|
6864b960fb | ||
|
|
5ad837ea3e | ||
|
|
53f555690b | ||
|
|
662bf5cfc5 | ||
|
|
b74976842e | ||
|
|
df69a74411 | ||
|
|
c1762514d6 | ||
|
|
f3a72a9150 | ||
|
|
cfa2911f92 | ||
|
|
ef28b9a4bd | ||
|
|
3c48402f96 | ||
|
|
a9a40f241a | ||
|
|
0354c59128 | ||
|
|
c270d652c3 | ||
|
|
98d1bdcca4 | ||
|
|
46930fa520 | ||
|
|
adf0b62578 | ||
|
|
23412f9d78 | ||
|
|
17460b5b0d | ||
|
|
d622001db6 | ||
|
|
98cc111092 | ||
|
|
4db6060ed7 | ||
|
|
64b120b086 | ||
|
|
32f2649734 | ||
|
|
28704039d2 | ||
|
|
88b350cdba | ||
|
|
bee611be07 | ||
|
|
ed82e5b67d | ||
|
|
dfe88a1205 | ||
|
|
388b92836c | ||
|
|
5f14600459 | ||
|
|
37eb6f75a4 | ||
|
|
e6ea873294 | ||
|
|
20eec6e8be | ||
|
|
0c8f02bc77 | ||
|
|
bfb9d3a4e8 | ||
|
|
5eb44fd20a | ||
|
|
5b1984a307 | ||
|
|
dd642ea057 | ||
|
|
63de1118b0 | ||
|
|
831b2e0ea8 | ||
|
|
423411cf94 | ||
|
|
8f2a6b031b | ||
|
|
2e5edc793e | ||
|
|
b273a01bf5 | ||
|
|
c6ed61b6ce | ||
|
|
7954048f11 | ||
|
|
6b8f767a89 | ||
|
|
8c330d08a6 | ||
|
|
a8b085a514 | ||
|
|
3fb2601aca | ||
|
|
38c2aa9f80 | ||
|
|
f39212232a | ||
|
|
dc362ad26f | ||
|
|
208406971f | ||
|
|
9eb31c0d4a | ||
|
|
033e9869f1 | ||
|
|
5e78e06626 | ||
|
|
56a0fd8af8 | ||
|
|
5293313f0e | ||
|
|
04da0d0cfd | ||
|
|
89bc19ec98 | ||
|
|
9f32e293a0 | ||
|
|
217281ce51 | ||
|
|
de86d281ca | ||
|
|
9727eb04a9 | ||
|
|
e1cd37bcfd | ||
|
|
dcd806309c | ||
|
|
3915bd59d1 | ||
|
|
69b455f811 | ||
|
|
9856e300e9 | ||
|
|
87e360e1a9 | ||
|
|
2980aa9f15 | ||
|
|
5b5b5d31c6 | ||
|
|
1785d23e43 | ||
|
|
85c02f3f6c | ||
|
|
3f469935bc | ||
|
|
15be378743 | ||
|
|
6ea649cf31 | ||
|
|
78b6f5a14e | ||
|
|
1e500dec2c | ||
|
|
6a5eae450c | ||
|
|
f6ee2d95a4 | ||
|
|
94f0eccaa1 | ||
|
|
2d4fd57789 | ||
|
|
71176c4869 | ||
|
|
36e47bbd13 | ||
|
|
cebf645e4d | ||
|
|
77e15627d0 | ||
|
|
effbbb9272 | ||
|
|
56343338c2 | ||
|
|
3bff1cd90f | ||
|
|
5657892887 | ||
|
|
606f5ea689 | ||
|
|
6c62419bdb | ||
|
|
5991a079c7 | ||
|
|
2a29e4bd54 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,7 +2,6 @@
|
||||
.import/
|
||||
.dev/
|
||||
export.cfg
|
||||
export_presets.cfg
|
||||
|
||||
# Imported translations (automatically generated from CSV files)
|
||||
*.translation
|
||||
|
||||
17
README.md
17
README.md
@@ -1,9 +1,20 @@
|
||||
# Разработка
|
||||
|
||||
- После клонирования запустить скрипт `git-hooks-config.sh`
|
||||
- В среде **Windows** запуск скрипта `git-hooks-config.sh` производить из оболочки `git bash`
|
||||
- При необходимости обновить `settings.json`
|
||||
- Использовать выражения вида `ProjectSettings.set_setting('application/config/%s' % key_name`
|
||||
и `ProjectSettings.get_setting('application/config/%s % key_name)` для доступа к настройкам.
|
||||
- `key_name` брать из таблицы `res://scenes/настройки/настройки.gd/SETTING_TABLE`
|
||||
- Следовать [общим правилам](http://gitea.srez.local:3000/sasha80/gitea-tniis).
|
||||
|
||||
# Ссылки на составные части
|
||||
|
||||
- [Исполняемые файлы для шаблонов экспорта и редактора](http://gitea.srez.local:3000/sasha80/godot-bin)
|
||||
- [Проброс последовательных портов через Ethernet](http://gitea.srez.local:3000/sasha80/uart-forwarder)
|
||||
- [Сборка Godot из исходников](http://gitea.srez.local:3000/sasha80/godot-build)
|
||||
- [Сервер карт](http://gitea.srez.local:3000/sasha80/map-tiles)
|
||||
- [Генераторы PCM файлов для модулей ФС](http://gitea.srez.local:3000/danil_tim/Signals_to_the_MP-550)
|
||||
|
||||
# Ссылки на имитаторы
|
||||
|
||||
@@ -30,9 +41,3 @@
|
||||
необходимые для этого настройки.
|
||||
- Для доступа к последовательным портам расположенным на другом вычислительном модуле,
|
||||
следует использовать [проброс портов](http://gitea.srez.local:3000/sasha80/uart-forwarder).
|
||||
|
||||
# Разработка
|
||||
|
||||
- После клонирования запустить скрипт `git-hooks-config.sh`
|
||||
- В среде **Windows** запуск скрипта `git-hooks-config.sh` производить из оболочки `git bash`
|
||||
- Нужно обновить `settings.json`
|
||||
|
||||
2
build.sh
2
build.sh
@@ -12,6 +12,8 @@ TARGET_BIN="uarep-ctl.linux.x86_64"
|
||||
# Путь к папке в которой будет расположен исполняемый файл (загружаемый модуль)
|
||||
TARGET_PATH="./bin"
|
||||
|
||||
mkdir "${TARGET_PATH}"
|
||||
|
||||
# Путь к исполняемому файлу редактора Godot
|
||||
EDITOR="/opt/godot/godot.linuxbsd.editor.x86_64"
|
||||
|
||||
|
||||
223
config/setting_prd_control.json
Normal file
223
config/setting_prd_control.json
Normal file
@@ -0,0 +1,223 @@
|
||||
{
|
||||
"config_version": "1.0.0",
|
||||
"device_constants": {
|
||||
"PRD_N": {
|
||||
"constants": {
|
||||
"POWER_UKP_1": 31,
|
||||
"POWER_UKP_2": 63,
|
||||
"DKM_BIT_2": 1,
|
||||
"DKM_BIT_3": 2,
|
||||
"BASE_ADDR_EMS_G": 288,
|
||||
"ADDR_UG_LITERA_1": 262,
|
||||
"ADDR_UG_LITERA_2": 264,
|
||||
"ADDR_UG_LITERA_3": 266,
|
||||
"TEMP_THRESHOLD": 70,
|
||||
"POWER_THRESHOLD": 40,
|
||||
"RAY_DOU_NUM": 3,
|
||||
"ATT_UM_2": 2,
|
||||
"ATT_UM_3": 3,
|
||||
"POWER_UM": 100,
|
||||
"TIMER_DELAY": 15.0,
|
||||
"STATE_MASHINE_TIMER": 0.2
|
||||
},
|
||||
"pribor_config": {
|
||||
"1н": {"angle": 0.0, "sectors": [4, 8]},
|
||||
"2н": {"angle": 90.0, "sectors": [7, 11]},
|
||||
"3н": {"angle": 180.0, "sectors": [6, 10]},
|
||||
"4н": {"angle": 270.0, "sectors": [5, 9]}
|
||||
},
|
||||
"fs_params": {
|
||||
"2": {"freq": 932.0, "width": 100.0},
|
||||
"3": {"freq": 1157.0, "width": 100.0}
|
||||
},
|
||||
"start_litera": 2
|
||||
},
|
||||
"PRD_V": {
|
||||
"constants": {
|
||||
"POWER_UKP_1": 31,
|
||||
"POWER_UKP_2": 63,
|
||||
"DKM_BIT_4": 3,
|
||||
"DKM_BIT_5": 4,
|
||||
"BASE_ADDR_EMS_G": 288,
|
||||
"ADDR_UG_LITERA_1": 262,
|
||||
"ADDR_UG_LITERA_2": 264,
|
||||
"ADDR_UG_LITERA_3": 266,
|
||||
"TEMP_THRESHOLD": 70,
|
||||
"POWER_THRESHOLD": 40,
|
||||
"RAY_DOU_NUM": 3,
|
||||
"ATT_UM_4": 2,
|
||||
"ATT_UM_5": 3,
|
||||
"POWER_UM": 100,
|
||||
"TIMER_DELAY": 15.0,
|
||||
"STATE_MASHINE_TIMER": 0.2
|
||||
},
|
||||
"pribor_config": {
|
||||
"1в": {"angle": 0.0, "sectors": [12, 16]},
|
||||
"2в": {"angle": 90.0, "sectors": [15, 19]},
|
||||
"3в": {"angle": 180.0, "sectors": [14, 18]},
|
||||
"4в": {"angle": 270.0, "sectors": [13, 17]}
|
||||
},
|
||||
"fs_params": {
|
||||
"4": {"freq": 1227.0, "width": 100.0},
|
||||
"5": {"freq": 1575.0, "width": 110.0}
|
||||
},
|
||||
"start_litera": 4
|
||||
},
|
||||
"PRD_K": {
|
||||
"constants": {
|
||||
"POWER_UKP_1": 31,
|
||||
"POWER_UKP_2": 63,
|
||||
"DKM_BIT_1": 0,
|
||||
"DKM_BIT_6": 5,
|
||||
"DKM_BIT_7": 6,
|
||||
"BASE_ADDR_EMS_G": 288,
|
||||
"ADDR_UG_LITERA_1": 262,
|
||||
"ADDR_UG_LITERA_2": 264,
|
||||
"ADDR_UG_LITERA_3": 266,
|
||||
"TEMP_THRESHOLD": 40,
|
||||
"POWER_THRESHOLD": 40,
|
||||
"RAY_DOU_NUM": 3,
|
||||
"ATT_UM_1": 0,
|
||||
"ATT_UM_6": 3,
|
||||
"ATT_UM_7": 2,
|
||||
"POWER_UM": 100,
|
||||
"TIMER_DELAY": 15.0,
|
||||
"STATE_MASHINE_TIMER": 0.2
|
||||
},
|
||||
"pribor_config": {
|
||||
"1к": {"angle": 0.0, "sectors": [0, 20, 24]},
|
||||
"2к": {"angle": 90.0, "sectors": [3, 23, 27]},
|
||||
"3к": {"angle": 180.0, "sectors": [2, 22, 26]},
|
||||
"4к": {"angle": 270.0, "sectors": [1, 21, 25]}
|
||||
},
|
||||
"fs_params": {
|
||||
"1": {"freq": 450.0, "width": 80.0},
|
||||
"6": {"freq": 2450.0, "width": 110.0},
|
||||
"7": {"freq": 4750.0, "width": 110.0}
|
||||
},
|
||||
"start_litera": 1
|
||||
}
|
||||
},
|
||||
"base_configs": {
|
||||
"block_ip": {
|
||||
"maa2000_1": [0, false],
|
||||
"maa2000_2": [1, false],
|
||||
"ip9_50_1": [2, false],
|
||||
"ip9_50_2": [3, false],
|
||||
"ip12_50_1": [4, false],
|
||||
"ip5_25": [7, false]
|
||||
},
|
||||
"block_kasseta": {
|
||||
"yau07": false,
|
||||
"ems": false,
|
||||
"ug": false,
|
||||
"ukp1": false,
|
||||
"ukp2": false
|
||||
}
|
||||
},
|
||||
"device_configs": {
|
||||
"PRD_N": {
|
||||
"block_ip": "base",
|
||||
"block_kasseta": "base",
|
||||
"control_results": {
|
||||
"block_kasseta":false,
|
||||
"block_ip": false,
|
||||
"temperature": true,
|
||||
"dkm_2": false,
|
||||
"dkm_3": false,
|
||||
"dou_2": false,
|
||||
"dou_3": false,
|
||||
"fs_2": false,
|
||||
"fs_3": false,
|
||||
"is_over_control": false
|
||||
}
|
||||
},
|
||||
"PRD_V": {
|
||||
"block_ip": "base",
|
||||
"block_kasseta": "base",
|
||||
"control_results": {
|
||||
"block_kasseta":false,
|
||||
"block_ip": false,
|
||||
"temperature": true,
|
||||
"dkm_4": false,
|
||||
"dkm_5": false,
|
||||
"dou_4": false,
|
||||
"dou_5": false,
|
||||
"fs_4": false,
|
||||
"fs_5": false,
|
||||
"is_over_control": false
|
||||
}
|
||||
},
|
||||
"PRD_K": {
|
||||
"block_ip": {
|
||||
"maa2000_1": [0, false],
|
||||
"maa2000_2": [1, false],
|
||||
"ip9_50_1": [2, false],
|
||||
"ip9_50_2": [3, false],
|
||||
"ip12_50_1": [4, false],
|
||||
"ip9_50_3": [5, false],
|
||||
"ip12_50_2": [6, false],
|
||||
"ip5_25": [7, false]
|
||||
},
|
||||
"block_kasseta": "base",
|
||||
"control_results": {
|
||||
"block_kasseta":false,
|
||||
"block_ip": false,
|
||||
"temperature": true,
|
||||
"dkm_1": false,
|
||||
"dkm_6": false,
|
||||
"dkm_7": false,
|
||||
"dou_6": false,
|
||||
"dou_7": false,
|
||||
"fs_1": false,
|
||||
"fs_6": false,
|
||||
"fs_7": false,
|
||||
"is_over_control": false
|
||||
}
|
||||
}
|
||||
},
|
||||
"ray_types": ["RAY_m5", "RAY_5", "RAY_15", "RAY_25", "RAY_35", "RAY_45"],
|
||||
"data_indices": {
|
||||
"STATUS_BOARD": 0,
|
||||
"IN_BLANK_PRD": 1,
|
||||
"IN_IMPULS_PRD": 7,
|
||||
"OUT_BLANK_PRD": 13,
|
||||
"OUT_IMPULS_PRD": 19,
|
||||
"DRY_CONTACT": 27,
|
||||
"DKM": 28,
|
||||
"POWER_UKP_1": 31,
|
||||
"TEMPERATURE_UKP_1": 47,
|
||||
"POWER_UKP_2": 63,
|
||||
"TEMPERATURE_UKP_2": 79
|
||||
},
|
||||
"fs_keys": {
|
||||
"1": "fs_1",
|
||||
"2": "fs_2",
|
||||
"3": "fs_3",
|
||||
"4": "fs_4",
|
||||
"5": "fs_5",
|
||||
"6": "fs_6",
|
||||
"7": "fs_7"
|
||||
},
|
||||
"temperature_constants": {
|
||||
"CONST_MIN_TEMP": -25,
|
||||
"MAXIMUM_CODE_ADC": 3796,
|
||||
"MINIMUM_CODE_AD": 2660,
|
||||
"TEMPERATURE_UKP_1": 47,
|
||||
"TEMPERATURE_UKP_2": 79
|
||||
},
|
||||
"ems_input_bits_config": {
|
||||
"PRD_N": {"bit1": 9, "bit2": 10},
|
||||
"PRD_V": {"bit1": 11, "bit2": 12},
|
||||
"PRD_K": {"bit1": 13, "bit2": 14, "bit_lit": 8}
|
||||
},
|
||||
"fs_rules":[
|
||||
{"key": "fs_1", "min": 0, "max": 4},
|
||||
{"key": "fs_2", "min": 4, "max": 8},
|
||||
{"key": "fs_3", "min": 8, "max": 12},
|
||||
{"key": "fs_4", "min": 12, "max": 16},
|
||||
{"key": "fs_5", "min": 16, "max": 20},
|
||||
{"key": "fs_6", "min": 20, "max": 24},
|
||||
{"key": "fs_7", "min": 24, "max": 28}
|
||||
]
|
||||
}
|
||||
|
Before Width: | Height: | Size: 125 B After Width: | Height: | Size: 125 B |
@@ -2,16 +2,16 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bw3yv3smvaxqn"
|
||||
path="res://.godot/imported/nine-patch.png-798f7950fb3126b4e1ed0c39d9e4beba.ctex"
|
||||
uid="uid://vqajxsh5xamt"
|
||||
path="res://.godot/imported/nine-patch.png-b3022b5c868bc85e271b731e8fa2ec8a.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://table/nine-patch.png"
|
||||
dest_files=["res://.godot/imported/nine-patch.png-798f7950fb3126b4e1ed0c39d9e4beba.ctex"]
|
||||
source_file="res://data/nine-patch.png"
|
||||
dest_files=["res://.godot/imported/nine-patch.png-b3022b5c868bc85e271b731e8fa2ec8a.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
dot -Tpng "структура.dot" -o "структура.png"
|
||||
pandoc -f markdown_strict --verbose "README.md" > "README.doc"
|
||||
@@ -1,38 +0,0 @@
|
||||
digraph "Прибор УФ"
|
||||
{
|
||||
graph [nodesep=0.5, overlap = false];
|
||||
node [shape=box, overlap = false];
|
||||
eth0 [label="eth0", shape=cds];
|
||||
eth1 [label="eth1", shape=cds];
|
||||
eth2 [label="eth2", shape=cds];
|
||||
tty0 [label="tty0", shape=cds];
|
||||
tty1 [label="tty1", shape=cds];
|
||||
tty2 [label="tty2", shape=cds];
|
||||
proto_capsrpb [label="Протокол КАПС-РПБ"];
|
||||
proto_5p28 [label="Протокол 5П-28"];
|
||||
uarep_uart [label="UART ModBus"];
|
||||
uarep_ctl [label="ПО УАРЭП"];
|
||||
caps_rpb [label="СПО \"КАПС РПБ\""];
|
||||
p16 [label="П16", shape=plaintext, style=filled];
|
||||
spt25left [label="СПТ25 левый борт", shape=plaintext, style=filled];
|
||||
spt25right [label="СПТ25 правый борт", shape=plaintext, style=filled];
|
||||
|
||||
eth0 -> proto_5p28;
|
||||
eth1 -> proto_5p28;
|
||||
eth0 -> proto_capsrpb;
|
||||
eth1 -> proto_capsrpb;
|
||||
eth0 -> uarep_uart;
|
||||
eth1 -> uarep_uart;
|
||||
eth2 -> caps_rpb;
|
||||
proto_5p28 -> uarep_ctl;
|
||||
uarep_uart -> uarep_ctl;
|
||||
uarep_uart -> tty0;
|
||||
uarep_uart -> tty1;
|
||||
uarep_uart -> tty2;
|
||||
uarep_ctl -> caps_rpb;
|
||||
proto_capsrpb -> caps_rpb;
|
||||
p16 -> eth0 [style=invis]
|
||||
p16 -> eth1 [style=invis]
|
||||
spt25left -> tty0 [style=invis]
|
||||
spt25right -> tty1 [style=invis]
|
||||
}
|
||||
112
export_presets.cfg
Normal file
112
export_presets.cfg
Normal file
@@ -0,0 +1,112 @@
|
||||
[preset.0]
|
||||
|
||||
name="Linux-X11"
|
||||
platform="Linux"
|
||||
runnable=true
|
||||
advanced_options=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="bin/uarep-ctl.linux.x86_64"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=0
|
||||
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=2
|
||||
binary_format/embed_pck=true
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
ssh_remote_deploy/enabled=true
|
||||
ssh_remote_deploy/host="user@192.168.11.105"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
export DISPLAY=:0
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
texture_format/bptc=true
|
||||
texture_format/s3tc=true
|
||||
texture_format/etc=false
|
||||
texture_format/etc2=false
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Windows Desktop"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
advanced_options=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="bin/uarep-ctl.exe"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=0
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release=""
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=true
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
codesign/enable=false
|
||||
codesign/timestamp=true
|
||||
codesign/timestamp_server_url=""
|
||||
codesign/digest_algorithm=1
|
||||
codesign/description=""
|
||||
codesign/custom_options=PackedStringArray()
|
||||
application/modify_resources=true
|
||||
application/icon=""
|
||||
application/console_wrapper_icon=""
|
||||
application/icon_interpolation=4
|
||||
application/file_version=""
|
||||
application/product_version=""
|
||||
application/company_name=""
|
||||
application/product_name=""
|
||||
application/file_description=""
|
||||
application/copyright=""
|
||||
application/trademarks=""
|
||||
application/export_angle=0
|
||||
application/export_d3d12=0
|
||||
application/d3d12_agility_sdk_multiarch=true
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}'
|
||||
$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}'
|
||||
$trigger = New-ScheduledTaskTrigger -Once -At 00:00
|
||||
$settings = New-ScheduledTaskSettingsSet
|
||||
$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings
|
||||
Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true
|
||||
Start-ScheduledTask -TaskName godot_remote_debug
|
||||
while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 }
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue"
|
||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
@@ -35,8 +35,8 @@ func get_radius_outter() -> float: return material.get('shader_parameter/radius
|
||||
func get_radius_inner_0() -> float: return material.get('shader_parameter/radius_inner_0')
|
||||
func get_radius_inner_1() -> float: return material.get('shader_parameter/radius_inner_1')
|
||||
|
||||
func get_band_colors(val: Array): return material.get('shader_parameter/ant_band_c')
|
||||
func get_band_failures(val: Array): return material.get('shader_parameter/ant_band_m')
|
||||
func get_band_colors(_val: Array): return material.get('shader_parameter/ant_band_c')
|
||||
func get_band_failures(_val: Array): return material.get('shader_parameter/ant_band_m')
|
||||
func set_band_colors(val: Array): material.set('shader_parameter/ant_band_c', val)
|
||||
func set_band_failures(val: Array): material.set('shader_parameter/ant_band_m', val)
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
strips_rotation = 15.0
|
||||
text = "СПРС"
|
||||
text = "JTIDS"
|
||||
metadata/rfi_name = "sprs"
|
||||
|
||||
[node name="btn_kupd" parent="grd_forced" groups=["группа-принудительно"] instance=ExtResource("4_7ys3c")]
|
||||
|
||||
@@ -8,7 +8,7 @@ const TableHeader = preload('res://table/header.tscn') ## Ячейка за
|
||||
const TABLE_HEADER = [ TableHeader, TableHeader, TableHeader , TableHeader ] ## Описание ряда заголовка.
|
||||
const TABLE_ROW = [ CellLineEdit, CellLineEdit, CellLineEdit , CellLineEdit ] ## Описание ряда.
|
||||
const TABLE_HEADERS_TEXT = ['№', 'Название', 'Пеленг', 'Состояние' ] ## Заголовки таблицы.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 100, 95, 185 ] ## Ширины колонок.
|
||||
const TABLE_COLUMN_SIZE = [ 65, 100, 90, 170 ] ## Ширины колонок.
|
||||
|
||||
## Состояние выполнения сеанса помехи
|
||||
const INTERFER_STATE = {
|
||||
|
||||
@@ -75,7 +75,7 @@ func on_threat_update(th, table_index: Dictionary):
|
||||
elif th.emit_state == 2:
|
||||
emit_txr.visible = true
|
||||
emit_txr.self_modulate = Color.RED
|
||||
|
||||
|
||||
|
||||
|
||||
## Обрабатывает сигнал [b]threat_lost[/b].
|
||||
|
||||
@@ -147,6 +147,6 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
strips_rotation = 30.0
|
||||
text = "ЕПРЛС"
|
||||
text = "ЕРЛС"
|
||||
disabled = true
|
||||
metadata/rfi_name = "eprls"
|
||||
|
||||
@@ -30,7 +30,9 @@ autostart = true
|
||||
|
||||
[node name="bort" parent="." instance=ExtResource("3_d7iti")]
|
||||
layout_mode = 0
|
||||
offset_left = 24.0
|
||||
offset_top = 27.7778
|
||||
offset_right = 604.0
|
||||
offset_bottom = 1216.78
|
||||
metadata/DeviceName = &"Устройство РР левого борта"
|
||||
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
[node name="pribor_afsp" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 81.0
|
||||
offset_left = 82.0
|
||||
offset_top = 108.0
|
||||
offset_right = 81.0
|
||||
offset_right = 82.0
|
||||
offset_bottom = 108.0
|
||||
scale = Vector2(1, 0.9)
|
||||
script = ExtResource("1_tfses")
|
||||
@@ -30,9 +30,9 @@ autostart = true
|
||||
|
||||
[node name="bort" parent="." instance=ExtResource("3_xpxb5")]
|
||||
layout_mode = 0
|
||||
offset_left = -11.0
|
||||
offset_left = 12.0
|
||||
offset_top = -59.0
|
||||
offset_right = 569.0
|
||||
offset_right = 592.0
|
||||
offset_bottom = 1130.0
|
||||
metadata/DeviceName = &"Устройство РР правого борта"
|
||||
|
||||
|
||||
@@ -99,4 +99,4 @@ func _on_request_completed(result, _response_code, headers, body: PackedByteArra
|
||||
func _on_item_pressed(block_a: Control):
|
||||
var metas = block_a.get_meta_list()
|
||||
for n in metas:
|
||||
var v = block_a.get_meta(n)
|
||||
var _v = block_a.get_meta(n)
|
||||
|
||||
@@ -9,9 +9,9 @@
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = 115.0
|
||||
offset_top = 150.0
|
||||
offset_top = 148.0
|
||||
offset_right = 115.0
|
||||
offset_bottom = 150.0
|
||||
offset_bottom = 148.0
|
||||
script = ExtResource("1_bhc4e")
|
||||
prefix_path = "DeviceDescription[DeviceName]"
|
||||
this_bpo1_name = "Устройство БПО левого борта"
|
||||
@@ -24,10 +24,10 @@ settings_path_to_wait_time = "Период опроса состояния БП
|
||||
|
||||
[node name="mod_pit_g1" parent="." instance=ExtResource("2_jp6m0")]
|
||||
layout_mode = 2
|
||||
offset_left = 40.0
|
||||
offset_top = 535.0
|
||||
offset_right = 560.0
|
||||
offset_bottom = 605.0
|
||||
offset_left = 9.0
|
||||
offset_top = 377.0
|
||||
offset_right = 529.0
|
||||
offset_bottom = 447.0
|
||||
size_flags_horizontal = 7
|
||||
size_flags_vertical = 7
|
||||
fname = "Модуль электропитания"
|
||||
@@ -35,20 +35,20 @@ rname = "G1"
|
||||
|
||||
[node name="blok_bpo_a1" parent="." instance=ExtResource("2_jp6m0")]
|
||||
layout_mode = 0
|
||||
offset_left = 40.0
|
||||
offset_top = 135.0
|
||||
offset_right = 560.0
|
||||
offset_bottom = 330.0
|
||||
offset_left = 9.0
|
||||
offset_top = -23.0
|
||||
offset_right = 529.0
|
||||
offset_bottom = 172.0
|
||||
show_state = false
|
||||
fname = "Блок БПО левого борта"
|
||||
rname = "А1"
|
||||
|
||||
[node name="grid_bpo_a1" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 50.0
|
||||
offset_top = 175.0
|
||||
offset_right = 498.0
|
||||
offset_bottom = 320.0
|
||||
offset_left = 19.0
|
||||
offset_top = 17.0
|
||||
offset_right = 467.0
|
||||
offset_bottom = 162.0
|
||||
columns = 4
|
||||
|
||||
[node name="kanal1" parent="grid_bpo_a1" groups=["потребитель-питания"] instance=ExtResource("2_jp6m0")]
|
||||
@@ -108,30 +108,30 @@ fname = "Канал 8"
|
||||
metadata/state = "SelfTest[0].SystemList[0].DevList[7]['TestPassed']"
|
||||
|
||||
[node name="yas_bpo_a1" parent="." groups=["потребитель-питания"] instance=ExtResource("3_jcpjs")]
|
||||
offset_left = 500.0
|
||||
offset_top = 175.0
|
||||
offset_right = 550.0
|
||||
offset_bottom = 320.0
|
||||
offset_left = 469.0
|
||||
offset_top = 17.0
|
||||
offset_right = 519.0
|
||||
offset_bottom = 162.0
|
||||
show_rname = false
|
||||
self_size = Vector2i(50, 145)
|
||||
fname = "Яч. связи"
|
||||
|
||||
[node name="blok_bpo_a2" parent="." instance=ExtResource("2_jp6m0")]
|
||||
layout_mode = 0
|
||||
offset_left = 40.0
|
||||
offset_top = 335.0
|
||||
offset_right = 560.0
|
||||
offset_bottom = 530.0
|
||||
offset_left = 9.0
|
||||
offset_top = 177.0
|
||||
offset_right = 529.0
|
||||
offset_bottom = 372.0
|
||||
show_state = false
|
||||
fname = "Блок БПО правого борта"
|
||||
rname = "А2"
|
||||
|
||||
[node name="grid_bpo_a2" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 50.0
|
||||
offset_top = 375.0
|
||||
offset_right = 498.0
|
||||
offset_bottom = 520.0
|
||||
offset_left = 19.0
|
||||
offset_top = 217.0
|
||||
offset_right = 467.0
|
||||
offset_bottom = 362.0
|
||||
columns = 4
|
||||
|
||||
[node name="kanal1" parent="grid_bpo_a2" groups=["потребитель-питания", "управляется-по-шине-2"] instance=ExtResource("2_jp6m0")]
|
||||
@@ -191,10 +191,10 @@ fname = "Канал 8"
|
||||
metadata/state = "SelfTest[0].SystemList[0].DevList[7]['TestPassed']"
|
||||
|
||||
[node name="yas_bpo_a2" parent="." groups=["потребитель-питания"] instance=ExtResource("3_jcpjs")]
|
||||
offset_left = 500.0
|
||||
offset_top = 375.0
|
||||
offset_right = 550.0
|
||||
offset_bottom = 520.0
|
||||
offset_left = 469.0
|
||||
offset_top = 217.0
|
||||
offset_right = 519.0
|
||||
offset_bottom = 362.0
|
||||
show_rname = false
|
||||
self_size = Vector2i(50, 145)
|
||||
fname = "Яч. связи"
|
||||
|
||||
@@ -49,7 +49,7 @@ offset_top = 33.0
|
||||
offset_right = 155.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Блок ФС-2"
|
||||
rname = "A2"
|
||||
rname = "A6"
|
||||
|
||||
[node name="ref_A6" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
|
||||
offset_left = 155.0
|
||||
@@ -57,7 +57,7 @@ offset_top = 33.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A5"
|
||||
rname = "A3"
|
||||
metadata/fs = "fs_6"
|
||||
|
||||
[node name="ref_A5" parent="." groups=["default_reset", "fs_group"] instance=ExtResource("3_kqnvt")]
|
||||
@@ -66,7 +66,7 @@ offset_top = 33.0
|
||||
offset_right = 255.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A3"
|
||||
rname = "A2"
|
||||
metadata/fs = "fs_7"
|
||||
|
||||
[node name="ref_A7" parent="." groups=["default_reset"] instance=ExtResource("3_kqnvt")]
|
||||
@@ -75,4 +75,4 @@ offset_top = 33.0
|
||||
offset_right = 305.0
|
||||
offset_bottom = 183.0
|
||||
fname = "Блок ФС-6"
|
||||
rname = "A6"
|
||||
rname = "A5"
|
||||
|
||||
@@ -1,252 +1,197 @@
|
||||
@tool
|
||||
extends 'res://scenes/контроль/прибор.gd'
|
||||
|
||||
const constants_k: Dictionary = {
|
||||
'POWER_UKP_1': 31,
|
||||
'POWER_UKP_2': 63,
|
||||
'DKM_BIT_1': 0,
|
||||
'DKM_BIT_6': 5,
|
||||
'DKM_BIT_7': 6,
|
||||
'BASE_ADDR_EMS_G': 0x120,
|
||||
'ADDR_UG_LITERA_1': 0x106,
|
||||
'ADDR_UG_LITERA_2': 0x108,
|
||||
'ADDR_UG_LITERA_3': 0x10A,
|
||||
'TEMP_THRESHOLD': 40,
|
||||
'POWER_THRESHOLD': 40,
|
||||
'RAY_DOU_NUM': 0x3,
|
||||
'ATT_UM_1': 0x0,
|
||||
'ATT_UM_6': 0x3,
|
||||
'ATT_UM_7': 0x2,
|
||||
'POWER_UM': 100,
|
||||
'TIMER_DELAY': 10.0,
|
||||
'STATE_MASHINE_TIMER': 0.3,
|
||||
}
|
||||
# Конфигурация параметров для каждого прибора
|
||||
const PRIBOR_CONFIG := {
|
||||
'1к': {'angle': 0.0, 'sectors': [0, 20, 24]},
|
||||
'2к': {'angle': 90.0, 'sectors': [3, 23, 27]},
|
||||
'3к': {'angle': 180.0, 'sectors': [2, 22, 26]},
|
||||
'4к': {'angle': 270.0, 'sectors': [1, 21, 25]},
|
||||
}
|
||||
# Конфигурация частот и ширин для каждого ФС
|
||||
const FS_PARAMS := {
|
||||
1: {'freq': 450.0, 'width': 80.0},
|
||||
6: {'freq': 2450.0, 'width': 110.0},
|
||||
7: {'freq': 4750.0, 'width': 110.0}
|
||||
}
|
||||
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
|
||||
|
||||
var block_ip_config_k := {
|
||||
'maa2000_1': [0, false],
|
||||
'maa2000_2': [1, false],
|
||||
'ip9_50_1': [2, false],
|
||||
'ip9_50_2': [3, false],
|
||||
'ip12_50_1': [4, false],
|
||||
'ip9_50_3': [5, false],
|
||||
'ip12_50_2': [6, false],
|
||||
'ip5_25': [7, false],
|
||||
}
|
||||
var block_kasseta_y5_prd_config_k: = {
|
||||
'yau07': false,
|
||||
'ems': false,
|
||||
'ug': false,
|
||||
'ukp1': false,
|
||||
'ukp2': false,
|
||||
}
|
||||
# Основные переменные
|
||||
var start_litera: int = 1
|
||||
var ug_work_1: int = 3 ## Аттенюация усилителей мощности
|
||||
var ug_work_2: int = 2 ## Аттенюация усилителей мощности
|
||||
var ug_work_3: int = 0 ## Аттенюация усилителей мощности
|
||||
var mashine_timer: Timer = Timer.new()
|
||||
var prd_k_module: Object
|
||||
var unit_prd_k: Object
|
||||
var control_prd_k: Object
|
||||
# Результаты контроля
|
||||
var control_results_k: Dictionary = {
|
||||
'block_ip': false, # Проверка касет П1 и ИП МА2000
|
||||
'temperature': true,
|
||||
'dkm_1': false,
|
||||
'dkm_6': false,
|
||||
'dkm_7': false,
|
||||
'dou_6': false,
|
||||
'dou_7': false,
|
||||
'fs_1': 2,
|
||||
'fs_6': 2,
|
||||
'fs_7': 2,
|
||||
}
|
||||
|
||||
var test_control_k = preload('res://scripts/pribor-prd.gd')
|
||||
var ctrl_pos = 30
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
initialize_connections()
|
||||
setup_timer()
|
||||
set_default_state()
|
||||
find_labels(self)
|
||||
|
||||
|
||||
func on_state_mashine() -> void:
|
||||
control_prd_k.state_control_machine()
|
||||
|
||||
|
||||
func initialize_connections() -> void:
|
||||
var unit_name = get_meta('unit_name')[0]
|
||||
prd_k_module = prd.prd_dict[unit_name]
|
||||
unit_prd_k = prd_k_module.unit_yau07
|
||||
|
||||
unit_prd_k.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
var init_data: Dictionary = {
|
||||
'control_label': $control_result,
|
||||
'power_amplifiers': power_amplifiers,
|
||||
'unit_prd': unit_prd_k,
|
||||
'module_prd' : prd_k_module,
|
||||
'constants': constants_k,
|
||||
'prd_config': PRIBOR_CONFIG,
|
||||
'fs_params': FS_PARAMS,
|
||||
'block_ip_prd_config': block_ip_config_k,
|
||||
'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_k,
|
||||
'control_results': control_results_k,
|
||||
'current_litera': start_litera,
|
||||
}
|
||||
control_prd_k = test_control_k.TestPRD.new(init_data)
|
||||
add_child(control_prd_k)
|
||||
control_prd_k.connect('control_is_over', Callable(self, 'on_control_result'))
|
||||
var prd_k_module = prd.prd_dict[unit_name]
|
||||
unit_prd_k = prd_k_module.unit_control
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
# Подписываемся на сигналы
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_control'))
|
||||
unit_prd_k.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
unit_prd_k.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||
# Устанавливаем начальный статус
|
||||
_update_status_text(unit_prd_k.get_current_status())
|
||||
on_press_device(unit_prd_k.self_name)
|
||||
|
||||
|
||||
func setup_timer() -> void:
|
||||
add_child(mashine_timer)
|
||||
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
|
||||
mashine_timer.wait_time = constants_k.STATE_MASHINE_TIMER
|
||||
mashine_timer.start()
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_k.ems_g_sock_dic.ems_input_1)
|
||||
set_frame($input_1, unit_prd_k.ems_g_sock_dic.ems_input_2)
|
||||
set_frame($input_2, unit_prd_k.ems_g_sock_dic.ems_input_lit_1)
|
||||
set_frame($output_0, unit_prd_k.ems_g_sock_dic.ems_output_1)
|
||||
set_frame($output_1, unit_prd_k.ems_g_sock_dic.ems_output_2)
|
||||
set_frame($output_2, unit_prd_k.ems_g_sock_dic.ems_output_lit_1)
|
||||
|
||||
|
||||
func set_default_state() -> void:
|
||||
for group in get_tree().get_nodes_in_group('default_reset'):
|
||||
group.state = STATE_VAL.NONE
|
||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
|
||||
for group in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
|
||||
func _on_start_control() -> void:
|
||||
set_default_state(get_tree().get_nodes_in_group('default_reset'))
|
||||
set_default_state(get_tree().get_nodes_in_group('power_amplifier'))
|
||||
find_labels(self)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
on_press_device(unit_prd_k.self_name)
|
||||
|
||||
|
||||
static func set_default_state(default_reset_array_node: Array) -> void:
|
||||
for group in default_reset_array_node:
|
||||
group.state = STATE_VAL.NONE
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
$control_result.text = 'Выполняется ...'
|
||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
||||
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
|
||||
if unit_prd_k:
|
||||
_update_status_text(unit_prd_k.get_current_status())
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]])
|
||||
#prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]])
|
||||
|
||||
|
||||
func on_line_changed(unit_pribor: Object) -> void:
|
||||
if not unit_pribor.online:
|
||||
set_default_state()
|
||||
static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void:
|
||||
for i_node_temperature in temperature_arr_node:
|
||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||
if not temperature_dic.has(temperature_meta): return
|
||||
i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40
|
||||
|
||||
|
||||
func on_mode_changed(in_tree: bool) -> void:
|
||||
if not in_tree:
|
||||
mashine_timer.stop()
|
||||
prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]])
|
||||
signaller.emit_signal('interfer_off_all')
|
||||
else:
|
||||
set_default_state()
|
||||
control_prd_k.state = control_prd_k.STATE_MASHINE.INIT
|
||||
mashine_timer.start()
|
||||
|
||||
|
||||
func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void:
|
||||
#if not control_prd_k.block_kasseta_y5_config.yau07 or not control_prd_k.block_kasseta_y5_config.ukp1 or not control_prd_k.block_kasseta_y5_config.ukp2:
|
||||
#return
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_node_temperature in power_amplifier_arr_node:
|
||||
var powamp_meta: String = i_node_temperature.get_meta('um')
|
||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||
if pow_dic:
|
||||
if not pow_dic.has(powamp_meta):
|
||||
break
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
if not pow_dic.has(powamp_meta): continue
|
||||
# Проверки fs_result
|
||||
if powamp_meta == 'um_8' and not fs_result.fs_1: continue
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: continue
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_7: continue
|
||||
if powamp_meta == 'um_8':
|
||||
var power_value = pow_dic[powamp_meta][5]
|
||||
i_node_temperature.value0 = [power_value]
|
||||
# Проверка для um_8: если значение < 1 → STATE_VAL.NONE
|
||||
if power_value < 1:
|
||||
status = STATE_VAL.NONE
|
||||
else:
|
||||
if powamp_meta == 'um_7' and not fs_result.fs_1: return
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_6: return
|
||||
if powamp_meta in ['um_8', 'um_9', 'um_10', 'um_11', 'um_12', 'um_13'] and not fs_result.fs_7: return
|
||||
i_powapm.value0 = pow_dic[powamp_meta]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < constants_k.POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
i_powapm.state = status
|
||||
status = STATE_VAL.ERROR if power_value < POWER_THRESHOLD else STATE_VAL.GOOD
|
||||
else:
|
||||
var power_array: Array = pow_dic[powamp_meta]
|
||||
i_node_temperature.value0 = power_array
|
||||
# Проверка: если ВСЕ значения в массиве < 1 → STATE_VAL.NONE
|
||||
var all_below_one: bool = true
|
||||
for i_p in power_array:
|
||||
if i_p >= 1:
|
||||
all_below_one = false
|
||||
break
|
||||
|
||||
if all_below_one:
|
||||
status = STATE_VAL.NONE
|
||||
else:
|
||||
var count_above_threshold = 0
|
||||
for i_p in power_array:
|
||||
if i_p >= POWER_THRESHOLD:
|
||||
count_above_threshold += 1
|
||||
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||
i_node_temperature.state = status
|
||||
|
||||
|
||||
func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
|
||||
mashine_timer.stop()
|
||||
block_kasseta_y5_prd_config_k = control_prd_k.block_kasseta_y5_config
|
||||
func on_press_device(_name_davice: String) -> void:
|
||||
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
|
||||
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
|
||||
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
var default_reset_array_node: Array = get_tree().get_nodes_in_group('default_reset')
|
||||
var module_fs_1: Node = $kasseta_fs_kd/ref_A2
|
||||
var module_fs_6: Node = $kasseta_fs_kd/ref_A4
|
||||
var dou_6: Node = $dou6_A7
|
||||
var module_fs_7: Node = $kasseta_fs_kd/ref_A7
|
||||
var dou_7: Node = $dou7_A8
|
||||
var control_data: Dictionary = unit_prd_k.get_control_results()
|
||||
var for_control_result: Dictionary = {
|
||||
'nodes_y5': nodes_y5,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier,
|
||||
'default_reset_array_node': default_reset_array_node,
|
||||
'module_fs_1': module_fs_1,
|
||||
'module_fs_6': module_fs_6,
|
||||
'dou_6': dou_6,
|
||||
'module_fs_7': module_fs_7,
|
||||
'dou_7': dou_7,
|
||||
}
|
||||
for_control_result.merge(control_data, true)
|
||||
on_control_result(for_control_result)
|
||||
|
||||
|
||||
static func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
|
||||
var all_y5_good: bool = true
|
||||
var block_kasseta_y5_prd_config_k: Dictionary = for_result_dic.block_kasseta_y5_config
|
||||
var nodes_y5: Array = for_result_dic.nodes_y5
|
||||
for node_y5 in nodes_y5:
|
||||
var meta_y5 = node_y5.get_meta('y5')
|
||||
if block_kasseta_y5_prd_config_k.has(meta_y5):
|
||||
if block_kasseta_y5_prd_config_k['yau07'] == false:
|
||||
if not block_kasseta_y5_prd_config_k['yau07']:
|
||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||
break
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR
|
||||
|
||||
block_ip_config_k = control_prd_k.block_ip_config
|
||||
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
|
||||
for power_supply in node_ip_power_arr:
|
||||
else:
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR
|
||||
# Проверяем состояние после установки
|
||||
if node_y5.state == STATE_VAL.ERROR:
|
||||
all_y5_good = false
|
||||
var block_ip_config_k: Dictionary = for_result_dic.block_ip_config
|
||||
for power_supply in for_result_dic.node_ip_power_arr:
|
||||
var meta_ip = power_supply.get_meta('ip')
|
||||
if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug:
|
||||
if block_ip_config_k.has(meta_ip) and block_kasseta_y5_prd_config_k.ug and block_kasseta_y5_prd_config_k.yau07:
|
||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_k[meta_ip][1] else STATE_VAL.ERROR
|
||||
else:
|
||||
power_supply.state = STATE_VAL.NONE
|
||||
# Проверяем состояние после установки
|
||||
if power_supply.state == STATE_VAL.ERROR:
|
||||
all_y5_good = false
|
||||
|
||||
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
|
||||
for f in fs_nodes:
|
||||
if not for_result_dic.control_is_over:
|
||||
set_default_state(for_result_dic.default_reset_array_node)
|
||||
set_default_state(for_result_dic.power_amplifier)
|
||||
return
|
||||
var result_dic: Dictionary = for_result_dic.result_dic
|
||||
for f in for_result_dic.fs_nodes:
|
||||
var fs_meta: String = f.get_meta('fs')
|
||||
if result_dic.has(fs_meta):
|
||||
var new_state = result_dic[fs_meta]
|
||||
f.state = new_state
|
||||
result_dic[fs_meta] = new_state
|
||||
f.state = result_dic[fs_meta]
|
||||
|
||||
if result_dic.fs_1 == 1:
|
||||
$kasseta_fs_kd/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_1 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_1 = false
|
||||
if result_dic.fs_6 == 1:
|
||||
$kasseta_fs_kd/ref_A4.state = STATE_VAL.GOOD if result_dic.dkm_6 else STATE_VAL.ERROR
|
||||
$dou6_A7.state = STATE_VAL.GOOD if result_dic.dou_6 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_6 = false
|
||||
if result_dic.fs_7 == 1:
|
||||
$kasseta_fs_kd/ref_A7.state = STATE_VAL.GOOD if result_dic.dkm_7 else STATE_VAL.ERROR
|
||||
$dou7_A8.state = STATE_VAL.GOOD if result_dic.dou_7 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_7 = false
|
||||
if not all_y5_good: return
|
||||
var fs_1 = true if int(result_dic.fs_1) == 1 else false
|
||||
if fs_1 and block_kasseta_y5_prd_config_k['yau07']:
|
||||
for_result_dic.module_fs_1.state = STATE_VAL.GOOD if result_dic.dkm_1 else STATE_VAL.ERROR
|
||||
|
||||
power_fill(power_dic, result_dic)
|
||||
var fs_6 = true if int(result_dic.fs_6) == 1 else false
|
||||
if fs_6 and block_kasseta_y5_prd_config_k['yau07']:
|
||||
for_result_dic.module_fs_6.state = STATE_VAL.GOOD if result_dic.dkm_6 else STATE_VAL.ERROR
|
||||
for_result_dic.dou_6.state = STATE_VAL.GOOD if result_dic.dou_6 else STATE_VAL.ERROR
|
||||
|
||||
var result = true
|
||||
for device in result_dic.values():
|
||||
if not device:
|
||||
result = false
|
||||
var fs_7 = true if int(result_dic.fs_7) == 1 else false
|
||||
if fs_7 and block_kasseta_y5_prd_config_k['yau07']:
|
||||
for_result_dic.module_fs_7.state = STATE_VAL.GOOD if result_dic.dkm_7 else STATE_VAL.ERROR
|
||||
for_result_dic.dou_7.state = STATE_VAL.GOOD if result_dic.dou_7 else STATE_VAL.ERROR
|
||||
|
||||
var name_prd = control_prd_k.self_name
|
||||
if result:
|
||||
$control_result.text = 'Прибор ПРД-%s исправен' % name_prd
|
||||
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||
else:
|
||||
$control_result.text = 'Прибор ПРД-%s неисправен' % name_prd
|
||||
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||
if block_kasseta_y5_prd_config_k['yau07']:
|
||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||
|
||||
|
||||
func find_labels(node1: Node):
|
||||
@@ -263,3 +208,22 @@ func find_labels(node1: Node):
|
||||
node1.set_meta("tooltip_set", true)
|
||||
for child in node1.get_children():
|
||||
find_labels(child)
|
||||
|
||||
|
||||
func _on_status_updated(status_text: String) -> void:
|
||||
_update_status_text(status_text)
|
||||
|
||||
|
||||
func _update_status_text(text: String) -> void:
|
||||
$control_result.text = text
|
||||
# Можно добавить смену цвета в зависимости от статуса
|
||||
if "Ошибка" in text or "неисправен" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_k.self_name])
|
||||
elif "Ограничена" in text or "Предупреждение" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.YELLOW)
|
||||
elif "исправен" in text or "завершён" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_k.self_name])
|
||||
else:
|
||||
$control_result.add_theme_color_override('font_color', Color.WHITE)
|
||||
|
||||
@@ -1,14 +1,39 @@
|
||||
[gd_scene load_steps=10 format=3 uid="uid://m5s87q7m66lj"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://m5s87q7m66lj"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="1_8dmgr"]
|
||||
[ext_resource type="Script" uid="uid://cwvikiygf8b1m" path="res://scenes/pribor-prd-k/pribor-prd-k.gd" id="1_tpdyp"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="2_14h25"]
|
||||
[ext_resource type="PackedScene" uid="uid://cm5jd4gjrrpba" path="res://scenes/контроль/кассета-у-5-к.tscn" id="2_tb85r"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="5_c7lv8"]
|
||||
[ext_resource type="PackedScene" uid="uid://ffi1njkjceb5" path="res://scenes/контроль/блок-к.tscn" id="6_wd1vi"]
|
||||
[ext_resource type="PackedScene" uid="uid://bmagw8nd0ulhj" path="res://scenes/pribor-prd-k/kasseta-fs-kd.tscn" id="7_ia27q"]
|
||||
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="7_xpa2n"]
|
||||
[ext_resource type="PackedScene" uid="uid://dq31j24gv5vi4" path="res://scenes/контроль/кассета-п-2.tscn" id="8_6fdp7"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="8_la5yt"]
|
||||
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="10_c7lv8"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="11_wd1vi"]
|
||||
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="12_bjebg"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="13_kc77u"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_di0aa"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("10_c7lv8")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("11_wd1vi")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("12_bjebg")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("13_kc77u")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="pribor_prd_k" type="Control"]
|
||||
layout_mode = 3
|
||||
@@ -21,55 +46,55 @@ script = ExtResource("1_tpdyp")
|
||||
|
||||
[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
|
||||
offset_left = 214.0
|
||||
offset_top = 96.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 286.0
|
||||
|
||||
[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("1_8dmgr")]
|
||||
[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("1_8dmgr")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 907.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 524.0
|
||||
offset_top = 761.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 803.0
|
||||
fname = "MAA2000"
|
||||
rname = "A28"
|
||||
metadata/ip = "maa2000_1"
|
||||
|
||||
[node name="dou6_A7" parent="." groups=["default_reset"] instance=ExtResource("1_8dmgr")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 862.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 907.0
|
||||
offset_left = 47.0
|
||||
offset_top = 716.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 761.0
|
||||
fname = "ДОУ-6"
|
||||
rname = "A7"
|
||||
|
||||
[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("1_8dmgr")]
|
||||
[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("1_8dmgr")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 907.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 47.0
|
||||
offset_top = 761.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 803.0
|
||||
fname = "MAA2000"
|
||||
rname = "A27"
|
||||
metadata/ip = "maa2000_2"
|
||||
|
||||
[node name="dou7_A8" parent="." groups=["default_reset"] instance=ExtResource("1_8dmgr")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 812.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 860.0
|
||||
offset_left = 47.0
|
||||
offset_top = 666.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 714.0
|
||||
fname = "ДОУ-7"
|
||||
rname = "A8"
|
||||
|
||||
[node name="ref_ZZ3" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 812.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 214.0
|
||||
offset_top = 666.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 803.0
|
||||
texture = ExtResource("2_14h25")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -90,175 +115,175 @@ vertical_alignment = 1
|
||||
|
||||
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 242.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 337.0
|
||||
offset_left = 524.0
|
||||
offset_top = 96.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 191.0
|
||||
value0 = [0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
||||
fname = "УМ1535Б"
|
||||
rname = "A10"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_1"
|
||||
|
||||
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 337.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 432.0
|
||||
offset_left = 524.0
|
||||
offset_top = 191.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 286.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A11"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_2"
|
||||
|
||||
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 432.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 527.0
|
||||
offset_left = 524.0
|
||||
offset_top = 286.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 381.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A12"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_3"
|
||||
|
||||
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 527.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 524.0
|
||||
offset_top = 381.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 476.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A13"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_4"
|
||||
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 622.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 717.0
|
||||
offset_left = 524.0
|
||||
offset_top = 476.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 571.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_5"
|
||||
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 717.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 812.0
|
||||
offset_left = 524.0
|
||||
offset_top = 571.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 666.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_6"
|
||||
|
||||
[node name="utm80_A9" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
[node name="блок-к" parent="." groups=["power_amplifier"] instance=ExtResource("6_wd1vi")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 812.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 907.0
|
||||
offset_left = 524.0
|
||||
offset_top = 666.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 761.0
|
||||
fname = "УТМ80"
|
||||
rname = "A9"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_7"
|
||||
|
||||
[node name="rm1620m_A16" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 242.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 337.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_8"
|
||||
|
||||
[node name="rm1620m_A17" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
[node name="rm1620m_A16" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 337.0
|
||||
offset_right = 173.0
|
||||
offset_bottom = 432.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность, Вт"
|
||||
offset_left = 47.0
|
||||
offset_top = 96.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 191.0
|
||||
fname = "РМ16-20М"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_9"
|
||||
|
||||
[node name="rm1620m_A18" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
[node name="rm1620m_A17" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 432.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 527.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность, Вт"
|
||||
offset_left = 47.0
|
||||
offset_top = 191.0
|
||||
offset_right = 212.0
|
||||
offset_bottom = 286.0
|
||||
fname = "РМ16-20М"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_10"
|
||||
|
||||
[node name="rm1620m_A19" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
[node name="rm1620m_A18" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 527.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 622.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A19"
|
||||
value0_info = "Мощность, Вт"
|
||||
offset_left = 47.0
|
||||
offset_top = 286.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 381.0
|
||||
fname = "РМ16-20М"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_11"
|
||||
|
||||
[node name="rm1620m_A20" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
[node name="rm1620m_A19" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 622.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 717.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A20"
|
||||
value0_info = "Мощность, Вт"
|
||||
offset_left = 47.0
|
||||
offset_top = 381.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 476.0
|
||||
fname = "РМ16-20М"
|
||||
rname = "A19"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_12"
|
||||
|
||||
[node name="rm1620m_A21" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
[node name="rm1620m_A20" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 717.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 812.0
|
||||
fname = "УМ1535Б"
|
||||
rname = "A21"
|
||||
value0_info = "Мощность, Вт"
|
||||
offset_left = 47.0
|
||||
offset_top = 476.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 571.0
|
||||
fname = "РМ16-20М"
|
||||
rname = "A20"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_13"
|
||||
|
||||
[node name="rm1620m_A21" parent="." groups=["power_amplifier"] instance=ExtResource("5_c7lv8")]
|
||||
layout_mode = 0
|
||||
offset_left = 47.0
|
||||
offset_top = 571.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 666.0
|
||||
fname = "РМ16-20М"
|
||||
rname = "A21"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="kasseta_fs_kd" parent="." instance=ExtResource("7_ia27q")]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 432.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 214.0
|
||||
offset_top = 286.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 476.0
|
||||
fname = "Кассета ФС-КД"
|
||||
|
||||
[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
|
||||
offset_left = 214.0
|
||||
offset_top = 476.0
|
||||
offset_right = 379.0
|
||||
offset_bottom = 666.0
|
||||
texture = ExtResource("2_14h25")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -267,7 +292,7 @@ patch_margin_bottom = 16
|
||||
script = ExtResource("7_xpa2n")
|
||||
fname = "Кассета П-1"
|
||||
|
||||
[node name="ref_A26" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")]
|
||||
[node name="ref_A26" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")]
|
||||
offset_left = 9.0
|
||||
offset_top = 33.0
|
||||
offset_right = 59.0
|
||||
@@ -276,7 +301,7 @@ fname = "ИП9-50"
|
||||
rname = "A23"
|
||||
metadata/ip = "ip9_50_1"
|
||||
|
||||
[node name="ref_A23" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")]
|
||||
[node name="ref_A23" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")]
|
||||
offset_left = 59.0
|
||||
offset_top = 33.0
|
||||
offset_right = 109.0
|
||||
@@ -285,7 +310,7 @@ fname = "ИП9-50"
|
||||
rname = "A24"
|
||||
metadata/ip = "ip9_50_2"
|
||||
|
||||
[node name="ref_A24" parent="kasseta_p_1" groups=["default_reset", "power_supply"] instance=ExtResource("8_la5yt")]
|
||||
[node name="ref_A24" parent="kasseta_p_1" groups=["power_supply"] instance=ExtResource("8_la5yt")]
|
||||
offset_left = 109.0
|
||||
offset_top = 33.0
|
||||
offset_right = 159.0
|
||||
@@ -297,9 +322,9 @@ metadata/ip = "ip12_50_1"
|
||||
[node name="lbl_fname" type="Label" parent="kasseta_p_1"]
|
||||
self_modulate = Color(1, 1, 1, 0.62)
|
||||
layout_mode = 0
|
||||
offset_left = 7.0
|
||||
offset_left = 2.0
|
||||
offset_top = 8.0
|
||||
offset_right = 159.0
|
||||
offset_right = 162.0
|
||||
offset_bottom = 33.0
|
||||
text = "Кассета П-1"
|
||||
horizontal_alignment = 1
|
||||
@@ -307,18 +332,50 @@ vertical_alignment = 1
|
||||
|
||||
[node name="kasseta_p_2" parent="." instance=ExtResource("8_6fdp7")]
|
||||
layout_mode = 0
|
||||
offset_left = 365.0
|
||||
offset_top = 622.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 812.0
|
||||
offset_left = 404.0
|
||||
offset_top = 476.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 666.0
|
||||
fname = "Кассета П-2"
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(392, 472)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(444, 472)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="input_2" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(294, 473)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(394, 318)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(444, 318)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="output_2" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(294, 318)
|
||||
sprite_frames = SubResource("SpriteFrames_di0aa")
|
||||
|
||||
[node name="control_result" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 9.0
|
||||
offset_top = 960.0
|
||||
offset_right = 649.0
|
||||
offset_bottom = 1003.0
|
||||
text = "Прибор ПРД- неисправен"
|
||||
offset_left = 49.0
|
||||
offset_top = 993.0
|
||||
offset_right = 689.0
|
||||
offset_bottom = 1036.0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="line" type="Line2D" parent="."]
|
||||
position = Vector2(59, 920)
|
||||
scale = Vector2(1.03548, 1)
|
||||
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
|
||||
width = 2.0
|
||||
default_color = Color(1, 1, 1, 0.352941)
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
@@ -1,235 +1,183 @@
|
||||
@tool
|
||||
extends 'res://scenes/контроль/прибор.gd'
|
||||
|
||||
const constants_n = {
|
||||
'POWER_UKP_1': 31,
|
||||
'POWER_UKP_2': 63,
|
||||
'DKM_BIT_2': 1,
|
||||
'DKM_BIT_3': 2,
|
||||
'BASE_ADDR_EMS_G': 0x120,
|
||||
'ADDR_UG_LITERA_1': 0x106,
|
||||
'ADDR_UG_LITERA_2': 0x108,
|
||||
'ADDR_UG_LITERA_3': 0x10A,
|
||||
'TEMP_THRESHOLD': 70,
|
||||
'POWER_THRESHOLD': 40,
|
||||
'RAY_DOU_NUM': 0x3,
|
||||
'ATT_UM_2': 0x2,
|
||||
'ATT_UM_3': 0x3,
|
||||
'POWER_UM': 100,
|
||||
'TIMER_DELAY': 10.0,
|
||||
'STATE_MASHINE_TIMER': 0.3,
|
||||
}
|
||||
# Конфигурация параметров для каждого прибора
|
||||
const PRIBOR_CONFIG_N := {
|
||||
'1н': {'angle': 0.0, 'sectors': [4, 8]},
|
||||
'2н': {'angle': 90.0, 'sectors': [7, 11]},
|
||||
'3н': {'angle': 180.0, 'sectors': [6, 10]},
|
||||
'4н': {'angle': 270.0, 'sectors': [5, 9]},
|
||||
}
|
||||
# Конфигурация частот и ширин для каждого ФС
|
||||
const FS_PARAMS_N := {
|
||||
2: {'freq': 932.0, 'width': 100.0},
|
||||
3: {'freq': 1157.0, 'width': 100.0}
|
||||
}
|
||||
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
|
||||
var block_ip_config_n:= {
|
||||
'maa2000_1': [0, false],
|
||||
'maa2000_2': [1, false],
|
||||
'ip9_50_1': [2, false],
|
||||
'ip9_50_2': [3, false],
|
||||
'ip12_50_1': [4, false],
|
||||
'ip5_25': [7, false],
|
||||
}
|
||||
var block_kasseta_y5_prd_config_n: = {
|
||||
'yau07': false,
|
||||
'ems': false,
|
||||
'ug': false,
|
||||
'ukp1': false,
|
||||
'ukp2': false,
|
||||
}
|
||||
|
||||
# Основные переменные
|
||||
var start_litera: int = 2
|
||||
var ug_work_1: int = 2 ## Аттенюация усилителей мощности
|
||||
var ug_work_2: int = 3 ## Аттенюация усилителей мощности
|
||||
# Флаги и таймеры
|
||||
var mashine_timer: Timer = Timer.new()
|
||||
var prd_n_module: Object
|
||||
var unit_prd_n: Object
|
||||
var control_prd_n: Object
|
||||
# Результаты контроля
|
||||
var control_results_n: Dictionary = {
|
||||
'block_ip': false, # Проверка касет П1 и ИП МА2000
|
||||
'temperature': true, # Проверка температур УМ
|
||||
'dkm_2': false,
|
||||
'dkm_3': false,
|
||||
'dou_2': false,
|
||||
'dou_3': false,
|
||||
'fs_2': 2,
|
||||
'fs_3': 2,
|
||||
}
|
||||
var test_control_n = preload('res://scripts/pribor-prd.gd')
|
||||
var ctrl_pos = 0
|
||||
################################
|
||||
func on_state_mashine() -> void:
|
||||
control_prd_n.state_control_machine()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
initialize_connections()
|
||||
setup_timer()
|
||||
set_default_state()
|
||||
find_labels(self)
|
||||
|
||||
|
||||
func initialize_connections() -> void:
|
||||
var unit_name = get_meta('unit_name')[0]
|
||||
prd_n_module = prd.prd_dict[unit_name]
|
||||
unit_prd_n = prd_n_module.unit_yau07
|
||||
|
||||
unit_prd_n.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
var init_data: Dictionary = {
|
||||
'control_label': $control_result,
|
||||
'power_amplifiers': power_amplifiers,
|
||||
'unit_prd': unit_prd_n,
|
||||
'module_prd' : prd_n_module,
|
||||
'constants': constants_n,
|
||||
'prd_config': PRIBOR_CONFIG_N,
|
||||
'fs_params': FS_PARAMS_N,
|
||||
'block_ip_prd_config': block_ip_config_n,
|
||||
'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_n,
|
||||
'control_results': control_results_n,
|
||||
'current_litera': start_litera,
|
||||
}
|
||||
control_prd_n = test_control_n.TestPRD.new(init_data)
|
||||
add_child(control_prd_n)
|
||||
control_prd_n.connect('control_is_over', Callable(self, 'on_control_result'))
|
||||
var prd_n_module = prd.prd_dict[unit_name]
|
||||
unit_prd_n = prd_n_module.unit_control
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
# Подписываемся на сигналы
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_control'))
|
||||
unit_prd_n.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
unit_prd_n.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||
# Устанавливаем начальный статус
|
||||
_update_status_text(unit_prd_n.get_current_status())
|
||||
on_press_device(unit_prd_n.self_name)
|
||||
|
||||
|
||||
func setup_timer() -> void:
|
||||
add_child(mashine_timer)
|
||||
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
|
||||
mashine_timer.wait_time = constants_n.STATE_MASHINE_TIMER
|
||||
mashine_timer.start()
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_n.ems_g_sock_dic.ems_input_1)
|
||||
set_frame($input_1, unit_prd_n.ems_g_sock_dic.ems_input_2)
|
||||
set_frame($output_0, unit_prd_n.ems_g_sock_dic.ems_output_1)
|
||||
set_frame($output_1, unit_prd_n.ems_g_sock_dic.ems_output_2)
|
||||
|
||||
|
||||
func set_default_state() -> void:
|
||||
for group in get_tree().get_nodes_in_group('default_reset'):
|
||||
group.state = STATE_VAL.NONE
|
||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
|
||||
for group in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
|
||||
func _on_start_control() -> void:
|
||||
set_default_state(get_tree().get_nodes_in_group('default_reset'))
|
||||
set_default_state(get_tree().get_nodes_in_group('power_amplifier'))
|
||||
for um in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
um.value0 = [0, 0, 0, 0, 0, 0]
|
||||
find_labels(self)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
on_press_device(unit_prd_n.self_name)
|
||||
|
||||
|
||||
static func set_default_state(default_reset_array_node: Array) -> void:
|
||||
for group in default_reset_array_node:
|
||||
group.state = STATE_VAL.NONE
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
$control_result.text = 'Выполняется ...'
|
||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
||||
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
|
||||
if unit_prd_n:
|
||||
_update_status_text(unit_prd_n.get_current_status())
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]])
|
||||
#prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]])
|
||||
|
||||
|
||||
func on_line_changed(unit_pribor: Object) -> void:
|
||||
if not unit_pribor.online:
|
||||
set_default_state()
|
||||
static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void:
|
||||
for i_node_temperature in temperature_arr_node:
|
||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||
if not temperature_dic.has(temperature_meta): return
|
||||
i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40
|
||||
|
||||
|
||||
func on_mode_changed(in_tree: bool) -> void:
|
||||
if not in_tree:
|
||||
mashine_timer.stop()
|
||||
signaller.emit_signal('interfer_off_all')
|
||||
prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]])
|
||||
else:
|
||||
set_default_state()
|
||||
control_prd_n.state = control_prd_n.STATE_MASHINE.INIT
|
||||
mashine_timer.start()
|
||||
|
||||
|
||||
func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void:
|
||||
#if not control_prd_n.block_kasseta_y5_config.yau07 or not control_prd_n.block_kasseta_y5_config.ukp1 or not control_prd_n.block_kasseta_y5_config.ukp2:
|
||||
#return
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_node_powapm in power_amplifier_arr_node:
|
||||
var powamp_meta: String = i_node_powapm.get_meta('um')
|
||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return
|
||||
if powamp_meta in ['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] and not fs_result.fs_3: return
|
||||
i_powapm.value0 = pow_dic[powamp_meta]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < constants_n.POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
i_powapm.state = status
|
||||
if not pow_dic.has(powamp_meta): return
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_2: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_3: return
|
||||
i_node_powapm.value0 = pow_dic[powamp_meta]
|
||||
# Проверка: если ВСЕ значения в массиве < 1 → STATE_VAL.NONE
|
||||
var power_array: Array = pow_dic[powamp_meta]
|
||||
var all_below_one: bool = true
|
||||
for i_p in power_array:
|
||||
if i_p >= 1:
|
||||
all_below_one = false
|
||||
break
|
||||
|
||||
if all_below_one:
|
||||
i_node_powapm.state = STATE_VAL.NONE
|
||||
continue
|
||||
|
||||
var count_above_threshold = 0
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p >= POWER_THRESHOLD:
|
||||
count_above_threshold += 1
|
||||
|
||||
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||
i_node_powapm.state = status
|
||||
|
||||
|
||||
func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
|
||||
mashine_timer.stop()
|
||||
block_kasseta_y5_prd_config_n = control_prd_n.block_kasseta_y5_config
|
||||
func on_press_device(_device_name: String) -> void:
|
||||
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
|
||||
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
|
||||
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
|
||||
var power_amplifier_arr_node: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
var default_reset_array_node = get_tree().get_nodes_in_group('default_reset')
|
||||
var module_fs_2: Node = $kasseta_FS_ND/ref_A4
|
||||
var dou_2: Node = $dou2_A5
|
||||
var module_fs_3: Node = $kasseta_FS_ND/ref_A3
|
||||
var dou_3: Node = $dou3_A6
|
||||
var control_data: Dictionary = unit_prd_n.get_control_results()
|
||||
var for_control_result: Dictionary = {
|
||||
'nodes_y5': nodes_y5,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier_arr_node,
|
||||
'default_reset_array_node': default_reset_array_node,
|
||||
'module_fs_2': module_fs_2,
|
||||
'dou_2': dou_2,
|
||||
'module_fs_3': module_fs_3,
|
||||
'dou_3': dou_3,
|
||||
}
|
||||
for_control_result.merge(control_data, true)
|
||||
on_control_result(for_control_result)
|
||||
|
||||
|
||||
static func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
|
||||
var all_y5_good: bool = true
|
||||
var block_kasseta_y5_prd_config_n: Dictionary = for_result_dic.block_kasseta_y5_config
|
||||
var nodes_y5: Array = for_result_dic.nodes_y5
|
||||
for node_y5 in nodes_y5:
|
||||
var meta_y5 = node_y5.get_meta('y5')
|
||||
if block_kasseta_y5_prd_config_n.has(meta_y5):
|
||||
if block_kasseta_y5_prd_config_n['yau07'] == false:
|
||||
if not block_kasseta_y5_prd_config_n.yau07:
|
||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||
break
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR
|
||||
else:
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_n[meta_y5] else STATE_VAL.ERROR
|
||||
# Проверяем состояние после установки
|
||||
if node_y5.state == STATE_VAL.ERROR:
|
||||
all_y5_good = false
|
||||
|
||||
block_ip_config_n = control_prd_n.block_ip_config
|
||||
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
|
||||
for power_supply in node_ip_power_arr:
|
||||
var block_ip_config_n: Dictionary = for_result_dic.block_ip_config
|
||||
for power_supply in for_result_dic.node_ip_power_arr:
|
||||
var meta_ip = power_supply.get_meta('ip')
|
||||
if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug:
|
||||
if block_ip_config_n.has(meta_ip) and block_kasseta_y5_prd_config_n.ug and block_kasseta_y5_prd_config_n.yau07:
|
||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_n[meta_ip][1] else STATE_VAL.ERROR
|
||||
else:
|
||||
power_supply.state = STATE_VAL.NONE
|
||||
# Проверяем состояние после установки
|
||||
if power_supply.state == STATE_VAL.ERROR:
|
||||
all_y5_good = false
|
||||
|
||||
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
|
||||
for f in fs_nodes:
|
||||
if not for_result_dic.control_is_over:
|
||||
set_default_state(for_result_dic.default_reset_array_node)
|
||||
set_default_state(for_result_dic.power_amplifier)
|
||||
return
|
||||
var result_dic: Dictionary = for_result_dic.result_dic
|
||||
for f in for_result_dic.fs_nodes:
|
||||
var fs_meta: String = f.get_meta('fs')
|
||||
if result_dic.has(fs_meta):
|
||||
var new_state = result_dic[fs_meta]
|
||||
f.state = new_state
|
||||
result_dic[fs_meta] = new_state
|
||||
f.state = result_dic[fs_meta]
|
||||
|
||||
if result_dic.fs_2 == 1:
|
||||
$kasseta_FS_ND/ref_A4.state = STATE_VAL.GOOD if result_dic.dkm_2 else STATE_VAL.ERROR
|
||||
$dou2_A5.state = STATE_VAL.GOOD if result_dic.dou_2 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_2 = 0
|
||||
if result_dic.fs_3 == 1:
|
||||
$kasseta_FS_ND/ref_A3.state = STATE_VAL.GOOD if result_dic.dkm_3 else STATE_VAL.ERROR
|
||||
$dou3_A6.state = STATE_VAL.GOOD if result_dic.dou_3 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_3 = 0
|
||||
if not all_y5_good: return
|
||||
var fs_2 = true if int(result_dic.fs_2) == 1 else false
|
||||
if fs_2 and block_kasseta_y5_prd_config_n['yau07']:
|
||||
for_result_dic.module_fs_2.state = STATE_VAL.GOOD if result_dic.dkm_2 else STATE_VAL.ERROR
|
||||
for_result_dic.dou_2.state = STATE_VAL.GOOD if result_dic.dou_2 else STATE_VAL.ERROR
|
||||
|
||||
power_fill(power_dic, result_dic)
|
||||
var fs_3 = true if int(result_dic.fs_3) == 1 else false
|
||||
if fs_3 and block_kasseta_y5_prd_config_n['yau07']:
|
||||
for_result_dic.module_fs_3.state = STATE_VAL.GOOD if result_dic.dkm_3 else STATE_VAL.ERROR
|
||||
for_result_dic.dou_3.state = STATE_VAL.GOOD if result_dic.dou_3 else STATE_VAL.ERROR
|
||||
|
||||
var result = true
|
||||
for device in result_dic.values():
|
||||
if not device:
|
||||
result = false
|
||||
|
||||
var name_prd = control_prd_n.self_name
|
||||
if result:
|
||||
$control_result.text = 'Прибор ПРД-%s исправен' % name_prd
|
||||
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||
else:
|
||||
$control_result.text = 'Прибор ПРД-%s неисправен' % name_prd
|
||||
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||
if block_kasseta_y5_prd_config_n['yau07']:
|
||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||
|
||||
|
||||
func find_labels(node1: Node):
|
||||
@@ -246,3 +194,22 @@ func find_labels(node1: Node):
|
||||
node1.set_meta("tooltip_set", true)
|
||||
for child in node1.get_children():
|
||||
find_labels(child)
|
||||
|
||||
|
||||
func _on_status_updated(status_text: String) -> void:
|
||||
_update_status_text(status_text)
|
||||
|
||||
|
||||
func _update_status_text(text: String) -> void:
|
||||
$control_result.text = text
|
||||
# Можно добавить смену цвета в зависимости от статуса
|
||||
if "Ошибка" in text or "неисправен" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_n.self_name])
|
||||
elif "Ограничена" in text or "Предупреждение" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.YELLOW)
|
||||
elif "исправен" in text or "завершён" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_n.self_name])
|
||||
else:
|
||||
$control_result.add_theme_color_override('font_color', Color.WHITE)
|
||||
|
||||
@@ -1,12 +1,35 @@
|
||||
[gd_scene load_steps=8 format=3 uid="uid://dnuexoef2nnv5"]
|
||||
[gd_scene load_steps=12 format=3 uid="uid://dnuexoef2nnv5"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cto2r4ipew65m" path="res://scenes/pribor-prd-n/pribor-prd-n.gd" id="1_bnnv3"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_is25t"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_meukj"]
|
||||
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_xkifg"]
|
||||
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_b5wvk"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="7_bnnv3"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_eoqf2"]
|
||||
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="8_bnnv3"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="9_is25t"]
|
||||
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="10_meukj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="11_xkifg"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_1wf07"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("8_bnnv3")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("9_is25t")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("10_meukj")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("11_xkifg")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="pribor_prd_n" type="Control"]
|
||||
layout_mode = 3
|
||||
@@ -17,50 +40,50 @@ offset_right = 15.0
|
||||
offset_bottom = 30.0
|
||||
script = ExtResource("1_bnnv3")
|
||||
|
||||
[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_is25t")]
|
||||
[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("2_is25t")]
|
||||
layout_mode = 2
|
||||
offset_left = 8.0
|
||||
offset_top = 877.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 47.0
|
||||
offset_top = 731.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 803.0
|
||||
fname = "MAA2000"
|
||||
rname = "A23"
|
||||
metadata/ip = "maa2000_2"
|
||||
|
||||
[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_is25t")]
|
||||
[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("2_is25t")]
|
||||
layout_mode = 2
|
||||
offset_left = 485.0
|
||||
offset_top = 877.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 524.0
|
||||
offset_top = 731.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 803.0
|
||||
fname = "MAA2000"
|
||||
rname = "A22"
|
||||
metadata/ip = "maa2000_1"
|
||||
|
||||
[node name="dou2_A5" parent="." groups=["default_reset"] instance=ExtResource("2_is25t")]
|
||||
layout_mode = 2
|
||||
offset_left = 485.0
|
||||
offset_top = 812.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 877.0
|
||||
offset_left = 524.0
|
||||
offset_top = 666.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 731.0
|
||||
fname = "ДОУ-2"
|
||||
rname = "A5"
|
||||
|
||||
[node name="dou3_A6" parent="." groups=["default_reset"] instance=ExtResource("2_is25t")]
|
||||
layout_mode = 2
|
||||
offset_left = 8.0
|
||||
offset_top = 812.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 877.0
|
||||
offset_left = 47.0
|
||||
offset_top = 666.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 731.0
|
||||
fname = "ДОУ-3"
|
||||
rname = "A6"
|
||||
|
||||
[node name="ref_ZZ3" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 812.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 214.0
|
||||
offset_top = 666.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 803.0
|
||||
texture = ExtResource("3_meukj")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -79,19 +102,90 @@ text = "Панель
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="kasseta_U5" parent="." instance=ExtResource("4_xkifg")]
|
||||
[node name="kasseta_U5" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 242.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 432.0
|
||||
offset_left = 214.0
|
||||
offset_top = 96.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 286.0
|
||||
texture = ExtResource("3_meukj")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
script = ExtResource("6_b5wvk")
|
||||
|
||||
[node name="lbl_fname" type="Label" parent="kasseta_U5"]
|
||||
self_modulate = Color(1, 1, 1, 0.62)
|
||||
layout_mode = 0
|
||||
offset_left = 5.0
|
||||
offset_top = 7.0
|
||||
offset_right = 305.0
|
||||
offset_bottom = 35.0
|
||||
text = "Кассета У5"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ref_A24" parent="kasseta_U5" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 5.0
|
||||
offset_top = 32.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ИП5-25"
|
||||
rname = "A24"
|
||||
metadata/ip = "ip5_25"
|
||||
|
||||
[node name="ref_A30" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 55.0
|
||||
offset_top = 32.0
|
||||
offset_right = 105.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ЯУ-07Б"
|
||||
rname = "A30"
|
||||
metadata/y5 = "yau07"
|
||||
|
||||
[node name="ref_A26" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 105.0
|
||||
offset_top = 32.0
|
||||
offset_right = 155.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ЭМС-Г"
|
||||
rname = "A26"
|
||||
metadata/y5 = "ems"
|
||||
|
||||
[node name="ref_A27" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 155.0
|
||||
offset_top = 32.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УГ"
|
||||
rname = "A27"
|
||||
metadata/y5 = "ug"
|
||||
|
||||
[node name="ref_A28" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 205.0
|
||||
offset_top = 32.0
|
||||
offset_right = 255.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УКП"
|
||||
rname = "A28"
|
||||
metadata/y5 = "ukp1"
|
||||
|
||||
[node name="ref_A29" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 254.0
|
||||
offset_top = 32.0
|
||||
offset_right = 304.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УКП"
|
||||
rname = "A29"
|
||||
metadata/y5 = "ukp2"
|
||||
|
||||
[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
|
||||
offset_left = 214.0
|
||||
offset_top = 286.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 476.0
|
||||
texture = ExtResource("3_meukj")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -118,7 +212,7 @@ offset_top = 32.0
|
||||
offset_right = 105.0
|
||||
offset_bottom = 182.0
|
||||
fname = "Блок ФС-3"
|
||||
rname = "A3"
|
||||
rname = "A4"
|
||||
|
||||
[node name="ref_A1" parent="kasseta_FS_ND" groups=["default_reset", "fs_group"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 105.0
|
||||
@@ -126,7 +220,7 @@ offset_top = 32.0
|
||||
offset_right = 155.0
|
||||
offset_bottom = 182.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A1"
|
||||
rname = "A2"
|
||||
metadata/fs = "fs_3"
|
||||
|
||||
[node name="ref_A2" parent="kasseta_FS_ND" groups=["default_reset", "fs_group"] instance=ExtResource("7_eoqf2")]
|
||||
@@ -135,7 +229,7 @@ offset_top = 32.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 182.0
|
||||
fname = "Модуль ФС"
|
||||
rname = "A2"
|
||||
rname = "A1"
|
||||
metadata/fs = "fs_2"
|
||||
|
||||
[node name="ref_A4" parent="kasseta_FS_ND" groups=["default_reset"] instance=ExtResource("7_eoqf2")]
|
||||
@@ -144,14 +238,14 @@ offset_top = 32.0
|
||||
offset_right = 255.0
|
||||
offset_bottom = 182.0
|
||||
fname = "Блок ФС-2"
|
||||
rname = "A4"
|
||||
rname = "A3"
|
||||
|
||||
[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
|
||||
offset_left = 214.0
|
||||
offset_top = 476.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 666.0
|
||||
texture = ExtResource("3_meukj")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -160,7 +254,7 @@ patch_margin_bottom = 16
|
||||
script = ExtResource("6_b5wvk")
|
||||
fname = "Кассета П-1"
|
||||
|
||||
[node name="ref_A21" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
[node name="ref_A21" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 9.0
|
||||
offset_top = 33.0
|
||||
offset_right = 59.0
|
||||
@@ -169,7 +263,7 @@ fname = "ИП12-50"
|
||||
rname = "A21"
|
||||
metadata/ip = "ip12_50_1"
|
||||
|
||||
[node name="ref_A20" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
[node name="ref_A20" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 59.0
|
||||
offset_top = 33.0
|
||||
offset_right = 109.0
|
||||
@@ -178,7 +272,7 @@ fname = "ИП9-50"
|
||||
rname = "A20"
|
||||
metadata/ip = "ip9_50_1"
|
||||
|
||||
[node name="ref_A19" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
[node name="ref_A19" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_eoqf2")]
|
||||
offset_left = 109.0
|
||||
offset_top = 33.0
|
||||
offset_right = 159.0
|
||||
@@ -200,153 +294,178 @@ vertical_alignment = 1
|
||||
|
||||
[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 242.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 337.0
|
||||
fname = "УМ1535Б"
|
||||
offset_left = 524.0
|
||||
offset_top = 96.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 191.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A7"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_1"
|
||||
|
||||
[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 337.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 432.0
|
||||
offset_left = 524.0
|
||||
offset_top = 191.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 286.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A8"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_2"
|
||||
|
||||
[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 432.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 527.0
|
||||
offset_left = 524.0
|
||||
offset_top = 286.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 381.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A9"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_3"
|
||||
|
||||
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 527.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 524.0
|
||||
offset_top = 381.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 476.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A10"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_4"
|
||||
|
||||
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 622.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 717.0
|
||||
offset_left = 524.0
|
||||
offset_top = 476.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 571.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A11"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_5"
|
||||
|
||||
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 717.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 812.0
|
||||
offset_left = 524.0
|
||||
offset_top = 571.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 666.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A12"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_6"
|
||||
|
||||
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 242.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 337.0
|
||||
offset_left = 47.0
|
||||
offset_top = 96.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 191.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A13"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_7"
|
||||
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 337.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 432.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_8"
|
||||
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 432.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 527.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_9"
|
||||
|
||||
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 527.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 47.0
|
||||
offset_top = 191.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 286.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность, Вт"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_10"
|
||||
|
||||
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 622.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 717.0
|
||||
offset_left = 47.0
|
||||
offset_top = 286.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 381.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность, Вт"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_11"
|
||||
|
||||
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 717.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 812.0
|
||||
offset_left = 47.0
|
||||
offset_top = 381.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 476.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность, Вт"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_12"
|
||||
|
||||
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 47.0
|
||||
offset_top = 476.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 571.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_13"
|
||||
|
||||
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("7_bnnv3")]
|
||||
layout_mode = 0
|
||||
offset_left = 47.0
|
||||
offset_top = 571.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 666.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="control_result" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 9.0
|
||||
offset_top = 960.0
|
||||
offset_right = 649.0
|
||||
offset_bottom = 1003.0
|
||||
offset_left = 49.0
|
||||
offset_top = 993.0
|
||||
offset_right = 689.0
|
||||
offset_bottom = 1036.0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(495, 443)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(246, 440)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(497, 330)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(249, 331)
|
||||
sprite_frames = SubResource("SpriteFrames_1wf07")
|
||||
|
||||
[node name="line" type="Line2D" parent="."]
|
||||
position = Vector2(59, 920)
|
||||
scale = Vector2(1.03548, 1)
|
||||
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
|
||||
width = 2.0
|
||||
default_color = Color(1, 1, 1, 0.352941)
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
@@ -1,234 +1,179 @@
|
||||
@tool
|
||||
extends 'res://scenes/контроль/прибор.gd'
|
||||
|
||||
const constants_v = {
|
||||
'POWER_UKP_1': 31,
|
||||
'POWER_UKP_2': 63,
|
||||
'DKM_BIT_4': 3,
|
||||
'DKM_BIT_5': 4,
|
||||
'BASE_ADDR_EMS_G': 0x120,
|
||||
'ADDR_UG_LITERA_1': 0x106,
|
||||
'ADDR_UG_LITERA_2': 0x108,
|
||||
'ADDR_UG_LITERA_3': 0x10A,
|
||||
'TEMP_THRESHOLD': 70,
|
||||
'POWER_THRESHOLD': 40,
|
||||
'RAY_DOU_NUM': 0x3,
|
||||
'ATT_UM_4': 0x2,
|
||||
'ATT_UM_5': 0x3,
|
||||
'POWER_UM': 100,
|
||||
'TIMER_DELAY': 10.0,
|
||||
'STATE_MASHINE_TIMER': 0.3,
|
||||
}
|
||||
# Конфигурация параметров для каждого прибора
|
||||
const PRIBOR_CONFIG_V := {
|
||||
'1в': {'angle': 0.0, 'sectors': [12, 16]},
|
||||
'2в': {'angle': 90.0, 'sectors': [15, 19]},
|
||||
'3в': {'angle': 180.0, 'sectors': [14, 18]},
|
||||
'4в': {'angle': 270.0, 'sectors': [13, 17]},
|
||||
}
|
||||
# Конфигурация частот и ширин для каждого ФС
|
||||
const FS_PARAMS_V := {
|
||||
4: {'freq': 1227.0, 'width': 100.0},
|
||||
5: {'freq': 1575.0, 'width': 110.0},
|
||||
}
|
||||
enum STATE_VAL { NONE = 0, GOOD = 1, ERROR = 2 }
|
||||
var block_ip_config_v := {
|
||||
'maa2000_1': [0, false],
|
||||
'maa2000_2': [1, false],
|
||||
'ip9_50_1': [2, false],
|
||||
'ip9_50_2': [3, false],
|
||||
'ip12_50_1': [4, false],
|
||||
'ip5_25': [7, false],
|
||||
}
|
||||
var block_kasseta_y5_prd_config_v: = {
|
||||
'yau07': false,
|
||||
'ems': false,
|
||||
'ug': false,
|
||||
'ukp1': false,
|
||||
'ukp2': false,
|
||||
}
|
||||
|
||||
# Основные переменные
|
||||
var start_litera: int = 4
|
||||
var ug_work_1: int = 2 ## Аттенюация усилителей мощности
|
||||
var ug_work_2: int = 3 ## Аттенюация усилителей мощности
|
||||
# Флаги и таймеры
|
||||
var mashine_timer: Timer = Timer.new()
|
||||
var prd_v_module: Object
|
||||
var unit_prd_v: Object
|
||||
var control_prd_v: Object
|
||||
# Результаты контроля
|
||||
var control_results_v: Dictionary = {
|
||||
'block_ip': false, # Проверка касет П1 и ИП МА2000
|
||||
'temperature': true, # Проверка температур УМ
|
||||
'dkm_4': false,
|
||||
'dkm_5': false,
|
||||
'dou_4': false,
|
||||
'dou_5': false,
|
||||
'fs_4': 2,
|
||||
'fs_5': 2,
|
||||
}
|
||||
var test_control_v = preload('res://scripts/pribor-prd.gd')
|
||||
var ctrl_pos = 70
|
||||
|
||||
|
||||
func on_state_mashine() -> void:
|
||||
control_prd_v.state_control_machine()
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
|
||||
initialize_connections()
|
||||
setup_timer()
|
||||
set_default_state()
|
||||
find_labels(self)
|
||||
|
||||
|
||||
func initialize_connections() -> void:
|
||||
var unit_name = get_meta('unit_name')[0]
|
||||
prd_v_module = prd.prd_dict[unit_name]
|
||||
unit_prd_v = prd_v_module.unit_yau07
|
||||
|
||||
unit_prd_v.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
var init_data: Dictionary = {
|
||||
'control_label': $control_result,
|
||||
'power_amplifiers': power_amplifiers,
|
||||
'unit_prd': unit_prd_v,
|
||||
'module_prd' : prd_v_module,
|
||||
'constants': constants_v,
|
||||
'prd_config': PRIBOR_CONFIG_V,
|
||||
'fs_params': FS_PARAMS_V,
|
||||
'block_ip_prd_config': block_ip_config_v,
|
||||
'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_v,
|
||||
'control_results': control_results_v,
|
||||
'current_litera': start_litera,
|
||||
}
|
||||
control_prd_v = test_control_v.TestPRD.new(init_data)
|
||||
add_child(control_prd_v)
|
||||
control_prd_v.connect('control_is_over', Callable(self, 'on_control_result'))
|
||||
var prd_v_module = prd.prd_dict[unit_name]
|
||||
unit_prd_v = prd_v_module.unit_control
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for temp in power_amplifier:
|
||||
temp.value1 = -70
|
||||
# Подписываемся на сигналы
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_control'))
|
||||
unit_prd_v.connect('control_is_over', Callable(self, 'on_press_device'))
|
||||
unit_prd_v.connect('status_updated', Callable(self, '_on_status_updated'))
|
||||
# Устанавливаем начальный статус
|
||||
_update_status_text(unit_prd_v.get_current_status())
|
||||
on_press_device(unit_prd_v.self_name)
|
||||
|
||||
|
||||
func setup_timer() -> void:
|
||||
add_child(mashine_timer)
|
||||
mashine_timer.connect('timeout', Callable(self, 'on_state_mashine'))
|
||||
mashine_timer.wait_time = constants_v.STATE_MASHINE_TIMER
|
||||
mashine_timer.start()
|
||||
func _process(_delta: float) -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
set_frame($input_0, unit_prd_v.ems_g_sock_dic.ems_input_1)
|
||||
set_frame($input_1, unit_prd_v.ems_g_sock_dic.ems_input_2)
|
||||
set_frame($output_0, unit_prd_v.ems_g_sock_dic.ems_output_1)
|
||||
set_frame($output_1, unit_prd_v.ems_g_sock_dic.ems_output_2)
|
||||
|
||||
|
||||
func set_default_state() -> void:
|
||||
for group in get_tree().get_nodes_in_group('default_reset'):
|
||||
group.state = STATE_VAL.NONE
|
||||
func set_frame(node_frame: Node, val: int): node_frame.set_frame(val)
|
||||
|
||||
for group in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
|
||||
func _on_start_control() -> void:
|
||||
set_default_state(get_tree().get_nodes_in_group('default_reset'))
|
||||
set_default_state(get_tree().get_nodes_in_group('power_amplifier'))
|
||||
for um in get_tree().get_nodes_in_group('power_amplifier'):
|
||||
um.value0 = [0, 0, 0, 0, 0, 0]
|
||||
find_labels(self)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
on_press_device(unit_prd_v.self_name)
|
||||
|
||||
|
||||
static func set_default_state(default_reset_array_node: Array) -> void:
|
||||
for group in default_reset_array_node:
|
||||
group.state = STATE_VAL.NONE
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
$control_result.text = 'Выполняется ...'
|
||||
$control_result.add_theme_color_override('font_color', Color.ALICE_BLUE)
|
||||
signaller.connect('режим_работа', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_журнал', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_эмс', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_настройки', Callable(self, 'on_mode_changed').bind(false))
|
||||
signaller.connect('режим_контроль', Callable(self, 'on_mode_changed').bind(true))
|
||||
|
||||
if unit_prd_v:
|
||||
_update_status_text(unit_prd_v.get_current_status())
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
|
||||
|
||||
|
||||
func on_line_changed(unit_pribor: Object) -> void:
|
||||
if not unit_pribor.online:
|
||||
set_default_state()
|
||||
static func temperature_fill(temperature_arr_node: Array, temperature_dic: Dictionary)->void:
|
||||
for i_node_temperature in temperature_arr_node:
|
||||
var temperature_meta: String = i_node_temperature.get_meta('um')
|
||||
if not temperature_dic.has(temperature_meta): return
|
||||
i_node_temperature.value1 = temperature_dic[temperature_meta] if temperature_dic[temperature_meta] < 361 else -40
|
||||
|
||||
|
||||
func on_mode_changed(in_tree: bool) -> void:
|
||||
if not in_tree:
|
||||
mashine_timer.stop()
|
||||
prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]])
|
||||
signaller.emit_signal('interfer_off_all')
|
||||
else:
|
||||
set_default_state()
|
||||
control_prd_v.state = control_prd_v.STATE_MASHINE.INIT
|
||||
mashine_timer.start()
|
||||
|
||||
|
||||
func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void:
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
for i_powapm in power_amplifier:
|
||||
var powamp_meta: String = i_powapm.get_meta('um')
|
||||
static func power_fill(pow_dic: Dictionary, fs_result: Dictionary, power_amplifier_arr_node: Array, POWER_THRESHOLD: int) -> void:
|
||||
for i_node_powapm in power_amplifier_arr_node:
|
||||
var powamp_meta: String = i_node_powapm.get_meta('um')
|
||||
var status = STATE_VAL.GOOD if pow_dic else STATE_VAL.NONE
|
||||
if pow_dic[powamp_meta].size() < 6:
|
||||
status = STATE_VAL.ERROR
|
||||
else:
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return
|
||||
if powamp_meta in ['um_7', 'um_8', 'um_9', 'um_10', 'um_11', 'um_12'] and not fs_result.fs_5: return
|
||||
i_powapm.value0 = pow_dic[powamp_meta]
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p < constants_v.POWER_THRESHOLD:
|
||||
status = STATE_VAL.ERROR
|
||||
i_powapm.state = status
|
||||
if not pow_dic.has(powamp_meta): return
|
||||
if powamp_meta in ['um_1', 'um_2', 'um_3', 'um_4', 'um_5', 'um_6'] and not fs_result.fs_4: return
|
||||
if powamp_meta in ['um_9', 'um_10', 'um_11', 'um_12', 'um_13', 'um_14'] and not fs_result.fs_5: return
|
||||
i_node_powapm.value0 = pow_dic[powamp_meta]
|
||||
# Проверка: если ВСЕ значения в массиве < 1 → STATE_VAL.NONE
|
||||
var power_array: Array = pow_dic[powamp_meta]
|
||||
var all_below_one: bool = true
|
||||
for i_p in power_array:
|
||||
if i_p >= 1:
|
||||
all_below_one = false
|
||||
break
|
||||
|
||||
if all_below_one:
|
||||
i_node_powapm.state = STATE_VAL.NONE
|
||||
continue
|
||||
var count_above_threshold = 0
|
||||
for i_p in pow_dic[powamp_meta]:
|
||||
if i_p >= POWER_THRESHOLD:
|
||||
count_above_threshold += 1
|
||||
|
||||
status = STATE_VAL.GOOD if count_above_threshold >= 3 else STATE_VAL.ERROR
|
||||
i_node_powapm.state = status
|
||||
|
||||
|
||||
func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void:
|
||||
mashine_timer.stop()
|
||||
block_kasseta_y5_prd_config_v = control_prd_v.block_kasseta_y5_config
|
||||
func on_press_device(_device_name: String) -> void:
|
||||
var nodes_y5: Array = get_tree().get_nodes_in_group('y-5')
|
||||
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
|
||||
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
|
||||
var power_amplifier: Array = get_tree().get_nodes_in_group('power_amplifier')
|
||||
var default_reset_array_node: Array = get_tree().get_nodes_in_group('default_reset')
|
||||
var module_fs_4: Node = $kasseta_FS_VD/ref_A6
|
||||
var dou_4: Node = $dou4_A5
|
||||
var module_fs_5: Node = $kasseta_FS_VD/ref_A2
|
||||
var dou_5: Node = $dou5_A6
|
||||
var control_data = unit_prd_v.get_control_results()
|
||||
var for_control_result: Dictionary = {
|
||||
'nodes_y5': nodes_y5,
|
||||
'node_ip_power_arr': node_ip_power_arr,
|
||||
'fs_nodes': fs_nodes,
|
||||
'power_amplifier': power_amplifier,
|
||||
'default_reset_array_node': default_reset_array_node,
|
||||
'module_fs_4': module_fs_4,
|
||||
'dou_4': dou_4,
|
||||
'module_fs_5': module_fs_5,
|
||||
'dou_5': dou_5,
|
||||
}
|
||||
for_control_result.merge(control_data, true)
|
||||
on_control_result(for_control_result)
|
||||
|
||||
|
||||
static func on_control_result(for_result_dic: Dictionary) -> void:
|
||||
temperature_fill(for_result_dic.power_amplifier, for_result_dic.temperature_um)
|
||||
var all_y5_good: bool = true
|
||||
var block_kasseta_y5_prd_config_v: Dictionary = for_result_dic.block_kasseta_y5_config
|
||||
var nodes_y5: Array = for_result_dic.nodes_y5
|
||||
for node_y5 in nodes_y5:
|
||||
var meta_y5 = node_y5.get_meta('y5')
|
||||
if block_kasseta_y5_prd_config_v.has(meta_y5):
|
||||
if block_kasseta_y5_prd_config_v['yau07'] == false:
|
||||
if not block_kasseta_y5_prd_config_v.yau07:
|
||||
node_y5.state = STATE_VAL.ERROR if meta_y5 == 'yau07' else STATE_VAL.NONE
|
||||
break
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR
|
||||
else:
|
||||
node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_v[meta_y5] else STATE_VAL.ERROR
|
||||
if node_y5.state == STATE_VAL.ERROR:
|
||||
all_y5_good = false
|
||||
|
||||
block_ip_config_v = control_prd_v.block_ip_config
|
||||
var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply')
|
||||
for power_supply in node_ip_power_arr:
|
||||
var block_ip_config_v: Dictionary = for_result_dic.block_ip_config
|
||||
for power_supply in for_result_dic.node_ip_power_arr:
|
||||
var meta_ip = power_supply.get_meta('ip')
|
||||
if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug:
|
||||
if block_ip_config_v.has(meta_ip) and block_kasseta_y5_prd_config_v.ug and block_kasseta_y5_prd_config_v.yau07:
|
||||
power_supply.state = STATE_VAL.GOOD if block_ip_config_v[meta_ip][1] else STATE_VAL.ERROR
|
||||
else:
|
||||
power_supply.state = STATE_VAL.NONE
|
||||
if power_supply.state == STATE_VAL.ERROR:
|
||||
all_y5_good = false
|
||||
|
||||
var fs_nodes: Array = get_tree().get_nodes_in_group('fs_group')
|
||||
for f in fs_nodes:
|
||||
if not for_result_dic.control_is_over:
|
||||
set_default_state(for_result_dic.default_reset_array_node)
|
||||
set_default_state(for_result_dic.power_amplifier)
|
||||
return
|
||||
var result_dic: Dictionary = for_result_dic.result_dic
|
||||
for f in for_result_dic.fs_nodes:
|
||||
var fs_meta: String = f.get_meta('fs')
|
||||
if result_dic.has(fs_meta):
|
||||
var new_state = result_dic[fs_meta]
|
||||
f.state = new_state
|
||||
result_dic[fs_meta] = new_state
|
||||
f.state = result_dic[fs_meta]
|
||||
|
||||
if result_dic.fs_5 == 1:
|
||||
$kasseta_FS_VD/ref_A2.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR
|
||||
$dou5_A6.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_5 = 0
|
||||
if result_dic.fs_4 == 1:
|
||||
$kasseta_FS_VD/ref_A6.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR
|
||||
$dou4_A5.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR
|
||||
else:
|
||||
result_dic.fs_4 = 0
|
||||
power_fill(power_dic, result_dic)
|
||||
if not all_y5_good: return
|
||||
var fs_5 = true if int(result_dic.fs_5) == 1 else false
|
||||
if fs_5 and block_kasseta_y5_prd_config_v['yau07']:
|
||||
for_result_dic.module_fs_5.state = STATE_VAL.GOOD if result_dic.dkm_5 else STATE_VAL.ERROR
|
||||
for_result_dic.dou_5.state = STATE_VAL.GOOD if result_dic.dou_5 else STATE_VAL.ERROR
|
||||
|
||||
var result = true
|
||||
for device in result_dic.values():
|
||||
if not device:
|
||||
result = false
|
||||
var fs_4 = true if int(result_dic.fs_4) == 1 else false
|
||||
if fs_4 and block_kasseta_y5_prd_config_v['yau07']:
|
||||
for_result_dic.module_fs_4.state = STATE_VAL.GOOD if result_dic.dkm_4 else STATE_VAL.ERROR
|
||||
for_result_dic.dou_4.state = STATE_VAL.GOOD if result_dic.dou_4 else STATE_VAL.ERROR
|
||||
|
||||
var name_prd = control_prd_v.self_name
|
||||
if result:
|
||||
$control_result.text = 'Прибор ПРД-%s исправен' % name_prd
|
||||
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||
else:
|
||||
$control_result.text = 'Прибор ПРД-%s неисправен' % name_prd
|
||||
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||
if block_kasseta_y5_prd_config_v['yau07']:
|
||||
power_fill(for_result_dic.power_dic, for_result_dic.result_dic, for_result_dic.power_amplifier, for_result_dic.POWER_THRESHOLD)
|
||||
|
||||
|
||||
func find_labels(node1: Node):
|
||||
@@ -245,3 +190,22 @@ func find_labels(node1: Node):
|
||||
node1.set_meta("tooltip_set", true)
|
||||
for child in node1.get_children():
|
||||
find_labels(child)
|
||||
|
||||
|
||||
func _on_status_updated(status_text: String) -> void:
|
||||
_update_status_text(status_text)
|
||||
|
||||
|
||||
func _update_status_text(text: String) -> void:
|
||||
$control_result.text = text
|
||||
# Можно добавить смену цвета в зависимости от статуса
|
||||
if "Ошибка" in text or "неисправен" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.RED)
|
||||
log.message(Logger.INFO, 'Прибор ПРД-%s неисправен' % [unit_prd_v.self_name])
|
||||
elif "Ограничена" in text or "Предупреждение" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.YELLOW)
|
||||
elif "исправен" in text or "завершён" in text:
|
||||
$control_result.add_theme_color_override('font_color', Color.GREEN)
|
||||
log.message(Logger.INFO, 'Прибор ПРД-%s исправен' % [unit_prd_v.self_name])
|
||||
else:
|
||||
$control_result.add_theme_color_override('font_color', Color.WHITE)
|
||||
|
||||
@@ -1,13 +1,36 @@
|
||||
[gd_scene load_steps=9 format=3 uid="uid://cvskpe1ti3p45"]
|
||||
[gd_scene load_steps=13 format=3 uid="uid://cvskpe1ti3p45"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cvuosuvjaci1h" path="res://scenes/pribor-prd-v/pribor-prd-v.gd" id="1_c20s6"]
|
||||
[ext_resource type="PackedScene" uid="uid://d3iqb5e4g81m5" path="res://scenes/контроль/элемент-г.tscn" id="2_xpo4b"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="3_wyy1b"]
|
||||
[ext_resource type="PackedScene" uid="uid://bk1655p4e8y4u" path="res://scenes/контроль/кассета-у-5-нв.tscn" id="4_gl2bl"]
|
||||
[ext_resource type="PackedScene" uid="uid://cd5sue1e8iyrv" path="res://scenes/pribor-prd-n/kasseta-fs-nd.tscn" id="5_nhd2k"]
|
||||
[ext_resource type="Script" uid="uid://crpedygm3gohi" path="res://scenes/контроль/кассета.gd" id="6_os4mt"]
|
||||
[ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://scenes/контроль/элемент-в.tscn" id="7_38u2b"]
|
||||
[ext_resource type="PackedScene" uid="uid://bcyxqni7gxvtq" path="res://scenes/контроль/блок-в.tscn" id="8_4e87c"]
|
||||
[ext_resource type="Texture2D" uid="uid://belwchvdktrw0" path="res://data/эмс-бланк.png" id="9_4e87c"]
|
||||
[ext_resource type="Texture2D" uid="uid://bwddxs24es81u" path="res://data/эмс-бланк-пост.png" id="10_g8fvp"]
|
||||
[ext_resource type="Texture2D" uid="uid://pfoscstbm025" path="res://data/эмс-бланк-перем.png" id="11_gsby4"]
|
||||
[ext_resource type="Texture2D" uid="uid://dvl3sq036gn75" path="res://data/эмс-бланк-замыкание.png" id="12_vxfkm"]
|
||||
|
||||
[sub_resource type="SpriteFrames" id="SpriteFrames_s5gcy"]
|
||||
animations = [{
|
||||
"frames": [{
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("9_4e87c")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("10_g8fvp")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("11_gsby4")
|
||||
}, {
|
||||
"duration": 1.0,
|
||||
"texture": ExtResource("12_vxfkm")
|
||||
}],
|
||||
"loop": true,
|
||||
"name": &"default",
|
||||
"speed": 5.0
|
||||
}]
|
||||
|
||||
[node name="pribor_prd_v" type="Control"]
|
||||
layout_mode = 3
|
||||
@@ -18,50 +41,50 @@ offset_right = 15.0
|
||||
offset_bottom = 30.0
|
||||
script = ExtResource("1_c20s6")
|
||||
|
||||
[node name="maa2000_A22" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_xpo4b")]
|
||||
[node name="maa2000_A22" parent="." groups=["power_supply"] instance=ExtResource("2_xpo4b")]
|
||||
layout_mode = 2
|
||||
offset_left = 485.0
|
||||
offset_top = 877.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 524.0
|
||||
offset_top = 731.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 803.0
|
||||
fname = "MAA2000"
|
||||
rname = "A22"
|
||||
metadata/ip = "maa2000_1"
|
||||
|
||||
[node name="dou4_A5" parent="." groups=["default_reset"] instance=ExtResource("2_xpo4b")]
|
||||
layout_mode = 2
|
||||
offset_left = 485.0
|
||||
offset_top = 812.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 877.0
|
||||
offset_left = 524.0
|
||||
offset_top = 666.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 731.0
|
||||
fname = "ДОУ-4"
|
||||
rname = "A5"
|
||||
|
||||
[node name="maa2000_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("2_xpo4b")]
|
||||
[node name="maa2000_A23" parent="." groups=["power_supply"] instance=ExtResource("2_xpo4b")]
|
||||
layout_mode = 2
|
||||
offset_left = 8.0
|
||||
offset_top = 877.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 47.0
|
||||
offset_top = 731.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 803.0
|
||||
fname = "MAA2000"
|
||||
rname = "A23"
|
||||
metadata/ip = "maa2000_2"
|
||||
|
||||
[node name="dou5_A6" parent="." groups=["default_reset"] instance=ExtResource("2_xpo4b")]
|
||||
layout_mode = 2
|
||||
offset_left = 8.0
|
||||
offset_top = 812.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 877.0
|
||||
offset_left = 47.0
|
||||
offset_top = 666.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 731.0
|
||||
fname = "ДОУ-5"
|
||||
rname = "A6"
|
||||
|
||||
[node name="ref_ZZ3" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 812.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 949.0
|
||||
offset_left = 214.0
|
||||
offset_top = 666.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 803.0
|
||||
texture = ExtResource("3_wyy1b")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -80,27 +103,98 @@ text = "Панель
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="kasseta_U5" parent="." instance=ExtResource("4_gl2bl")]
|
||||
[node name="kasseta_U5" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 242.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 432.0
|
||||
offset_left = 214.0
|
||||
offset_top = 96.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 286.0
|
||||
texture = ExtResource("3_wyy1b")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
script = ExtResource("6_os4mt")
|
||||
|
||||
[node name="lbl_fname" type="Label" parent="kasseta_U5"]
|
||||
self_modulate = Color(1, 1, 1, 0.62)
|
||||
layout_mode = 0
|
||||
offset_left = 5.0
|
||||
offset_top = 7.0
|
||||
offset_right = 305.0
|
||||
offset_bottom = 35.0
|
||||
text = "Кассета У5"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="ref_A24" parent="kasseta_U5" groups=["power_supply"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 5.0
|
||||
offset_top = 32.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ИП5-25"
|
||||
rname = "A24"
|
||||
metadata/ip = "ip5_25"
|
||||
|
||||
[node name="ref_A30" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 55.0
|
||||
offset_top = 32.0
|
||||
offset_right = 105.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ЯУ-07Б"
|
||||
rname = "A30"
|
||||
metadata/y5 = "yau07"
|
||||
|
||||
[node name="ref_A26" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 105.0
|
||||
offset_top = 32.0
|
||||
offset_right = 155.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ЭМС-Г"
|
||||
rname = "A26"
|
||||
metadata/y5 = "ems"
|
||||
|
||||
[node name="ref_A27" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 155.0
|
||||
offset_top = 32.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УГ"
|
||||
rname = "A27"
|
||||
metadata/y5 = "ug"
|
||||
|
||||
[node name="ref_A28" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 205.0
|
||||
offset_top = 32.0
|
||||
offset_right = 255.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УКП"
|
||||
rname = "A28"
|
||||
metadata/y5 = "ukp1"
|
||||
|
||||
[node name="ref_A29" parent="kasseta_U5" groups=["y-5"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 254.0
|
||||
offset_top = 32.0
|
||||
offset_right = 304.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УКП"
|
||||
rname = "A29"
|
||||
metadata/y5 = "ukp2"
|
||||
|
||||
[node name="kasseta_FS_VD" parent="." instance=ExtResource("5_nhd2k")]
|
||||
layout_mode = 0
|
||||
offset_left = 175.0
|
||||
offset_top = 432.0
|
||||
offset_right = 485.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 214.0
|
||||
offset_top = 286.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 476.0
|
||||
fname = "Кассета ФС-ВД"
|
||||
|
||||
[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
|
||||
offset_left = 214.0
|
||||
offset_top = 476.0
|
||||
offset_right = 524.0
|
||||
offset_bottom = 666.0
|
||||
texture = ExtResource("3_wyy1b")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -109,7 +203,7 @@ patch_margin_bottom = 16
|
||||
script = ExtResource("6_os4mt")
|
||||
fname = "Кассета П-1В"
|
||||
|
||||
[node name="ref_A19" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")]
|
||||
[node name="ref_A19" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 9.0
|
||||
offset_top = 33.0
|
||||
offset_right = 59.0
|
||||
@@ -118,7 +212,7 @@ fname = "ИП9-50"
|
||||
rname = "A19"
|
||||
metadata/ip = "ip9_50_1"
|
||||
|
||||
[node name="ref_A20" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")]
|
||||
[node name="ref_A20" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 59.0
|
||||
offset_top = 33.0
|
||||
offset_right = 109.0
|
||||
@@ -127,7 +221,7 @@ fname = "ИП9-50"
|
||||
rname = "A20"
|
||||
metadata/ip = "ip9_50_2"
|
||||
|
||||
[node name="ref_A21" parent="kasseta_P_1" groups=["default_reset", "power_supply"] instance=ExtResource("7_38u2b")]
|
||||
[node name="ref_A21" parent="kasseta_P_1" groups=["power_supply"] instance=ExtResource("7_38u2b")]
|
||||
offset_left = 109.0
|
||||
offset_top = 33.0
|
||||
offset_right = 159.0
|
||||
@@ -149,153 +243,178 @@ vertical_alignment = 1
|
||||
|
||||
[node name="um1535_A7" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 242.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 337.0
|
||||
fname = "УМ1535Б"
|
||||
offset_left = 524.0
|
||||
offset_top = 96.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 191.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A7"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_1"
|
||||
|
||||
[node name="um1535_A8" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 337.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 432.0
|
||||
offset_left = 524.0
|
||||
offset_top = 191.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 286.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A8"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_2"
|
||||
|
||||
[node name="um1535_A9" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 432.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 527.0
|
||||
offset_left = 524.0
|
||||
offset_top = 286.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 381.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A9"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_3"
|
||||
|
||||
[node name="um1535_A10" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 527.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 524.0
|
||||
offset_top = 381.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 476.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A10"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_4"
|
||||
|
||||
[node name="um1535_A11" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 622.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 717.0
|
||||
offset_left = 524.0
|
||||
offset_top = 476.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 571.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A11"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_5"
|
||||
|
||||
[node name="um1535_A12" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 485.0
|
||||
offset_top = 717.0
|
||||
offset_right = 652.0
|
||||
offset_bottom = 812.0
|
||||
offset_left = 524.0
|
||||
offset_top = 571.0
|
||||
offset_right = 691.0
|
||||
offset_bottom = 666.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A12"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_6"
|
||||
|
||||
[node name="um1535_A13" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 242.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 337.0
|
||||
offset_left = 47.0
|
||||
offset_top = 96.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 191.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A13"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_7"
|
||||
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 337.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 432.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность, Вт"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_8"
|
||||
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 432.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 527.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность, Вт"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_9"
|
||||
|
||||
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
[node name="um1535_A14" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 527.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 622.0
|
||||
offset_left = 47.0
|
||||
offset_top = 191.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 286.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность, Вт"
|
||||
rname = "A14"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_10"
|
||||
|
||||
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
[node name="um1535_A15" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 622.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 717.0
|
||||
offset_left = 47.0
|
||||
offset_top = 286.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 381.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность, Вт"
|
||||
rname = "A15"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_11"
|
||||
|
||||
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
[node name="um1535_A16" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 8.0
|
||||
offset_top = 717.0
|
||||
offset_right = 175.0
|
||||
offset_bottom = 812.0
|
||||
offset_left = 47.0
|
||||
offset_top = 381.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 476.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность, Вт"
|
||||
rname = "A16"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_12"
|
||||
|
||||
[node name="um1535_A17" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 47.0
|
||||
offset_top = 476.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 571.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A17"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_13"
|
||||
|
||||
[node name="um1535_A18" parent="." groups=["power_amplifier"] instance=ExtResource("8_4e87c")]
|
||||
layout_mode = 0
|
||||
offset_left = 47.0
|
||||
offset_top = 571.0
|
||||
offset_right = 214.0
|
||||
offset_bottom = 666.0
|
||||
fname = "УМ1535А"
|
||||
rname = "A18"
|
||||
value0_info = "Мощность"
|
||||
value1_info = "Температура,°C"
|
||||
metadata/um = "um_14"
|
||||
|
||||
[node name="input_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(496, 440)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="input_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(248, 440)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="output_0" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(496, 336)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="output_1" type="AnimatedSprite2D" parent="."]
|
||||
position = Vector2(248, 336)
|
||||
sprite_frames = SubResource("SpriteFrames_s5gcy")
|
||||
|
||||
[node name="line" type="Line2D" parent="."]
|
||||
position = Vector2(59, 920)
|
||||
scale = Vector2(1.03548, 1)
|
||||
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
|
||||
width = 2.0
|
||||
default_color = Color(1, 1, 1, 0.352941)
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="control_result" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 9.0
|
||||
offset_top = 960.0
|
||||
offset_right = 649.0
|
||||
offset_bottom = 1003.0
|
||||
offset_left = 49.0
|
||||
offset_top = 993.0
|
||||
offset_right = 689.0
|
||||
offset_bottom = 1036.0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
horizontal_alignment = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
@@ -1,35 +1,39 @@
|
||||
@tool
|
||||
class_name pribor_uf extends 'res://scenes/контроль/прибор.gd'
|
||||
|
||||
signal control_is_over(device_name: String) # Когда контроль завершен
|
||||
enum STATE_VAL {NONE = 0, GOOD = 1, ERROR = 2}
|
||||
const DEV_LIST = ['00:1f.6', '07:00.0', '08:00.0', '0b:00.0']
|
||||
const USB_TRACKERBALL = '13ba:0018'
|
||||
const REVFF = '(rev ff)'
|
||||
const DEV_LIST: Array = ['00:1f.6', '07:00.0', '08:00.0', '0b:00.0']
|
||||
const USB_TRACKERBALL: String = '13ba:0018'
|
||||
const REVFF: String = '(rev ff)'
|
||||
var unit_uf: Object
|
||||
var ctrl_pos = 100
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if Engine.is_editor_hint():
|
||||
return
|
||||
var unit_uf: = network.get_unit_instance('уарэп-эмс')
|
||||
if Engine.is_editor_hint(): return
|
||||
signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_contol_device'))
|
||||
unit_uf = network.get_unit_instance('уарэп-эмс')
|
||||
unit_uf.connect('line_changed', on_line_changed)
|
||||
control_vk()
|
||||
on_line_changed(unit_uf)
|
||||
on_line_changed()
|
||||
#control_vk()
|
||||
control_ems(unit_uf.status)
|
||||
status_uf()
|
||||
find_labels(self)
|
||||
|
||||
|
||||
func on_timer(unit_name: StringName):
|
||||
var unit_uf = network.get_unit_instance(unit_name)
|
||||
func _on_start_contol_device():
|
||||
on_line_changed()
|
||||
control_ems(unit_uf.status) # проверка ЭМС ячеек
|
||||
status_uf() # отслеживание состояния прибора
|
||||
if unit_uf.online: # проверка ЯУ, внутреннего коммутатора и ИП-5Б
|
||||
control_ems(unit_uf.status) # проверка ЭМС ячеек
|
||||
|
||||
|
||||
func on_line_changed(unit_uf):
|
||||
func on_line_changed():
|
||||
if unit_uf.online: # проверка ЯУ, внутреннего коммутатора и ИП-5Б
|
||||
$ref_uf/ref_kassetav13/ref_A7_YAU07.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_kassetav13/ref_A3_IP5B.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_kassetav13/ref_A9_ESW.state = STATE_VAL.GOOD
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD ## заглушка для зеленения ВК-110
|
||||
else:
|
||||
$ref_uf/ref_kassetav13/ref_A7_YAU07.state = STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A4_KEMS.state = STATE_VAL.NONE
|
||||
@@ -38,6 +42,7 @@ func on_line_changed(unit_uf):
|
||||
$ref_uf/ref_kassetav13/ref_A3_IP5B.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A9_ESW.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_kassetav13/ref_A12_IP27B.state = STATE_VAL.NONE
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.NONE
|
||||
|
||||
|
||||
func control_vk() -> void:
|
||||
@@ -76,14 +81,13 @@ func control_vk() -> void:
|
||||
else:
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.ERROR
|
||||
|
||||
$ref_uf/ref_bu1/ref_A8_BU.state = STATE_VAL.GOOD ## заглушка для зеленения ВК-110
|
||||
|
||||
|
||||
func control_ems(status: Array) -> void:
|
||||
$ref_uf/ref_kassetav13/ref_A4_KEMS.state = STATE_VAL.GOOD if ((status[0] >> 0) & 1) and ((status[0] >> 3) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A5_EMS.state = STATE_VAL.GOOD if ((status[0] >> 1) & 1) and ((status[0] >> 4) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A6_EMS.state = STATE_VAL.GOOD if ((status[0] >> 2) & 1) and ((status[0] >> 5) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A12_IP27B.state = STATE_VAL.GOOD if ((status[2] >> 6) & 1) else STATE_VAL.ERROR
|
||||
if status:
|
||||
$ref_uf/ref_kassetav13/ref_A4_KEMS.state = STATE_VAL.GOOD if ((status[0] >> 0) & 1) and ((status[0] >> 3) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A5_EMS.state = STATE_VAL.GOOD if ((status[0] >> 1) & 1) and ((status[0] >> 4) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A6_EMS.state = STATE_VAL.GOOD if ((status[0] >> 2) & 1) and ((status[0] >> 5) & 1) else STATE_VAL.ERROR
|
||||
$ref_uf/ref_kassetav13/ref_A12_IP27B.state = STATE_VAL.GOOD if ((status[2] >> 6) & 1) else STATE_VAL.ERROR
|
||||
|
||||
|
||||
func status_uf() -> void:
|
||||
@@ -100,9 +104,10 @@ func status_uf() -> void:
|
||||
$lbl_header2.text = 'Прибор исправен'
|
||||
$lbl_header2.modulate = Color.GREEN
|
||||
else:
|
||||
$lbl_header2.text = 'Прибор не исправен'
|
||||
$lbl_header2.text = 'Прибор неисправен'
|
||||
$lbl_header2.modulate = Color.RED
|
||||
$lbl_header2.visible = true
|
||||
emit_signal('control_is_over', unit_uf.name)
|
||||
|
||||
|
||||
func find_labels(node1: Node):
|
||||
|
||||
@@ -7,14 +7,16 @@
|
||||
[node name="pribor_uf" type="Control"]
|
||||
layout_mode = 3
|
||||
anchors_preset = 0
|
||||
offset_left = -121.0
|
||||
offset_right = -121.0
|
||||
script = ExtResource("1_7gtpa")
|
||||
|
||||
[node name="ref_uf" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 187.0
|
||||
offset_top = 247.0
|
||||
offset_right = 708.0
|
||||
offset_bottom = 955.0
|
||||
offset_left = 244.0
|
||||
offset_top = 128.0
|
||||
offset_right = 765.0
|
||||
offset_bottom = 836.0
|
||||
texture = ExtResource("2_ho0da")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -142,19 +144,20 @@ offset_bottom = 35.0
|
||||
text = "Кассета В-13"
|
||||
|
||||
[node name="lbl_header2" type="Label" parent="."]
|
||||
visible = false
|
||||
layout_mode = 0
|
||||
offset_left = 199.0
|
||||
offset_top = 974.0
|
||||
offset_right = 704.0
|
||||
offset_bottom = 1000.0
|
||||
offset_left = 252.0
|
||||
offset_top = 1009.0
|
||||
offset_right = 757.0
|
||||
offset_bottom = 1064.0
|
||||
theme_override_font_sizes/font_size = 22
|
||||
text = "Прибор не исправен
|
||||
"
|
||||
text = "Ожидание запуска контроля"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="timer" type="Timer" parent="."]
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="timer" to="." method="on_timer" binds= [&"уарэп-эмс"]]
|
||||
[node name="line" type="Line2D" parent="."]
|
||||
position = Vector2(195, 950)
|
||||
scale = Vector2(1.03548, 1)
|
||||
points = PackedVector2Array(-8, 0, 61.8069, 0, 608, 0)
|
||||
width = 2.0
|
||||
default_color = Color(1, 1, 1, 0.352941)
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
@@ -17,10 +17,10 @@ script = ExtResource("1_46rp6")
|
||||
|
||||
[node name="ref_G1" type="NinePatchRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 70.0
|
||||
offset_top = 303.0
|
||||
offset_right = 660.0
|
||||
offset_bottom = 1085.0
|
||||
offset_left = 88.0
|
||||
offset_top = 128.0
|
||||
offset_right = 678.0
|
||||
offset_bottom = 910.0
|
||||
texture = ExtResource("1_6olof")
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
@@ -29,10 +29,10 @@ patch_margin_bottom = 16
|
||||
|
||||
[node name="spt25_A1" parent="." instance=ExtResource("6_60xs3")]
|
||||
layout_mode = 0
|
||||
offset_left = 88.0
|
||||
offset_top = 319.0
|
||||
offset_right = 343.0
|
||||
offset_bottom = 749.0
|
||||
offset_left = 106.0
|
||||
offset_top = 144.0
|
||||
offset_right = 361.0
|
||||
offset_bottom = 574.0
|
||||
tooltip_text = "Ящик - 11, Позиция - 3"
|
||||
script = ExtResource("4_v0lil")
|
||||
unit_name = "уарэп-спт25-1"
|
||||
@@ -64,10 +64,10 @@ offset_bottom = 417.0
|
||||
|
||||
[node name="spt25_A2" parent="." instance=ExtResource("6_60xs3")]
|
||||
layout_mode = 0
|
||||
offset_left = 392.0
|
||||
offset_top = 320.0
|
||||
offset_right = 642.0
|
||||
offset_bottom = 750.0
|
||||
offset_left = 410.0
|
||||
offset_top = 145.0
|
||||
offset_right = 660.0
|
||||
offset_bottom = 575.0
|
||||
tooltip_text = "Ящик - 11, Позиция - 2"
|
||||
script = ExtResource("4_v0lil")
|
||||
unit_name = "уарэп-спт25-2"
|
||||
@@ -98,10 +98,10 @@ offset_right = 235.0
|
||||
offset_bottom = 417.0
|
||||
|
||||
[node name="sch3" parent="." instance=ExtResource("7_qu7ja")]
|
||||
offset_left = 88.0
|
||||
offset_top = 774.0
|
||||
offset_right = 643.0
|
||||
offset_bottom = 1059.0
|
||||
offset_left = 106.0
|
||||
offset_top = 599.0
|
||||
offset_right = 661.0
|
||||
offset_bottom = 884.0
|
||||
unit_name = "уарэп-щ3"
|
||||
fname = "Щ3 (контроль и управление питанием)"
|
||||
rname = "A1"
|
||||
|
||||
@@ -32,29 +32,29 @@ func disable_all():
|
||||
func on_data_received(data: PackedByteArray):
|
||||
|
||||
# Сеть 1. Использование
|
||||
$block_input1.state = STATE_VAL.GOOD if data[4] & (1 << 5) else STATE_VAL.ERROR
|
||||
$block_input1.state = STATE_VAL.GOOD if data[3] & (1 << 5) else STATE_VAL.ERROR
|
||||
# Сеть 1. Вход
|
||||
$block_input1.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 1)) == 0) and ((data[4] & (1 << 3)) == 0) else STATE_VAL.ERROR
|
||||
$block_input1.state0 = STATE_VAL.GOOD if ((data[3] & (1 << 1)) == 0) and ((data[3] & (1 << 3)) == 0) else STATE_VAL.ERROR
|
||||
# Сеть 1. Неисправность блока инвертора 1 канала
|
||||
$block_input1.state1 = STATE_VAL.GOOD if (data[6] & (1 << 2)) == 0 else STATE_VAL.ERROR
|
||||
$block_input1.state1 = STATE_VAL.GOOD if (data[5] & (1 << 2)) == 0 else STATE_VAL.ERROR
|
||||
# Сеть 1. Перегрев 1 канала
|
||||
$block_input1.state2 = STATE_VAL.GOOD if (data[5] & (1 << 3)) == 0 else STATE_VAL.ERROR
|
||||
$block_input1.state2 = STATE_VAL.GOOD if (data[4] & (1 << 3)) == 0 else STATE_VAL.ERROR
|
||||
|
||||
# Сеть 2. Использование
|
||||
$block_input2.state = STATE_VAL.GOOD if data[4] & (1 << 6) else STATE_VAL.ERROR
|
||||
$block_input2.state = STATE_VAL.GOOD if data[3] & (1 << 6) else STATE_VAL.ERROR
|
||||
# Сеть 2. Вход
|
||||
$block_input2.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 2)) == 0) and ((data[4] & (1 << 4)) == 0) else STATE_VAL.ERROR
|
||||
$block_input2.state0 = STATE_VAL.GOOD if ((data[3] & (1 << 2)) == 0) and ((data[3] & (1 << 4)) == 0) else STATE_VAL.ERROR
|
||||
# Сеть 2. Неисправность блока инвертора 2 канала
|
||||
$block_input2.state1 = STATE_VAL.GOOD if (data[6] & (1 << 3)) == 0 else STATE_VAL.ERROR
|
||||
$block_input2.state1 = STATE_VAL.GOOD if (data[5] & (1 << 3)) == 0 else STATE_VAL.ERROR
|
||||
# Сеть 2. Перегрев 2 канала
|
||||
$block_input2.state2 = STATE_VAL.GOOD if (data[5] & (1 << 4)) == 0 else STATE_VAL.ERROR
|
||||
$block_input2.state2 = STATE_VAL.GOOD if (data[4] & (1 << 4)) == 0 else STATE_VAL.ERROR
|
||||
|
||||
# Неисправность, напряжение меньше номинального, напряжение выше номинального
|
||||
$block_output.state0 = STATE_VAL.GOOD if ((data[4] & (1 << 0)) == 0) and ((data[4] & (1 << 7)) == 0) and ((data[5] & (1 << 2)) == 0) else STATE_VAL.ERROR
|
||||
$block_output.state0 = STATE_VAL.GOOD if ((data[3] & (1 << 0)) == 0) and ((data[3] & (1 << 7)) == 0) and ((data[4] & (1 << 2)) == 0) else STATE_VAL.ERROR
|
||||
# Перегрузка и короткое замыкание по выходу
|
||||
$block_output.state1 = STATE_VAL.GOOD if ((data[5] & (1 << 0)) == 0) and ((data[5] & (1 << 1)) == 0) else STATE_VAL.ERROR
|
||||
$block_output.state1 = STATE_VAL.GOOD if ((data[4] & (1 << 0)) == 0) and ((data[4] & (1 << 1)) == 0) else STATE_VAL.ERROR
|
||||
# Критическая температура
|
||||
$block_output.state2 = STATE_VAL.GOOD if ((data[5] & (1 << 5)) == 0) else STATE_VAL.ERROR
|
||||
$block_output.state2 = STATE_VAL.GOOD if ((data[4] & (1 << 5)) == 0) else STATE_VAL.ERROR
|
||||
|
||||
# Обобщённое состояние
|
||||
state = STATE_VAL.GOOD \
|
||||
|
||||
@@ -1,48 +1,208 @@
|
||||
extends Label
|
||||
# Используем более понятные имена переменных
|
||||
const STATUS_GOOD := {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK}
|
||||
const STATUS_BAD := {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE}
|
||||
var _is_uf_status_initialized: bool = false
|
||||
var is_prd_operational: bool = true
|
||||
var is_uf_operational: bool = false
|
||||
|
||||
enum PRD_STATE {
|
||||
NONE, # Нет связи
|
||||
GOOD, # Исправно
|
||||
ERR # Отказ
|
||||
}
|
||||
|
||||
enum DEVICE_STATUS {
|
||||
ONLINE, # Связь есть
|
||||
STATUS, # Статус исправности
|
||||
CONTROL # Контроль завершен
|
||||
}
|
||||
|
||||
const STATUS_CONFIG := {
|
||||
PRD_STATE.NONE: {"text": "Нет связи", "color": Color.WHITE, "font_color": Color.BLACK},
|
||||
PRD_STATE.GOOD: {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK},
|
||||
PRD_STATE.ERR: {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE}
|
||||
}
|
||||
|
||||
class DeviceObserver:
|
||||
var device_name: String
|
||||
var status: Array = [false, false, false] # [online, operational, control_complete]
|
||||
var last_results: Dictionary = {}
|
||||
|
||||
func update_online_state(online: bool) -> bool:
|
||||
if status[DEVICE_STATUS.ONLINE] != online:
|
||||
status[DEVICE_STATUS.ONLINE] = online
|
||||
return true
|
||||
return false
|
||||
|
||||
func update_control_results(results: Dictionary) -> bool:
|
||||
var changed := false
|
||||
last_results = results.duplicate()
|
||||
|
||||
if results.get('is_over_control', false):
|
||||
# Контроль завершен - проверяем все результаты
|
||||
var all_ok := true
|
||||
for key in results:
|
||||
if key != 'is_over_control' and not results[key]:
|
||||
all_ok = false
|
||||
break
|
||||
|
||||
if status[DEVICE_STATUS.STATUS] != all_ok or status[DEVICE_STATUS.CONTROL] != true:
|
||||
status[DEVICE_STATUS.STATUS] = all_ok
|
||||
status[DEVICE_STATUS.CONTROL] = true
|
||||
changed = true
|
||||
else:
|
||||
# Контроль в процессе - проверяем базовые параметры
|
||||
var basic_ok: bool = results.get('block_kasseta', false) and \
|
||||
results.get('block_ip', false) and \
|
||||
results.get('temperature', true)
|
||||
|
||||
if status[DEVICE_STATUS.STATUS] != basic_ok or status[DEVICE_STATUS.CONTROL] != false:
|
||||
status[DEVICE_STATUS.STATUS] = basic_ok
|
||||
status[DEVICE_STATUS.CONTROL] = false
|
||||
changed = true
|
||||
return changed
|
||||
|
||||
var device_observers: Dictionary = {}
|
||||
var overall_prd_state: PRD_STATE = PRD_STATE.NONE
|
||||
|
||||
func _ready() -> void:
|
||||
tooltip_text = 'Нет связи с приборами комплекса'
|
||||
for prd_module in prd.prd_dict.values():
|
||||
prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module))
|
||||
var unit_uf: = network.get_unit_instance('уарэп-эмс')
|
||||
unit_uf.connect('data_received', Callable(self, 'on_uf_status_receive'))
|
||||
add_theme_color_override("font_color", Color.BLACK)
|
||||
|
||||
# Инициализация наблюдателей
|
||||
_initialize_observers()
|
||||
|
||||
func on_serviceability_changed(unit_prd_module: Object) -> void:
|
||||
var check_service: bool = true
|
||||
# Подписка на сигналы ПРД модулей
|
||||
for prd_module in prd.prd_dict.values():
|
||||
if prd_module.unit_yau07.online:
|
||||
if not unit_prd_module.serviceability:
|
||||
check_service = false
|
||||
if check_service != is_prd_operational:
|
||||
is_prd_operational = check_service
|
||||
_update_serviceability_display()
|
||||
# Подключаемся к контролю ПРД
|
||||
if prd_module.unit_control:
|
||||
prd_module.unit_control.connect('control_results_updated', Callable(self, '_on_prd_control_results').bind(prd_module))
|
||||
# Подключаемся к онлайн-статусу ЯУ-07
|
||||
if prd_module.unit_yau07:
|
||||
prd_module.unit_yau07.connect('line_changed', Callable(self, '_on_prd_online_changed').bind(prd_module))
|
||||
|
||||
# Подписка на УФ
|
||||
var unit_uf = network.get_unit_instance('уарэп-эмс')
|
||||
if unit_uf:
|
||||
unit_uf.data_received.connect(Callable(self, '_on_uf_status_receive'))
|
||||
|
||||
# Инициализация начального состояния
|
||||
_recalculate_overall_state()
|
||||
|
||||
|
||||
func _update_serviceability_display() -> void:
|
||||
var status := STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD
|
||||
text = status.text
|
||||
modulate = status.color
|
||||
tooltip_text = 'Результаты обобщенного признака работоспособности изделия'
|
||||
add_theme_color_override("font_color", status.font_color)
|
||||
func _initialize_observers() -> void:
|
||||
var device_names := [
|
||||
'уарэп-яу07-1н', 'уарэп-яу07-1в', 'уарэп-яу07-1к',
|
||||
'уарэп-яу07-2н', 'уарэп-яу07-2в', 'уарэп-яу07-2к',
|
||||
'уарэп-яу07-3н', 'уарэп-яу07-3в', 'уарэп-яу07-3к',
|
||||
'уарэп-яу07-4н', 'уарэп-яу07-4в', 'уарэп-яу07-4к'
|
||||
]
|
||||
|
||||
for device_name in device_names:
|
||||
device_observers[device_name] = DeviceObserver.new()
|
||||
device_observers[device_name].device_name = device_name
|
||||
|
||||
|
||||
func on_uf_status_receive(unit_uf: Object) -> void:
|
||||
var KEMS_B = ((unit_uf.status[0] >> 0) & 1) and ((unit_uf.status[0] >> 3) & 1)
|
||||
var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) and ((unit_uf.status[0] >> 4) & 1)
|
||||
var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) and ((unit_uf.status[0] >> 5) & 1)
|
||||
var IP27B = ((unit_uf.status[2] >> 6) & 1)
|
||||
var check_service: bool = KEMS_B and EMS_B_1 and EMS_B_2 and IP27B
|
||||
if not _is_uf_status_initialized or check_service != is_uf_operational:
|
||||
is_uf_operational = check_service
|
||||
_update_serviceability_display()
|
||||
signaller.emit_signal('update_uf_serviceability', check_service)
|
||||
_is_uf_status_initialized = true
|
||||
func _on_prd_online_changed(line_status: Object, prd_module: Object) -> void:
|
||||
var online: bool = line_status.online
|
||||
var observer: DeviceObserver = device_observers.get(prd_module.prd_name)
|
||||
if observer and observer.update_online_state(online):
|
||||
_recalculate_overall_state()
|
||||
|
||||
|
||||
func _on_prd_control_results(results: Dictionary, prd_module: Object) -> void:
|
||||
var observer: DeviceObserver = device_observers.get(prd_module.prd_name)
|
||||
if observer and observer.update_control_results(results):
|
||||
_recalculate_overall_state()
|
||||
|
||||
|
||||
func _on_uf_status_receive(_unit_uf: Object) -> void:
|
||||
# Логика для УФ (раскомментируй если нужно)
|
||||
# var KEMS_B = ((unit_uf.status[0] >> 0) & 1) and ((unit_uf.status[0] >> 3) & 1)
|
||||
# var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) and ((unit_uf.status[0] >> 4) & 1)
|
||||
# var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) and ((unit_uf.status[0] >> 5) & 1)
|
||||
# var IP27B = ((unit_uf.status[2] >> 6) & 1)
|
||||
# var uf_operational = KEMS_B and EMS_B_1 and EMS_B_2 and IP27B
|
||||
# signaller.emit_signal('update_uf_serviceability', uf_operational)
|
||||
pass
|
||||
|
||||
|
||||
func _recalculate_overall_state() -> void:
|
||||
var new_state := PRD_STATE.NONE
|
||||
var has_online_devices := false
|
||||
var all_operational := true
|
||||
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE]:
|
||||
has_online_devices = true
|
||||
|
||||
if observer.status[DEVICE_STATUS.CONTROL]:
|
||||
# Если контроль завершен - строгая проверка
|
||||
if not observer.status[DEVICE_STATUS.STATUS]:
|
||||
all_operational = false
|
||||
break
|
||||
else:
|
||||
# Если контроль в процессе - мягкая проверка
|
||||
if not observer.status[DEVICE_STATUS.STATUS]:
|
||||
all_operational = false
|
||||
# Не прерываем, чтобы проверить все устройства
|
||||
|
||||
if has_online_devices:
|
||||
new_state = PRD_STATE.GOOD if all_operational else PRD_STATE.ERR
|
||||
else:
|
||||
new_state = PRD_STATE.NONE
|
||||
|
||||
if overall_prd_state != new_state:
|
||||
overall_prd_state = new_state
|
||||
_update_display()
|
||||
|
||||
|
||||
func _update_display() -> void:
|
||||
var config: Dictionary = STATUS_CONFIG[overall_prd_state].duplicate()
|
||||
|
||||
text = config.text
|
||||
modulate = config.color
|
||||
add_theme_color_override("font_color", config.font_color)
|
||||
tooltip_text = _get_tooltip_text()
|
||||
|
||||
|
||||
func _get_tooltip_text() -> String:
|
||||
match overall_prd_state:
|
||||
PRD_STATE.NONE:
|
||||
return "Нет связи с приборами комплекса"
|
||||
PRD_STATE.GOOD:
|
||||
return "Все приборы комплекса исправны"
|
||||
PRD_STATE.ERR:
|
||||
return "Обнаружены неисправности в комплексе"
|
||||
_:
|
||||
return "Неизвестное состояние"
|
||||
|
||||
|
||||
# Публичные методы для получения информации
|
||||
func get_device_status(device_name: String) -> Dictionary:
|
||||
var observer: DeviceObserver = device_observers.get(device_name)
|
||||
if observer:
|
||||
return {
|
||||
"online": observer.status[DEVICE_STATUS.ONLINE],
|
||||
"operational": observer.status[DEVICE_STATUS.STATUS],
|
||||
"control_complete": observer.status[DEVICE_STATUS.CONTROL],
|
||||
"last_results": observer.last_results.duplicate()
|
||||
}
|
||||
return {}
|
||||
|
||||
|
||||
func get_overall_status() -> Dictionary:
|
||||
var online_count := 0
|
||||
var operational_count := 0
|
||||
var control_complete_count := 0
|
||||
|
||||
for observer in device_observers.values():
|
||||
if observer.status[DEVICE_STATUS.ONLINE]:
|
||||
online_count += 1
|
||||
if observer.status[DEVICE_STATUS.STATUS]:
|
||||
operational_count += 1
|
||||
if observer.status[DEVICE_STATUS.CONTROL]:
|
||||
control_complete_count += 1
|
||||
|
||||
return {
|
||||
"overall_state": overall_prd_state,
|
||||
"online_devices": online_count,
|
||||
"operational_devices": operational_count,
|
||||
"total_devices": device_observers.size(),
|
||||
"control_complete_devices": control_complete_count
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
uid://b5ykwyk5vpi6
|
||||
uid://b5ykwyk5vpi6
|
||||
|
||||
@@ -79,25 +79,10 @@ visible = false
|
||||
layout_mode = 2
|
||||
metadata/_tab_index = 5
|
||||
|
||||
[node name="lbl_ready" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1503.0
|
||||
offset_right = 1600.0
|
||||
offset_bottom = 27.0
|
||||
tooltip_text = "Готовность аппаратуры к работе"
|
||||
mouse_filter = 0
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22")
|
||||
text = "Нет связи"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("8_tidwt")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="remote_control" type="Label" parent="."]
|
||||
layout_mode = 2
|
||||
offset_left = 1244.0
|
||||
offset_right = 1401.0
|
||||
offset_left = 1242.0
|
||||
offset_right = 1402.0
|
||||
offset_bottom = 27.0
|
||||
tooltip_text = "Комплекс находится под внешним управлением"
|
||||
mouse_filter = 0
|
||||
@@ -109,7 +94,7 @@ vertical_alignment = 1
|
||||
|
||||
[node name="тренаж_режим" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1404.0
|
||||
offset_left = 1405.0
|
||||
offset_right = 1501.0
|
||||
offset_bottom = 27.0
|
||||
tooltip_text = "Задействовать режим Тренаж"
|
||||
@@ -125,5 +110,20 @@ toggle_mode = true
|
||||
text = "Тренаж"
|
||||
script = ExtResource("9_41d34")
|
||||
|
||||
[node name="lbl_ready" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1504.0
|
||||
offset_right = 1600.0
|
||||
offset_bottom = 27.0
|
||||
tooltip_text = "Готовность аппаратуры к работе"
|
||||
mouse_filter = 0
|
||||
theme_override_font_sizes/font_size = 14
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22")
|
||||
text = "Нет связи"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
script = ExtResource("8_tidwt")
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[connection signal="tab_changed" from="tab_switch" to="tab_switch" method="_on_tab_changed"]
|
||||
[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenaj_toggled"]
|
||||
[connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenazh_toggled"]
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
extends Button
|
||||
|
||||
func _ready():
|
||||
connect("toggled", Callable(self, "_on_button_toggled"))
|
||||
|
||||
|
||||
func _on_button_toggled(mode: bool):
|
||||
if mode:
|
||||
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
|
||||
else:
|
||||
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"
|
||||
extends Button
|
||||
|
||||
func _ready():
|
||||
connect("toggled", Callable(self, "_on_button_toggled"))
|
||||
|
||||
|
||||
func _on_button_toggled(mode: bool):
|
||||
if mode:
|
||||
tooltip_text = "Режим \"Тренаж\" задействован\nТекущее состояние: включено"
|
||||
else:
|
||||
tooltip_text = "Задейстовать режим \"Тренаж\"\nТекущее состояние: отключено"
|
||||
|
||||
@@ -1 +1 @@
|
||||
uid://roajn6c6wvc1
|
||||
uid://roajn6c6wvc1
|
||||
|
||||
@@ -373,7 +373,7 @@ func _process(delta) -> void:
|
||||
remove_child(req)
|
||||
req.queue_free()
|
||||
_req_count -= 1
|
||||
push_error('запрос \"%s\" не отправлен' % tile.url)
|
||||
push_error('запрос \"%s\" не отправлен' % tile.url) #TODO: For Deugs
|
||||
if _queue.is_empty():
|
||||
emit_signal('load_completed')
|
||||
|
||||
@@ -727,7 +727,7 @@ func blend_mask(val: bool) -> void:
|
||||
|
||||
|
||||
func update_coordinates_label(lon: float, lat: float) -> void:
|
||||
coordinates_label = 'Координаты: NS: %f, EW: %f' % [lat, lon]
|
||||
coordinates_label = 'Координаты: NS:%f, EW:%f' % [lat, lon]
|
||||
signaller.emit_signal('update_coordinates_map', coordinates_label)
|
||||
|
||||
|
||||
|
||||
93
scenes/контроль/control_prd.gd
Normal file
93
scenes/контроль/control_prd.gd
Normal file
@@ -0,0 +1,93 @@
|
||||
extends Button
|
||||
|
||||
var base_style: StyleBoxFlat
|
||||
var tween: Tween
|
||||
var pulsing: bool = false
|
||||
var original_text: String
|
||||
var flag_control_is_over: bool = false
|
||||
|
||||
|
||||
func _ready():
|
||||
original_text = text
|
||||
_setup_styles()
|
||||
_setup_signals()
|
||||
|
||||
|
||||
func _setup_styles() -> void:
|
||||
if get('theme_override_styles/disabled') == null:
|
||||
base_style = StyleBoxFlat.new()
|
||||
base_style.border_color = Color(1.0, 0.5, 0.0)
|
||||
base_style.border_width_top = 4
|
||||
base_style.border_width_bottom = 4
|
||||
base_style.border_width_left = 4
|
||||
base_style.border_width_right = 4
|
||||
base_style.bg_color = Color(0.2, 0.2, 0.2)
|
||||
set('theme_override_styles/disabled', base_style)
|
||||
else:
|
||||
base_style = get('theme_override_styles/disabled')
|
||||
set('theme_override_colors/font_disabled_color', Color(1.0, 1.0, 1.0))
|
||||
|
||||
|
||||
func _setup_signals() -> void:
|
||||
connect('pressed', Callable(self, '_on_pressed'))
|
||||
|
||||
if not signaller:
|
||||
return
|
||||
var signals_to_connect := ['режим_работа', 'режим_журнал', 'режим_эмс', 'режим_настройки", "режим_контроль']
|
||||
for signal_name in signals_to_connect:
|
||||
if signaller.has_signal(signal_name):
|
||||
signaller.connect(signal_name, Callable(self, '_on_status_change'))
|
||||
|
||||
|
||||
func _on_pressed():
|
||||
disabled = true
|
||||
text = 'Идет выполнение контроля'
|
||||
flag_control_is_over = false
|
||||
_start_pulse()
|
||||
|
||||
|
||||
func _start_pulse():
|
||||
if pulsing:
|
||||
return
|
||||
pulsing = true
|
||||
if not tween:
|
||||
tween = create_tween()
|
||||
tween.set_loops()
|
||||
var color1 = Color(1.0, 0.5, 0.0) # оранжевый
|
||||
var color2 = Color(0.4, 0.4, 0.4) # серый
|
||||
tween.tween_property(base_style, 'border_color', color2, 0.5).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
tween.tween_property(base_style, 'border_color', color1, 0.5).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_IN_OUT)
|
||||
|
||||
|
||||
func _stop_pulse():
|
||||
if tween:
|
||||
tween.kill()
|
||||
tween = null
|
||||
base_style.border_color = Color(1.0, 0.5, 0.0)
|
||||
pulsing = false
|
||||
disabled = false
|
||||
text = original_text
|
||||
tooltip_text = ''
|
||||
|
||||
|
||||
func _on_status_change():
|
||||
if not flag_control_is_over:
|
||||
_stop_pulse()
|
||||
|
||||
|
||||
func _on_stop_control():
|
||||
var time_dict = Time.get_datetime_dict_from_system()
|
||||
text = 'Контроль завершён %02d:%02d/%02d.%02d' % [
|
||||
time_dict.hour,
|
||||
time_dict.minute,
|
||||
time_dict.day,
|
||||
time_dict.month ]
|
||||
disabled = false
|
||||
tooltip_text = 'Нажать для запуска контроля '
|
||||
flag_control_is_over = true
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if tween:
|
||||
tween.kill()
|
||||
tween = null
|
||||
1
scenes/контроль/control_prd.gd.uid
Normal file
1
scenes/контроль/control_prd.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://xjs7owe2iexn
|
||||
@@ -35,7 +35,8 @@ signal pressed(control: PanelContainer)
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid1/level7.value = v
|
||||
$margin/vbox/grid1/level7.tint_progress = Color.RED if v > 70 else Color.WHITE
|
||||
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 50 else Color.GOLD if v >= 40 else Color.WHITE
|
||||
on_level_changed(v, $margin/vbox/grid1/level7, value1_info)
|
||||
|
||||
|
||||
@export var min_value0: float:
|
||||
@@ -150,12 +151,11 @@ func _ready():
|
||||
item.connect('value_changed', on_level_changed.bind(item, value0_info))
|
||||
on_level_changed(item.value, item, value0_info)
|
||||
var level7: = $margin/vbox/grid1/level7
|
||||
level7.connect('value_changed', on_level_changed.bind(level7, value1_info))
|
||||
on_level_changed(level7.value, level7, value1_info)
|
||||
|
||||
|
||||
func on_level_changed(_val: float, item: TextureProgressBar, info: String):
|
||||
item.tooltip_text = '%s\\nТекущее: %0.2f\\nДиапазон: %0.2f…%0.2f' % [info, item.value, item.min_value, item.max_value]
|
||||
func on_level_changed(val: float, item: TextureProgressBar, info: String):
|
||||
item.tooltip_text = '%s\\nТекущее: %0.2f\\nДиапазон: %0.2f…%0.2f' % [info, val, item.min_value, item.max_value]
|
||||
|
||||
|
||||
func set_group_param(items: Array, param: StringName, v) -> void:
|
||||
@@ -191,8 +191,8 @@ func _enter_tree_defered():
|
||||
$margin/vbox/grid0/rname.text = rname
|
||||
$margin/vbox/grid0/fname.text = fname
|
||||
$margin/vbox/grid0/state.texture = textures[state]
|
||||
else:
|
||||
push_warning('обращение к %s вне дерева' % self)
|
||||
#else:
|
||||
#push_warning('обращение к %s вне дерева' % self) TODO: пишеться только когда заходишь в проект а дальше не используется
|
||||
|
||||
|
||||
func get_level_nodes() -> Array:
|
||||
@@ -273,10 +273,9 @@ theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
|
||||
script = SubResource("GDScript_oj3k3")
|
||||
textures = [ExtResource("1_n1aqt"), ExtResource("2_rim3u"), ExtResource("3_3w8fg")]
|
||||
value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
|
||||
value1 = 56.0
|
||||
min_value1 = -50.0
|
||||
max_value0 = 100.0
|
||||
max_value1 = 120.0
|
||||
min_value1 = -40.0
|
||||
max_value0 = 1400.0
|
||||
max_value1 = 55.0
|
||||
step0 = 1.0
|
||||
step1 = 1.0
|
||||
value_name0 = "P,%"
|
||||
@@ -476,12 +475,11 @@ layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "
|
||||
Текущее: 56.00
|
||||
Диапазон: -50.00…120.00"
|
||||
Текущее: 0.00
|
||||
Диапазон: -40.00…55.00"
|
||||
mouse_filter = 0
|
||||
min_value = -50.0
|
||||
max_value = 120.0
|
||||
value = 56.0
|
||||
min_value = -40.0
|
||||
max_value = 55.0
|
||||
fill_mode = 3
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 8
|
||||
|
||||
410
scenes/контроль/блок-к.tscn
Normal file
410
scenes/контроль/блок-к.tscn
Normal file
@@ -0,0 +1,410 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://ffi1njkjceb5"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="1_uojqc"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="2_a8ar3"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="3_xwd13"]
|
||||
[ext_resource type="Texture2D" uid="uid://c4mdrmk7h638f" path="res://data/nine-patch-round.png" id="4_eobkx"]
|
||||
[ext_resource type="Texture2D" uid="uid://00871pb6moln" path="res://data/прогресс-фон-1.png" id="5_mg57e"]
|
||||
[ext_resource type="Texture2D" uid="uid://c1k856fxhrjnh" path="res://data/прогресс-заполнение-1.png" id="6_of7rd"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_oj3k3"]
|
||||
script/source = "@tool
|
||||
class_name blok_v extends PanelContainer
|
||||
|
||||
@export var textures: Array
|
||||
@export var animation_duration: float = 1.5
|
||||
signal pressed(control: PanelContainer)
|
||||
|
||||
|
||||
## Значения уровней
|
||||
@export var value0: Array:
|
||||
set(v):
|
||||
value0.assign(v)
|
||||
var items: Array = get_level_nodes()
|
||||
var count: int = min(items.size(), v.size())
|
||||
for i in count:
|
||||
set_value0_animated(items[i], v[i])
|
||||
|
||||
|
||||
## Значение уровня
|
||||
@export var value1: float:
|
||||
set(v):
|
||||
value1 = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid1/level7.value = v
|
||||
$margin/vbox/grid1/level7.tint_progress = Color.RED if v >= 50 else Color.GOLD if v >= 40 else Color.WHITE
|
||||
on_level_changed(v, $margin/vbox/grid1/level7, value1_info)
|
||||
|
||||
|
||||
@export var min_value0: float:
|
||||
set(v):
|
||||
min_value0 = v
|
||||
var items: = get_level_nodes()
|
||||
set_group_param(items, 'min_value', v)
|
||||
|
||||
|
||||
@export var min_value1: float:
|
||||
set(v):
|
||||
min_value1 = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid1/level7.min_value = v
|
||||
|
||||
|
||||
@export var max_value0: float:
|
||||
set(v):
|
||||
max_value0 = v
|
||||
var items: = get_level_nodes()
|
||||
set_group_param(items, 'max_value', v)
|
||||
|
||||
|
||||
@export var max_value1: float:
|
||||
set(v):
|
||||
max_value1 = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid1/level7.max_value = v
|
||||
|
||||
|
||||
@export var step0: float:
|
||||
set(v):
|
||||
step0 = v
|
||||
var items: = get_level_nodes()
|
||||
set_group_param(items, 'step', v)
|
||||
|
||||
|
||||
@export var step1: float:
|
||||
set(v):
|
||||
step1 = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid1/level7.step = v
|
||||
|
||||
|
||||
@export var value_name0: String:
|
||||
set(v):
|
||||
value_name0 = v
|
||||
var items: Array = get_name_nodes()
|
||||
set_group_param(items, 'text', v)
|
||||
|
||||
|
||||
@export var value_name1: String:
|
||||
set(v):
|
||||
value_name1 = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid2/lbl7.text = v
|
||||
|
||||
|
||||
@export var fname: String:
|
||||
set(v):
|
||||
fname = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid0/fname.text = v
|
||||
|
||||
|
||||
@export var rname: String:
|
||||
set(v):
|
||||
rname = v
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid0/rname.text = v
|
||||
|
||||
|
||||
@export var state: int:
|
||||
set(v):
|
||||
state = tools.clip_value(v, 0, textures.size() - 1)
|
||||
if not is_inside_tree():
|
||||
return
|
||||
$margin/vbox/grid0/state.texture = textures[state]
|
||||
|
||||
|
||||
@export var alignment: int:
|
||||
set(v):
|
||||
alignment = v
|
||||
if is_inside_tree():
|
||||
$margin/vbox.alignment = v
|
||||
|
||||
|
||||
@export var value0_info: String:
|
||||
set(v):
|
||||
value0_info = v
|
||||
|
||||
|
||||
@export var value1_info: String:
|
||||
set(v):
|
||||
value1_info = v
|
||||
|
||||
|
||||
func _on_button_pressed(): emit_signal('pressed', self)
|
||||
func set_value0(value: Array): value0.assign(value)
|
||||
func _enter_tree() -> void: call_deferred('_enter_tree_defered')
|
||||
|
||||
|
||||
func _ready():
|
||||
var items: Array = get_level_nodes()
|
||||
for item in items:
|
||||
item.connect('value_changed', on_level_changed.bind(item, value0_info))
|
||||
on_level_changed(item.value, item, value0_info)
|
||||
var level7: = $margin/vbox/grid1/level7
|
||||
on_level_changed(level7.value, level7, value1_info)
|
||||
|
||||
|
||||
func on_level_changed(val: float, item: TextureProgressBar, info: String):
|
||||
item.tooltip_text = '%s\\nТекущее: %0.2f\\nДиапазон: %0.2f…%0.2f' % [info, val, item.min_value, item.max_value]
|
||||
|
||||
|
||||
func set_group_param(items: Array, param: StringName, v) -> void:
|
||||
if not is_inside_tree():
|
||||
return
|
||||
if not get_tree():
|
||||
return
|
||||
for i in items.size():
|
||||
items[i].set(param, v)
|
||||
|
||||
|
||||
func set_value0_by_index(index: int, value: float) -> void:
|
||||
var items: Array = get_level_nodes()
|
||||
items[index].value = value
|
||||
|
||||
|
||||
func _enter_tree_defered():
|
||||
var items: Array = get_level_nodes()
|
||||
var count: int = min(items.size(), value0.size())
|
||||
for i in count:
|
||||
items[i].min_value = min_value0
|
||||
items[i].max_value = 1400 # max_value0: TODO для отладки
|
||||
items[i].step = step0
|
||||
items = get_name_nodes()
|
||||
set_group_param(items, 'text', value_name0)
|
||||
if is_inside_tree():
|
||||
$margin/vbox/grid1/level7.value = value1
|
||||
$margin/vbox/grid1/level7.min_value = min_value1
|
||||
$margin/vbox/grid1/level7.max_value = max_value1
|
||||
$margin/vbox/grid1/level7.step = step1
|
||||
$margin/vbox/grid2/lbl7.text = value_name1
|
||||
$margin/vbox.alignment = alignment
|
||||
$margin/vbox/grid0/rname.text = rname
|
||||
$margin/vbox/grid0/fname.text = fname
|
||||
$margin/vbox/grid0/state.texture = textures[state]
|
||||
|
||||
|
||||
func get_level_nodes() -> Array:
|
||||
if not is_inside_tree():
|
||||
return []
|
||||
if not get_tree():
|
||||
return []
|
||||
return [$margin/vbox/grid1/level1]
|
||||
|
||||
|
||||
func get_name_nodes() -> Array:
|
||||
if not is_inside_tree():
|
||||
return []
|
||||
if not get_tree():
|
||||
return []
|
||||
return [$margin/vbox/grid2/lbl1]
|
||||
|
||||
|
||||
func set_value0_animated(target_node, target_value: float) -> void:
|
||||
var tween: Tween = create_tween()
|
||||
tween.set_ease(Tween.EASE_OUT)
|
||||
tween.set_trans(Tween.TRANS_QUINT)
|
||||
tween.tween_property(target_node, 'value', target_value, animation_duration)
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_rceim"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_8yvwo"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6qu57"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_mlxje"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3dspb"]
|
||||
|
||||
[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
|
||||
"
|
||||
|
||||
[node name="блок-к" type="PanelContainer"]
|
||||
editor_description = "Элемент замены из ЗИП"
|
||||
offset_right = 160.0
|
||||
offset_bottom = 88.0
|
||||
theme_override_styles/panel = SubResource("StyleBoxEmpty_3nd2u")
|
||||
script = SubResource("GDScript_oj3k3")
|
||||
textures = [ExtResource("1_uojqc"), ExtResource("2_a8ar3"), ExtResource("3_xwd13")]
|
||||
value0 = [20.0, 30.0, 40.0, 50.0, 60.0, 70.0]
|
||||
value1 = -40.0
|
||||
min_value1 = -40.0
|
||||
max_value0 = 1400.0
|
||||
max_value1 = 55.0
|
||||
step0 = 1.0
|
||||
step1 = 1.0
|
||||
value_name0 = "P,%"
|
||||
value_name1 = "°C"
|
||||
fname = "Блок В"
|
||||
rname = "A1"
|
||||
|
||||
[node name="button" type="Button" parent="."]
|
||||
layout_mode = 2
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_rceim")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_8yvwo")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_6qu57")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_mlxje")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_3dspb")
|
||||
|
||||
[node name="rect" type="NinePatchRect" parent="."]
|
||||
layout_mode = 2
|
||||
texture = ExtResource("4_eobkx")
|
||||
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="grid0" type="GridContainer" parent="margin/vbox"]
|
||||
layout_mode = 2
|
||||
columns = 3
|
||||
|
||||
[node name="state" type="TextureRect" parent="margin/vbox/grid0"]
|
||||
custom_minimum_size = Vector2(24, 24)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 2
|
||||
size_flags_vertical = 6
|
||||
texture = ExtResource("1_uojqc")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="fname" type="Label" parent="margin/vbox/grid0"]
|
||||
self_modulate = Color(1, 1, 1, 0.627451)
|
||||
custom_minimum_size = Vector2(0, 20)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
theme_override_font_sizes/font_size = 17
|
||||
text = "Блок В"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="rname" type="Label" parent="margin/vbox/grid0"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 6
|
||||
theme_override_font_sizes/font_size = 18
|
||||
text = "A1"
|
||||
horizontal_alignment = 2
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="grid1" type="GridContainer" parent="margin/vbox"]
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 3
|
||||
columns = 7
|
||||
|
||||
[node name="level1" type="TextureProgressBar" parent="margin/vbox/grid1" groups=["уровни"]]
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "
|
||||
Текущее: 0.00
|
||||
Диапазон: 0.00…1400.00"
|
||||
mouse_filter = 0
|
||||
max_value = 1400.0
|
||||
fill_mode = 3
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 8
|
||||
stretch_margin_top = 8
|
||||
stretch_margin_right = 8
|
||||
stretch_margin_bottom = 8
|
||||
texture_under = ExtResource("5_mg57e")
|
||||
texture_progress = ExtResource("6_of7rd")
|
||||
tint_under = Color(1, 1, 1, 0.419608)
|
||||
tint_progress = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
|
||||
[node name="level7" type="TextureProgressBar" parent="margin/vbox/grid1"]
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
tooltip_text = "
|
||||
Текущее: -40.00
|
||||
Диапазон: -40.00…55.00"
|
||||
mouse_filter = 0
|
||||
min_value = -40.0
|
||||
max_value = 55.0
|
||||
value = -40.0
|
||||
fill_mode = 3
|
||||
nine_patch_stretch = true
|
||||
stretch_margin_left = 8
|
||||
stretch_margin_top = 8
|
||||
stretch_margin_right = 8
|
||||
stretch_margin_bottom = 8
|
||||
texture_under = ExtResource("5_mg57e")
|
||||
texture_progress = ExtResource("6_of7rd")
|
||||
tint_under = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
tint_over = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
|
||||
[node name="grid2" type="GridContainer" parent="margin/vbox"]
|
||||
clip_contents = true
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 4
|
||||
size_flags_vertical = 4
|
||||
columns = 7
|
||||
|
||||
[node name="lbl1" type="Label" parent="margin/vbox/grid2" groups=["названия"]]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "P,%"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="lbl7" type="Label" parent="margin/vbox/grid2"]
|
||||
clip_contents = true
|
||||
custom_minimum_size = Vector2(30, 0)
|
||||
layout_mode = 2
|
||||
size_flags_horizontal = 3
|
||||
theme_override_font_sizes/font_size = 8
|
||||
text = "°C"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[connection signal="pressed" from="button" to="." method="_on_button_pressed"]
|
||||
@@ -14,7 +14,7 @@ patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
script = ExtResource("2_mdnod")
|
||||
|
||||
[node name="ref_A26" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("3_4a27g")]
|
||||
[node name="ref_A26" parent="." groups=["power_supply"] instance=ExtResource("3_4a27g")]
|
||||
offset_left = 10.0
|
||||
offset_top = 30.0
|
||||
offset_right = 60.0
|
||||
@@ -23,7 +23,7 @@ fname = "ИП9-50"
|
||||
rname = "A22"
|
||||
metadata/ip = "ip9_50_3"
|
||||
|
||||
[node name="ref_A23" parent="." groups=["default_reset", "power_supply"] instance=ExtResource("3_4a27g")]
|
||||
[node name="ref_A23" parent="." groups=["power_supply"] instance=ExtResource("3_4a27g")]
|
||||
offset_left = 60.0
|
||||
offset_top = 30.0
|
||||
offset_right = 110.0
|
||||
@@ -35,9 +35,10 @@ metadata/ip = "ip12_50_2"
|
||||
[node name="lbl_fname" type="Label" parent="."]
|
||||
self_modulate = Color(1, 1, 1, 0.62)
|
||||
layout_mode = 0
|
||||
offset_left = 5.0
|
||||
offset_left = 8.0
|
||||
offset_top = 5.0
|
||||
offset_right = 105.0
|
||||
offset_right = 112.0
|
||||
offset_bottom = 30.0
|
||||
text = "Касета П-2"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
@@ -31,7 +31,7 @@ offset_top = 32.0
|
||||
offset_right = 55.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ИП5-25"
|
||||
rname = "A24"
|
||||
rname = "A31"
|
||||
metadata/ip = "ip5_25"
|
||||
|
||||
[node name="ref_A30" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
|
||||
@@ -40,7 +40,7 @@ offset_top = 32.0
|
||||
offset_right = 105.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ЯУ-07Б"
|
||||
rname = "A30"
|
||||
rname = "A37"
|
||||
metadata/y5 = "yau07"
|
||||
|
||||
[node name="ref_A26" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
|
||||
@@ -49,7 +49,7 @@ offset_top = 32.0
|
||||
offset_right = 155.0
|
||||
offset_bottom = 182.0
|
||||
fname = "ЭМС-Г"
|
||||
rname = "A26"
|
||||
rname = "A33"
|
||||
metadata/y5 = "ems"
|
||||
|
||||
[node name="ref_A27" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
|
||||
@@ -58,7 +58,7 @@ offset_top = 32.0
|
||||
offset_right = 205.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УГ"
|
||||
rname = "A27"
|
||||
rname = "A34"
|
||||
metadata/y5 = "ug"
|
||||
|
||||
[node name="ref_A28" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
|
||||
@@ -67,7 +67,7 @@ offset_top = 32.0
|
||||
offset_right = 255.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УКП"
|
||||
rname = "A28"
|
||||
rname = "A36"
|
||||
metadata/y5 = "ukp1"
|
||||
|
||||
[node name="ref_A29" parent="." groups=["y-5"] instance=ExtResource("3_picsk")]
|
||||
@@ -76,5 +76,5 @@ offset_top = 32.0
|
||||
offset_right = 304.0
|
||||
offset_bottom = 182.0
|
||||
fname = "УКП"
|
||||
rname = "A29"
|
||||
rname = "A35"
|
||||
metadata/y5 = "ukp2"
|
||||
|
||||
@@ -1,37 +1,90 @@
|
||||
@tool
|
||||
|
||||
extends TextureButton
|
||||
|
||||
@onready var tween: Tween
|
||||
@export var state_colors: Array
|
||||
|
||||
func _on_toggled(toggled_on): $frame.visible = toggled_on
|
||||
|
||||
func _ready():
|
||||
toggle_mode = true
|
||||
focus_mode = Control.FOCUS_ALL
|
||||
connect("focus_entered", _on_focus_entered)
|
||||
connect("focus_exited", _on_focus_exited)
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
$label.self_modulate = state_colors[state]
|
||||
ProjectSettings.connect('settings_changed', _on_settings_changed)
|
||||
if has_node("label"):
|
||||
$label.self_modulate = state_colors[state]
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
ProjectSettings.disconnect('settings_changed', _on_settings_changed)
|
||||
func update_progress_bar(target_value) -> void:
|
||||
if tween:
|
||||
tween.kill()
|
||||
tween = create_tween()
|
||||
tween.tween_property($control_progress, "value", target_value, 0.3)
|
||||
|
||||
|
||||
func _on_settings_changed():
|
||||
if not is_inside_tree(): return
|
||||
var white_color = ProjectSettings.get_setting('Схема прибора. Белый цвет', Color.LIGHT_GRAY)
|
||||
var black_color = ProjectSettings.get_setting('Схема прибора. Чёрный цвет', Color.BLACK)
|
||||
$pic_functional.material.set('shader_parameter/white', white_color)
|
||||
$pic_functional.material.set('shader_parameter/black', black_color)
|
||||
func _on_toggled(toggled_on):
|
||||
if has_node("frame"):
|
||||
$frame.visible = toggled_on
|
||||
|
||||
|
||||
func _on_focus_entered():
|
||||
button_pressed = true
|
||||
#enter_press() TODO: Пока что без выбора прибора
|
||||
|
||||
|
||||
func _on_focus_exited():
|
||||
pass
|
||||
|
||||
|
||||
func enter_press():
|
||||
var enter_event = InputEventAction.new()
|
||||
enter_event.action = "ui_accept"
|
||||
enter_event.pressed = true
|
||||
Input.parse_input_event(enter_event)
|
||||
|
||||
|
||||
@export var state: int:
|
||||
set(v):
|
||||
v = 0 if v < 0 else v % state_colors.size()
|
||||
state = v
|
||||
if is_inside_tree():
|
||||
if is_inside_tree() and has_node("label"):
|
||||
$label.self_modulate = state_colors[v]
|
||||
|
||||
|
||||
@export var progress_value: float = 0.0:
|
||||
set(v):
|
||||
progress_value = v
|
||||
|
||||
if is_inside_tree():
|
||||
update_progress_bar(v)
|
||||
var max_val = $control_progress.get('max_value')
|
||||
var percentage = (v / max_val) * 100.0
|
||||
$control_progress.tooltip_text = 'Процесс контроля %01d%%' % percentage
|
||||
|
||||
|
||||
@export var progress_visible: bool:
|
||||
set(v):
|
||||
progress_visible = v
|
||||
if is_inside_tree():
|
||||
$control_progress.visible = v
|
||||
|
||||
|
||||
@export var progress_max_value: int:
|
||||
set(v):
|
||||
progress_max_value = v
|
||||
if is_inside_tree():
|
||||
$control_progress.max_value = v
|
||||
|
||||
|
||||
@export var progress_min_value: int:
|
||||
set(v):
|
||||
progress_min_value = v
|
||||
if is_inside_tree():
|
||||
$control_progress.min_value = v
|
||||
|
||||
|
||||
@export var show_functional: bool:
|
||||
set(v):
|
||||
show_functional = v
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,102 +0,0 @@
|
||||
[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"]
|
||||
298
scenes/настройки/настройки.gd
Normal file
298
scenes/настройки/настройки.gd
Normal file
@@ -0,0 +1,298 @@
|
||||
class_name configure extends Panel
|
||||
|
||||
const TableHeader = preload('res://table/header.tscn')
|
||||
const TableToggle = preload('res://table/settings-toggle.tscn')
|
||||
const TableEdit = preload('res://table/ячейка-2.tscn')
|
||||
const TableColorPick = preload('res://table/ячейка-цвет.tscn')
|
||||
|
||||
const ALIGNMENT = [HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
|
||||
const HEADER_ROW = [TableHeader, TableHeader]
|
||||
const HEADER_ROW_TEXT = ['Параметр', 'Значение']
|
||||
const SETTING_TABLE = [
|
||||
['Ограниченный режим', TableEdit, TableToggle, 'Ограничть возможности по постановке помех'],
|
||||
['Кнопка «ПД-М4»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ПД-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОЗП-1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «МЧМ-1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОРН-И1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОРН-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ЛЧМ-1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ПД-М4С»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ПД-ЧМ»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «СВ-И1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «К1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «СВ-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОРН»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «JTIDS»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «КУПД»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Внешнее управление', TableEdit, TableToggle, 'Передать управление в 5П28'],
|
||||
['Внешнее указание Трасса', TableEdit, TableToggle, 'Разрешить постановку помех от Трасса'],
|
||||
['Кнопка «Подавление»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Виртуальная клавиатура', TableEdit, TableToggle, 'Включить отображение экранной клавиатуры'],
|
||||
['Скрыть вкладку ЭМС 2', TableEdit, TableToggle, 'Отображать вкладку \"ЭМС-2\"'],
|
||||
['Отладка контроля', TableEdit, TableToggle, 'Отображать отладку контроля'],
|
||||
['Текущая версия ПО УАРЭП', TableEdit, TableEdit, 'Время сборки, версия и номер фиксации'],
|
||||
['уарэп-яу07-частный', TableEdit, TableEdit, 'IP-адрес для получения частных сообщений от ЯУ-07'],
|
||||
['уарэп-яу07-общий', TableEdit, TableEdit, 'IP-адрес для получения широковещательных сообщений от ЯУ-07'],
|
||||
['уарэп-капсрпб', TableEdit, TableEdit, 'IP-адрес для связи с КАПС-РПБ [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'],
|
||||
['уарэп-эмс', TableEdit, TableEdit, 'IP-адрес для связи с ЭМС'],
|
||||
['уарэп-яу07-2в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 2'],
|
||||
['уарэп-яу07-2н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 2'],
|
||||
['уарэп-яу07-2к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 2'],
|
||||
['уарэп-яу07-4в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 4'],
|
||||
['уарэп-яу07-4н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 4'],
|
||||
['уарэп-яу07-4к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 4'],
|
||||
['уарэп-яу07-1в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 1'],
|
||||
['уарэп-яу07-1н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 1'],
|
||||
['уарэп-яу07-1к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 1'],
|
||||
['уарэп-яу07-3в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 3'],
|
||||
['уарэп-яу07-3н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 3'],
|
||||
['уарэп-яу07-3к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 3'],
|
||||
['уарэп-5п28', TableEdit, TableEdit, 'IP-адрес для связи с 5П28'],
|
||||
['навигация', TableEdit, TableEdit, 'Порт назначения для получения данных от АКНГ'],
|
||||
['уарэп-щ3', TableEdit, TableEdit, 'Путь к UART-устройству для связи с прибором Щ3'],
|
||||
['уарэп-спт25-1', TableEdit, TableEdit, 'Путь к UART-устройству для связи с прибором СПТ-25 1'],
|
||||
['уарэп-спт25-2', TableEdit, TableEdit, 'Путь к UART-устройству для связи с прибором СПТ-25 2'],
|
||||
['Шаблон адреса сервера карт', TableEdit, TableEdit, 'Шаблон URL-адреса сервера карт, должен содержать поля \"{x}\", \"{y}\", \"{z}\" для подстановки индекса плитки'],
|
||||
['Адрес АФСП левого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора АФСП'],
|
||||
['Адрес АФСП правого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора АФСП'],
|
||||
['Адрес БПО левого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора БПО'],
|
||||
['Адрес БПО правого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора БПО'],
|
||||
['Период опроса состояния БПО, секунды', TableEdit, TableEdit, 'Время в секундах' ],
|
||||
['Период опроса состояния АФСП, секунды', TableEdit, TableEdit, 'Время в секундах' ],
|
||||
['уарэп-трасса', TableEdit, TableEdit, 'IP-адрес для связи с Трассой [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'],
|
||||
['Включить работу по своим целям', TableEdit, TableToggle, 'Разрешает работу в секторе со своей целью'],
|
||||
['Список своих протоколов', TableEdit, TableEdit, 'Список протоколов целей, по которым запрещено работать' ],
|
||||
['Цвет кнопки \"Подавление\"', TableEdit, TableColorPick, 'Цвет кнопки. Введено по требованию ПЗ' ] ]
|
||||
|
||||
## TODO: Придумать как избавиться от индексов
|
||||
## Индексы строк таблицы.
|
||||
const EXTERNAL_CU = 16 ## Внешнее целеуказание
|
||||
const TRASSA = 17 ## Строка - Трасса
|
||||
const SUPPRESS = 18 ## Строка - Подавление
|
||||
const KEYBOARD = 19 ## Строка - Виртуальная клавиатура
|
||||
const HIDE_EMS2 = 20 ## Строка - Скрыть вкладку ЭМС 2
|
||||
const DEBAG_CONTROL = 21 ## Строка - Отладка контроля
|
||||
const COMMIT = 22 ## Строка - Версия УАРЭП
|
||||
const GOS_BTN = 52 ## Разрешить работу по своим целям
|
||||
const COLOR_BTN_ACT = 54 ## Цвет кнопки "Подавление"
|
||||
|
||||
|
||||
var name_to_line_index: = {} ## Для преобразования названия параметра в номер строки
|
||||
|
||||
func on_checkbutton_pressed(i_row: int): on_row_pressed(i_row)
|
||||
|
||||
|
||||
## Вызывается, когда узел впервые попадает в дерево сцены.
|
||||
func _ready() -> void:
|
||||
setting_tab()
|
||||
if not OS.get_cmdline_args().has('++ограниченный'):
|
||||
return
|
||||
$Label2.text = 'Текущий режим доступа: ограниченный'
|
||||
for node in $GridContainer.get_children().filter(func(b): return b is Button):
|
||||
node.disabled = true
|
||||
|
||||
|
||||
func on_external_cu_btn_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Внешнее управление', btn.button_pressed)
|
||||
if btn.button_pressed:
|
||||
signaller.emit_signal('interfer_off_all')
|
||||
|
||||
|
||||
func on_trassa_btn_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Внешнее указание Трасса', btn.button_pressed)
|
||||
|
||||
|
||||
func on_vk_pressed(btn) -> void:
|
||||
signaller.emit_signal('kb_pressed', btn.button_pressed)
|
||||
|
||||
|
||||
func on_gos_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Включить работу по своим целям', btn.button_pressed)
|
||||
|
||||
|
||||
func on_ems2_pressed(btn) -> void:
|
||||
var state = btn.button_pressed
|
||||
signaller.emit_signal('ems2_hide_pressed', state)
|
||||
|
||||
|
||||
func on_debag_control_pressed(btn) -> void:
|
||||
var state = btn.button_pressed
|
||||
signaller.emit_signal("debag_control_pressed", state)
|
||||
|
||||
|
||||
func on_row_pressed(i_row: int):
|
||||
$scroll_set/table.clear_rows_selected()
|
||||
$scroll_set/table.set_row_selected(i_row, true)
|
||||
|
||||
|
||||
func parse_cmd_line_args(settings_data: Dictionary):
|
||||
var args = OS.get_cmdline_args()
|
||||
for i in range(0, args.size(), 2):
|
||||
var key: String = args[i]
|
||||
key = key.lstrip('\'\" ').rstrip('\'\" ').strip_edges().strip_escapes()
|
||||
if not settings_data.has(key):
|
||||
continue
|
||||
if not ((i + 1) < args.size()):
|
||||
push_error('для аргумента \"%s\" не указано значение.' % key)
|
||||
break
|
||||
var val0 = args[i + 1]
|
||||
var val1 = settings_data[key]
|
||||
val0 = val0.lstrip('\'\" ').rstrip('\'\" ').strip_edges().strip_escapes()
|
||||
if typeof(val1) == TYPE_BOOL:
|
||||
if val0 not in ['yes', 'true', 'да', 'no', 'false', 'нет']:
|
||||
push_error('для аргумента \"%s\" указано неверное значение \"%s\".' % [key, val0])
|
||||
break
|
||||
settings_data[key] = true if val0 in ['yes', 'true', 'да'] else false
|
||||
elif typeof(val1) == TYPE_ARRAY:
|
||||
var val0s = val0.split(',')
|
||||
if val0s.size() != val1.size():
|
||||
push_error('для аргумента \"%s\" указано неверное значение \"%s\" (исходное: \"%s\").' % [key, val0, val1])
|
||||
break
|
||||
for j in val0s.size():
|
||||
var val: String = val0s[j]
|
||||
val = val.lstrip('\'\" ').rstrip('\'\" ').strip_edges().strip_escapes()
|
||||
if tools.type_is_num(val):
|
||||
val0s[j] = int(val)
|
||||
elif val in ['true', 'false']:
|
||||
val0s[j] = true if val == 'true' else false
|
||||
else:
|
||||
val0s[j] = val
|
||||
elif typeof(val1) == TYPE_STRING:
|
||||
settings_data[key] = val0
|
||||
|
||||
|
||||
func setting_tab():
|
||||
$heard_table.set_header(HEADER_ROW)
|
||||
$heard_table.set_header_text(HEADER_ROW_TEXT)
|
||||
$heard_table.set_columns_min_size([600, 950])
|
||||
$heard_table.set_columns_alignments(ALIGNMENT)
|
||||
var settings_data = {}
|
||||
parse_cmd_line_args(settings_data)
|
||||
for key in settings_data:
|
||||
ProjectSettings.set_setting('application/config/%s' % key, settings_data[key])
|
||||
for i in SETTING_TABLE.size():
|
||||
var tbl_row = SETTING_TABLE[i]
|
||||
var param_name = tbl_row[0]
|
||||
var node_label = tbl_row[1]
|
||||
var node_value = tbl_row[2]
|
||||
var tootip_text = tbl_row[3]
|
||||
name_to_line_index[param_name] = i
|
||||
$scroll_set/table.add_row([node_label, node_value])
|
||||
var label_instance = $scroll_set/table.get_node2(0, i)
|
||||
label_instance.text = param_name
|
||||
label_instance.tooltip_text = tootip_text
|
||||
$scroll_set/table.set_node_editable(0, i, false)
|
||||
var node_values = $scroll_set/table.get_node2(1, i).get_children()
|
||||
var edit_node = $scroll_set/table.get_node2(1, i)
|
||||
if node_values.size():
|
||||
var child = node_values[0]
|
||||
if child is CheckButton:
|
||||
child.connect('pressed', Callable(self, 'on_checkbutton_pressed').bind(i))
|
||||
var val = ProjectSettings.get_setting('application/config/%s' % param_name, true)
|
||||
child.set_pressed(val)
|
||||
else:
|
||||
if settings_data.has(param_name):
|
||||
var val = settings_data[param_name]
|
||||
if typeof(val) == TYPE_STRING:
|
||||
$scroll_set/table.get_node2(1, i).text = settings_data[param_name]
|
||||
if edit_node:
|
||||
if edit_node is LineEdit:
|
||||
$scroll_set/table.set_node_control(1, i, true)
|
||||
$scroll_set/table.set_node_editable(1, COMMIT, false)
|
||||
$scroll_set/table.set_columns_min_size([600, 950])
|
||||
$scroll_set/table.set_columns_alignments(ALIGNMENT)
|
||||
$scroll_set/table.connect('row_pressed', Callable(self, 'on_row_pressed'))
|
||||
var commit_instance = $scroll_set/table.get_node2(1, COMMIT)
|
||||
commit_instance.text = '%s' % commit.VCS_HEAD
|
||||
for i in SETTING_TABLE.size():
|
||||
var param_name = SETTING_TABLE[i][0]
|
||||
var profile = $scroll_set/table.get_node2(1, i)
|
||||
if settings.UnitProfiles.has(param_name):
|
||||
var unit_data = settings.UnitProfiles[param_name][1]
|
||||
profile.text = ''
|
||||
for val in unit_data:
|
||||
profile.text += str(val) + ','
|
||||
profile.text = profile.text.trim_suffix(',')
|
||||
continue
|
||||
var psk = 'application/config/%s' % param_name
|
||||
if ProjectSettings.has_setting(psk):
|
||||
var unit_data = ProjectSettings.get_setting(psk)
|
||||
if is_instance_of(unit_data, TYPE_STRING):
|
||||
profile.text = unit_data
|
||||
button_settings()
|
||||
|
||||
|
||||
func button_settings():
|
||||
var extern_cu_node = $scroll_set/table.get_node2(1, EXTERNAL_CU).get_children()[0]
|
||||
extern_cu_node.connect('pressed', on_external_cu_btn_pressed.bind(extern_cu_node))
|
||||
on_external_cu_btn_pressed(extern_cu_node)
|
||||
var trassa_node = $scroll_set/table.get_node2(1, TRASSA).get_children()
|
||||
trassa_node = trassa_node[0]
|
||||
trassa_node.connect('pressed', on_trassa_btn_pressed.bind(trassa_node))
|
||||
var vk_node = $scroll_set/table.get_node2(1, KEYBOARD).get_children()[0]
|
||||
vk_node.connect('pressed', on_vk_pressed.bind(vk_node))
|
||||
var ems2_hide_node = $scroll_set/table.get_node2(1, HIDE_EMS2).get_children()[0]
|
||||
ems2_hide_node.connect('pressed', on_ems2_pressed.bind(ems2_hide_node))
|
||||
ems2_hide_node.set_pressed(true)
|
||||
on_ems2_pressed(ems2_hide_node)
|
||||
var gos_node = $scroll_set/table.get_node2(1, GOS_BTN).get_children()[0]
|
||||
gos_node.connect('pressed', on_gos_pressed.bind(gos_node))
|
||||
var debag_control = $scroll_set/table.get_node2(1, DEBAG_CONTROL).get_children()[0]
|
||||
debag_control.connect('pressed', on_debag_control_pressed.bind(debag_control))
|
||||
debag_control.set_pressed(false)
|
||||
on_debag_control_pressed(debag_control)
|
||||
var color_btn_act = $scroll_set/table.get_node2(1, COLOR_BTN_ACT)
|
||||
color_btn_act.connect('popup_closed', on_color_closed.bind(color_btn_act))
|
||||
|
||||
|
||||
func on_color_closed(color_btn_act: ColorPickerButton):
|
||||
var col = [color_btn_act.color.r, color_btn_act.color.g, color_btn_act.color.b, 1.0]
|
||||
ProjectSettings.set_setting('application/config/%s' % 'Цвет кнопки \"Подавление\"', col)
|
||||
|
||||
|
||||
func _on_btn_save_settings_pressed():
|
||||
var json_data = {}
|
||||
for i in SETTING_TABLE.size():
|
||||
var parameter = SETTING_TABLE[i][0]
|
||||
if parameter in settings.UnitProfiles:
|
||||
var ref_profile = settings.UnitProfiles[parameter][1]
|
||||
var profiles = $scroll_set/table.get_node2(1, i)
|
||||
var value = profiles.get_text()
|
||||
if parameter not in json_data:
|
||||
var row: = []
|
||||
for token in value.split(','):
|
||||
var j: = row.size()
|
||||
if token.is_valid_int():
|
||||
token = int(token)
|
||||
elif token == 'false':
|
||||
token = false
|
||||
elif token == 'true':
|
||||
token = true
|
||||
if typeof(ref_profile[j]) == typeof(token):
|
||||
row.append(token)
|
||||
else:
|
||||
# TODO: Это надо вывести на экран пользователю
|
||||
push_error([parameter, j, type_string(typeof(ref_profile[j])), type_string(typeof(token))])
|
||||
row.append(ref_profile[j])
|
||||
json_data[parameter] = row
|
||||
else:
|
||||
var children = $scroll_set/table.get_node2(1, i).get_children()
|
||||
if len(children):
|
||||
var child = children[0]
|
||||
json_data[parameter] = child.is_pressed()
|
||||
else:
|
||||
var row = $scroll_set/table.get_row(i)
|
||||
json_data[parameter] = row[1].text
|
||||
for key in json_data:
|
||||
ProjectSettings.set_setting('application/config/%s' % key, json_data[key])
|
||||
var settings_file: = settings.get_settings_file_path()
|
||||
var file: = FileAccess.open(settings_file, FileAccess.WRITE)
|
||||
var abs_path: = ProjectSettings.globalize_path(settings_file)
|
||||
if not file:
|
||||
log.error('Не удалось открыть файл для записи \"%s\"' % abs_path)
|
||||
return
|
||||
var json_string: = JSON.stringify(json_data, ' ', true)
|
||||
if file.store_string(json_string):
|
||||
log.info('Настройки сохранены в файл \"%s\"' % abs_path)
|
||||
file.close()
|
||||
1
scenes/настройки/настройки.gd.uid
Normal file
1
scenes/настройки/настройки.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dabpum5iqxc7y
|
||||
@@ -1,285 +1,9 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://bnptm4rlp60dq"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://dabpum5iqxc7y" path="res://scenes/настройки/настройки.gd" id="1_60bya"]
|
||||
[ext_resource type="Script" uid="uid://c5pq0hbrij34d" path="res://table/table.gd" id="2_6sx73"]
|
||||
[ext_resource type="Texture2D" uid="uid://csnts8f155sf7" path="res://data/save1.png" id="3_dbpks"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_fc87o"]
|
||||
script/source = "class_name configure extends Panel
|
||||
|
||||
const TableHeader = preload('res://table/header.tscn')
|
||||
const TableToggle = preload('res://table/settings-toggle.tscn')
|
||||
const TableEdit = preload('res://table/ячейка-2.tscn')
|
||||
|
||||
const ALIGNMENT = [HORIZONTAL_ALIGNMENT_CENTER, HORIZONTAL_ALIGNMENT_CENTER]
|
||||
const HEADER_ROW = [TableHeader, TableHeader]
|
||||
const HEADER_ROW_TEXT = ['Параметр', 'Значение']
|
||||
const SETTING_TABLE = [
|
||||
['Ограниченный режим', TableEdit, TableToggle, 'Ограничть возможности по постановке помех'],
|
||||
['Кнопка «ПД-М4»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ПД-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОЗП-1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «МЧМ-1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОРН-И1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОРН-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ЛЧМ-1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ПД-М4С»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ПД-ЧМ»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «СВ-И1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «К1»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «СВ-М2»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «ОРН»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «JTIDS»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Кнопка «КУПД»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Внешнее управление', TableEdit, TableToggle, 'Передать управление в 5П28'],
|
||||
['Внешнее указание Трасса', TableEdit, TableToggle, 'Разрешить постановку помех от Трасса'],
|
||||
['Кнопка «Подавление»', TableEdit, TableToggle, 'Разрешить отображение кнопки'],
|
||||
['Виртуальная клавиатура', TableEdit, TableToggle, 'Включить отображение экранной клавиатуры'],
|
||||
['Скрыть вкладку ЭМС 2', TableEdit, TableToggle, 'Отображать вкладку \\\"ЭМС-2\\\"'],
|
||||
['Текущая версия ПО УАРЭП', TableEdit, TableEdit, 'Время сборки, версия и номер фиксации'],
|
||||
['уарэп-яу07-частный', TableEdit, TableEdit, 'IP-адрес для получения частных сообщений от ЯУ-07'],
|
||||
['уарэп-яу07-общий', TableEdit, TableEdit, 'IP-адрес для получения широковещательных сообщений от ЯУ-07'],
|
||||
['уарэп-капсрпб', TableEdit, TableEdit, 'IP-адрес для связи с КАПС-РПБ [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'],
|
||||
['уарэп-эмс', TableEdit, TableEdit, 'IP-адрес для связи с ЭМС'],
|
||||
['уарэп-яу07-2в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 2'],
|
||||
['уарэп-яу07-2н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 2'],
|
||||
['уарэп-яу07-2к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 2'],
|
||||
['уарэп-яу07-4в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 4'],
|
||||
['уарэп-яу07-4н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 4'],
|
||||
['уарэп-яу07-4к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 4'],
|
||||
['уарэп-яу07-1в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 1'],
|
||||
['уарэп-яу07-1н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 1'],
|
||||
['уарэп-яу07-1к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 1'],
|
||||
['уарэп-яу07-3в', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-В 3'],
|
||||
['уарэп-яу07-3н', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-Н 3'],
|
||||
['уарэп-яу07-3к', TableEdit, TableEdit, 'IP-адрес для связи с прибором ПРД-К 3'],
|
||||
['уарэп-5п28', TableEdit, TableEdit, 'IP-адрес для связи с 5П28'],
|
||||
['навигация', TableEdit, TableEdit, 'Порт назначения для получения данных от АКНГ'],
|
||||
['уарэп-щ3', TableEdit, TableEdit, 'Путь к UART-устройству для связи с прибором Щ3'],
|
||||
['уарэп-спт25-1', TableEdit, TableEdit, 'Путь к UART-устройству для связи с прибором СПТ-25 1'],
|
||||
['уарэп-спт25-2', TableEdit, TableEdit, 'Путь к UART-устройству для связи с прибором СПТ-25 2'],
|
||||
['Шаблон адреса сервера карт', TableEdit, TableEdit, 'Шаблон URL-адреса сервера карт, должен содержать поля \\\"{x}\\\", \\\"{y}\\\", \\\"{z}\\\" для подстановки индекса плитки'],
|
||||
['Адрес АФСП левого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора АФСП'],
|
||||
['Адрес АФСП правого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора АФСП'],
|
||||
['Адрес БПО левого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора БПО'],
|
||||
['Адрес БПО правого борта', TableEdit, TableEdit, 'http-адрес для запроса состояния прибора БПО'],
|
||||
['Период опроса состояния БПО, секунды', TableEdit, TableEdit, 'Время в секундах' ],
|
||||
['Период опроса состояния АФСП, секунды', TableEdit, TableEdit, 'Время в секундах' ],
|
||||
['уарэп-трасса', TableEdit, TableEdit, 'IP-адрес для связи с Трассой [<адрес этого узла>, <адрес удалённого узла>, <порт этого узла>, <порт удалённого узла>]'],
|
||||
['Включить работу по своим целям', TableEdit, TableToggle, 'Разрешает работу в секторе со своей целью'],
|
||||
['Список своих протоколов', TableEdit, TableEdit, 'Список протоколов целей, по которым запрещено работать' ], ]
|
||||
|
||||
const EXTERNAL_CU = 16 ## Внешнее целеуказание
|
||||
const TRASSA = 17
|
||||
const SUPPRESS = 18 ## Строка - Подавление
|
||||
const KEYBOARD = 19 ## Строка - Виртуальная клавиатура
|
||||
const HIDE_EMS2 = 20 ## Строка - Скрыть вкладку ЭМС 2
|
||||
const COMMIT = 21 ## Строка - Версия УАРЭП
|
||||
const GOS_BTN = 51 ## Разрешить работу по своим целям
|
||||
|
||||
var name_to_line_index: = {} ## Для преобразования названия параметра в номер строки
|
||||
|
||||
func on_checkbutton_pressed(i_row: int): on_row_pressed(i_row)
|
||||
|
||||
|
||||
## Вызывается, когда узел впервые попадает в дерево сцены.
|
||||
func _ready() -> void:
|
||||
setting_tab()
|
||||
if not OS.get_cmdline_args().has('++ограниченный'):
|
||||
return
|
||||
$Label2.text = 'Текущий режим доступа: ограниченный'
|
||||
for node in $GridContainer.get_children().filter(func(b): return b is Button):
|
||||
node.disabled = true
|
||||
|
||||
|
||||
func on_external_cu_btn_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Внешнее управление', btn.button_pressed)
|
||||
if btn.button_pressed:
|
||||
signaller.emit_signal('interfer_off_all')
|
||||
|
||||
|
||||
func on_trassa_btn_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Внешнее указание Трасса', btn.button_pressed)
|
||||
|
||||
|
||||
func on_vk_pressed(btn) -> void:
|
||||
signaller.emit_signal('kb_pressed', btn.button_pressed)
|
||||
|
||||
|
||||
func on_gos_pressed(btn) -> void:
|
||||
ProjectSettings.set_setting('application/config/Включить работу по своим целям', btn.button_pressed)
|
||||
|
||||
|
||||
func on_ems2_pressed(btn) -> void:
|
||||
var state = btn.button_pressed
|
||||
signaller.emit_signal('ems2_hide_pressed', state)
|
||||
|
||||
|
||||
func on_row_pressed(i_row: int):
|
||||
$scroll_set/table.clear_rows_selected()
|
||||
$scroll_set/table.set_row_selected(i_row, true)
|
||||
|
||||
|
||||
func parse_cmd_line_args(settings_data: Dictionary):
|
||||
var args = OS.get_cmdline_args()
|
||||
for i in range(0, args.size(), 2):
|
||||
var key: String = args[i]
|
||||
key = key.lstrip('\\'\\\" ').rstrip('\\'\\\" ').strip_edges().strip_escapes()
|
||||
if not settings_data.has(key):
|
||||
continue
|
||||
if not ((i + 1) < args.size()):
|
||||
push_error('для аргумента \\\"%s\\\" не указано значение.' % key)
|
||||
break
|
||||
var val0 = args[i + 1]
|
||||
var val1 = settings_data[key]
|
||||
val0 = val0.lstrip('\\'\\\" ').rstrip('\\'\\\" ').strip_edges().strip_escapes()
|
||||
if typeof(val1) == TYPE_BOOL:
|
||||
if val0 not in ['yes', 'true', 'да', 'no', 'false', 'нет']:
|
||||
push_error('для аргумента \\\"%s\\\" указано неверное значение \\\"%s\\\".' % [key, val0])
|
||||
break
|
||||
settings_data[key] = true if val0 in ['yes', 'true', 'да'] else false
|
||||
elif typeof(val1) == TYPE_ARRAY:
|
||||
var val0s = val0.split(',')
|
||||
if val0s.size() != val1.size():
|
||||
push_error('для аргумента \\\"%s\\\" указано неверное значение \\\"%s\\\" (исходное: \\\"%s\\\").' % [key, val0, val1])
|
||||
break
|
||||
for j in val0s.size():
|
||||
var val: String = val0s[j]
|
||||
val = val.lstrip('\\'\\\" ').rstrip('\\'\\\" ').strip_edges().strip_escapes()
|
||||
if tools.type_is_num(val):
|
||||
val0s[j] = int(val)
|
||||
elif val in ['true', 'false']:
|
||||
val0s[j] = true if val == 'true' else false
|
||||
else:
|
||||
val0s[j] = val
|
||||
elif typeof(val1) == TYPE_STRING:
|
||||
settings_data[key] = val0
|
||||
|
||||
|
||||
func setting_tab():
|
||||
$heard_table.set_header(HEADER_ROW)
|
||||
$heard_table.set_header_text(HEADER_ROW_TEXT)
|
||||
$heard_table.set_columns_min_size([600, 950])
|
||||
$heard_table.set_columns_alignments(ALIGNMENT)
|
||||
var settings_data = {}
|
||||
parse_cmd_line_args(settings_data)
|
||||
for key in settings_data:
|
||||
ProjectSettings.set_setting('application/config/%s' % key, settings_data[key])
|
||||
for i in SETTING_TABLE.size():
|
||||
var tbl_row = SETTING_TABLE[i]
|
||||
var param_name = tbl_row[0]
|
||||
var node_label = tbl_row[1]
|
||||
var node_value = tbl_row[2]
|
||||
var tootip_text = tbl_row[3]
|
||||
name_to_line_index[param_name] = i
|
||||
$scroll_set/table.add_row([node_label, node_value])
|
||||
var label_instance = $scroll_set/table.get_node2(0, i)
|
||||
label_instance.text = param_name
|
||||
label_instance.tooltip_text = tootip_text
|
||||
$scroll_set/table.set_node_editable(0, i, false)
|
||||
var node_values = $scroll_set/table.get_node2(1, i).get_children()
|
||||
var edit_node = $scroll_set/table.get_node2(1, i)
|
||||
if node_values.size():
|
||||
var child = node_values[0]
|
||||
if child is CheckButton:
|
||||
child.connect('pressed', Callable(self, 'on_checkbutton_pressed').bind(i))
|
||||
var val = ProjectSettings.get_setting('application/config/%s' % param_name, true)
|
||||
child.set_pressed(val)
|
||||
else:
|
||||
if settings_data.has(param_name):
|
||||
var val = settings_data[param_name]
|
||||
if typeof(val) == TYPE_STRING:
|
||||
$scroll_set/table.get_node2(1, i).text = settings_data[param_name]
|
||||
if edit_node:
|
||||
if edit_node is LineEdit:
|
||||
$scroll_set/table.set_node_control(1, i, true)
|
||||
$scroll_set/table.set_node_editable(1, COMMIT, false)
|
||||
$scroll_set/table.set_columns_min_size([600, 950])
|
||||
$scroll_set/table.set_columns_alignments(ALIGNMENT)
|
||||
$scroll_set/table.connect('row_pressed', Callable(self, 'on_row_pressed'))
|
||||
var commit_instance = $scroll_set/table.get_node2(1, COMMIT)
|
||||
commit_instance.text = '%s' % commit.VCS_HEAD
|
||||
for i in SETTING_TABLE.size():
|
||||
var param_name = SETTING_TABLE[i][0]
|
||||
var profile = $scroll_set/table.get_node2(1, i)
|
||||
if settings.UnitProfiles.has(param_name):
|
||||
var unit_data = settings.UnitProfiles[param_name][1]
|
||||
profile.text = ''
|
||||
for val in unit_data:
|
||||
profile.text += str(val) + ','
|
||||
profile.text = profile.text.trim_suffix(',')
|
||||
continue
|
||||
var psk = 'application/config/%s' % param_name
|
||||
if ProjectSettings.has_setting(psk):
|
||||
var unit_data = ProjectSettings.get_setting(psk)
|
||||
if is_instance_of(unit_data, TYPE_STRING):
|
||||
profile.text = unit_data
|
||||
button_settings()
|
||||
|
||||
|
||||
func button_settings():
|
||||
var extern_cu_node = $scroll_set/table.get_node2(1, EXTERNAL_CU).get_children()[0]
|
||||
extern_cu_node.connect('pressed', on_external_cu_btn_pressed.bind(extern_cu_node))
|
||||
on_external_cu_btn_pressed(extern_cu_node)
|
||||
var trassa_node = $scroll_set/table.get_node2(1, TRASSA).get_children()
|
||||
trassa_node = trassa_node[0]
|
||||
trassa_node.connect('pressed', on_trassa_btn_pressed.bind(trassa_node))
|
||||
var vk_node = $scroll_set/table.get_node2(1, KEYBOARD).get_children()[0]
|
||||
vk_node.connect('pressed', on_vk_pressed.bind(vk_node))
|
||||
var ems2_hide_node = $scroll_set/table.get_node2(1, HIDE_EMS2).get_children()[0]
|
||||
ems2_hide_node.connect('pressed', on_ems2_pressed.bind(ems2_hide_node))
|
||||
ems2_hide_node.set_pressed(true)
|
||||
on_ems2_pressed(ems2_hide_node)
|
||||
var gos_node = $scroll_set/table.get_node2(1, GOS_BTN).get_children()[0]
|
||||
gos_node.connect('pressed', on_gos_pressed.bind(gos_node))
|
||||
|
||||
|
||||
func _on_btn_save_settings_pressed():
|
||||
var json_data = {}
|
||||
for i in SETTING_TABLE.size():
|
||||
var parameter = SETTING_TABLE[i][0]
|
||||
if parameter in settings.UnitProfiles:
|
||||
var ref_profile = settings.UnitProfiles[parameter][1]
|
||||
var profiles = $scroll_set/table.get_node2(1, i)
|
||||
var value = profiles.get_text()
|
||||
if parameter not in json_data:
|
||||
var row: = []
|
||||
for token in value.split(','):
|
||||
var j: = row.size()
|
||||
if token.is_valid_int():
|
||||
token = int(token)
|
||||
elif token == 'false':
|
||||
token = false
|
||||
elif token == 'true':
|
||||
token = true
|
||||
if typeof(ref_profile[j]) == typeof(token):
|
||||
row.append(token)
|
||||
else:
|
||||
# TODO: Это надо вывести на экран пользователю
|
||||
push_error([parameter, j, type_string(typeof(ref_profile[j])), type_string(typeof(token))])
|
||||
row.append(ref_profile[j])
|
||||
json_data[parameter] = row
|
||||
else:
|
||||
var children = $scroll_set/table.get_node2(1, i).get_children()
|
||||
if len(children):
|
||||
var child = children[0]
|
||||
json_data[parameter] = child.is_pressed()
|
||||
else:
|
||||
var row = $scroll_set/table.get_row(i)
|
||||
json_data[parameter] = row[1].text
|
||||
for key in json_data:
|
||||
ProjectSettings.set_setting('application/config/%s' % key, json_data[key])
|
||||
var settings_file: = settings.get_settings_file_path()
|
||||
var file: = FileAccess.open(settings_file, FileAccess.WRITE)
|
||||
var abs_path: = ProjectSettings.globalize_path(settings_file)
|
||||
if not file:
|
||||
log.error('Не удалось открыть файл для записи \\\"%s\\\"' % abs_path)
|
||||
return
|
||||
var json_string: = JSON.stringify(json_data, ' ', true)
|
||||
if file.store_string(json_string):
|
||||
log.info('Настройки сохранены в файл \\\"%s\\\"' % abs_path)
|
||||
file.close()
|
||||
"
|
||||
|
||||
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_pyq6h"]
|
||||
texture = ExtResource("3_dbpks")
|
||||
modulate_color = Color(0.8, 0.533333, 0.27451, 1)
|
||||
@@ -294,7 +18,7 @@ modulate_color = Color(0.8, 0.533333, 0.27451, 1)
|
||||
texture = ExtResource("3_dbpks")
|
||||
|
||||
[node name="Настройки" type="Panel"]
|
||||
script = SubResource("GDScript_fc87o")
|
||||
script = ExtResource("1_60bya")
|
||||
|
||||
[node name="heard_table" type="GridContainer" parent="."]
|
||||
layout_mode = 0
|
||||
|
||||
@@ -16,13 +16,13 @@ class_name work extends Panel
|
||||
@export var strob_max_width: float ## Максимальная ширина строба по углу.
|
||||
@export var strob_min_band: float ## Минимальная ширина строба по частоте.
|
||||
@export var strob_min_width: float ## Минимальная ширина строба по углу.
|
||||
@export var window_0_id: int ## Идетификатор окна. Присваивается godot от 0 до количества созданных окон.
|
||||
@export var window_0_id: int ## Идентификатор окна. Присваивается godot от 0 до количества созданных окон.
|
||||
|
||||
const SVK_EMIT = 1 ## Код состояния выполнения помехи - выполняется
|
||||
|
||||
var drag_button: MouseButton ## Кнопка мыши нажатая при перетаскивании.
|
||||
var drag_fsm: DragFSM = DragFSM.IDLE ## Текущее состояние перетаскивания.
|
||||
var btn_select: BtnSel = BtnSel.THREAT ## Текущее состояние кнопки выбора цели.
|
||||
var btn_select: BtnSel = BtnSel.SECTOR ## Текущее состояние кнопки выбора цели.
|
||||
var drag_pos_begin: Vector2 ## Точка начала перетаскивания.
|
||||
var max_zoom: int ## Максимальный уровень детализации.
|
||||
var min_zoom: int ## Минимальный уровень детализации.
|
||||
@@ -38,7 +38,9 @@ var color_select: Color
|
||||
var color_emit: Color
|
||||
var color_emit_sel: Color
|
||||
var color_closed: Color
|
||||
var col_btn_act: Color = Color.WHITE
|
||||
var color_closed_emit: Color
|
||||
var signal_conections: Array
|
||||
|
||||
var course = 0.0 ## Курс корабля
|
||||
|
||||
@@ -90,8 +92,35 @@ const VAL_TO_EVENT = {
|
||||
true: 'full_auto' } ## Выбор целей и установка помех автоматически.
|
||||
|
||||
|
||||
var SIGNALS_CONNECTIONS = [
|
||||
[interfer, 'interfer_update', 'on_interfer_new'],
|
||||
[signaller, 'bip_pressed', 'on_bip_pressed'],
|
||||
[signaller, 'clear_klaster', 'clear_all_klaster'],
|
||||
[signaller, 'fs_selected', 'on_fs_selected'],
|
||||
[signaller, 'fs_update_color', 'set_fs_color'],
|
||||
[signaller, 'fs_update_state', 'on_fs_update_state'],
|
||||
[signaller, 'interfer_new', 'on_interfer_new'],
|
||||
[signaller, 'interfer_off_all', 'on_interfer_off_all'],
|
||||
[signaller, 'interfer_prinuditelno', 'on_chk_interfer_prinuditelno'],
|
||||
[signaller, 'interfer_prinuditelno', 'on_interfer_prinuditelno'],
|
||||
[signaller, 'interfer_selected', 'on_interfer_selected'],
|
||||
[signaller, 'map_user_panning', 'on_user_panning'],
|
||||
[signaller, 'on_prog_ecm_off', 'on_interfer_new'],
|
||||
[signaller, 'rto_threat_sel', 'on_rto_threat_sel'],
|
||||
[signaller, 'rto_threat_unsel', 'on_rto_threat_unsel'],
|
||||
[signaller, 'sector_klaster', 'sector_klaster'],
|
||||
[signaller, 'th_aoa_update', 'on_th_aoa_update'],
|
||||
[signaller, 'threat_selected', 'on_threat_selected'],
|
||||
[signaller, 'update_coordinates_map', 'on_update_coordinates_label'],
|
||||
[signaller, 'update_scale_map', 'on_update_scale_label'],
|
||||
[threats, 'threat_lost', 'on_threat_lost'],
|
||||
[threats, 'threat_new', 'on_threat_new'],
|
||||
[threats, 'threat_update', 'on_threat_update'],
|
||||
[threats, 'threats_resized', 'on_threats_resized'] ]
|
||||
|
||||
|
||||
## Обработчик выбора цели.
|
||||
func on_threat_selected(th, ecm_btns): on_rto_threat_sel(th.id, ecm_btns)
|
||||
func on_threat_selected(th): on_rto_threat_sel(th.id)
|
||||
|
||||
|
||||
## Встроенный обратный вызов.
|
||||
@@ -110,6 +139,8 @@ func on_settings_changed():
|
||||
color_ecm = ProjectSettings.get_setting('application/interfer/interfer_color', Color(0.58, 0.47, 0.51, 1.0))
|
||||
color_select = ProjectSettings.get_setting('application/interfer/select_color', Color(1.0, 1.0, 1.0, 1.0))
|
||||
color_closed = ProjectSettings.get_setting('application/interfer/closed_sectors', Color(0.0, 0.0, 0.0, 1.0))
|
||||
min_zoom = ProjectSettings.get_setting('application/config/map_minimum_zoom', 5)
|
||||
max_zoom = ProjectSettings.get_setting('application/config/map_maximum_zoom', 19)
|
||||
color_emit_sel = color_select
|
||||
color_closed_emit = color_closed
|
||||
|
||||
@@ -119,6 +150,7 @@ func on_settings_changed():
|
||||
color_closed *= Color(1.0, 1.0, 1.0, 0.0)
|
||||
color_closed_emit *= Color(1.0, 1.0, 1.0, 1.0)
|
||||
|
||||
col_btn_act = ProjectSettings.get_setting('application/config/%s' % 'Цвет кнопки \"Подавление\"', Color.WHITE)
|
||||
|
||||
|
||||
## Обработчик сигнала изменения списка целей.
|
||||
@@ -168,43 +200,43 @@ func _ready():
|
||||
ProjectSettings.connect('settings_changed', on_settings_changed)
|
||||
on_settings_changed()
|
||||
init_fs_failed()
|
||||
min_zoom = ProjectSettings.get_setting('application/config/map_minimum_zoom', 5)
|
||||
max_zoom = ProjectSettings.get_setting('application/config/map_maximum_zoom', 19)
|
||||
drag_fsm = DragFSM.OFF
|
||||
var btns_select: Array = get_tree().get_nodes_in_group('группа-режим-выбора')
|
||||
btns_select.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_select').bind(btn, btns_select)))
|
||||
on_button_select($btns_select/btn_fs_sector, btns_select)
|
||||
var nodes: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
nodes.any(func(btn): btn.button_connect('pressed', Callable(self, 'on_button_pressed').bind(btn, nodes)))
|
||||
$btn_close.button_connect('pressed', Callable(self, 'on_btn_close').bind($btn_close))
|
||||
$btn_work.button_connect('pressed', Callable(self, 'on_btn_work').bind($btn_work))
|
||||
threats.connect('threat_new', Callable(self, 'on_threat_new'))
|
||||
threats.connect('threat_lost', Callable(self, 'on_threat_lost'))
|
||||
threats.connect('threats_resized', Callable(self, 'on_threats_resized'))
|
||||
threats.connect('threat_update', Callable(self, 'on_threat_update'))
|
||||
signaller.connect('rto_threat_sel', Callable(self, 'on_rto_threat_sel').bind(nodes))
|
||||
signaller.connect('bip_pressed', Callable(self, 'on_bip_pressed').bind(nodes))
|
||||
signaller.connect('rto_threat_unsel', Callable(self, 'on_rto_threat_unsel').bind(nodes))
|
||||
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(nodes))
|
||||
signaller.connect('interfer_selected', Callable(self, 'on_interfer_selected').bind(nodes))
|
||||
signaller.connect('interfer_new', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('on_prog_ecm_off', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno').bind(nodes))
|
||||
signaller.connect('fs_selected', Callable(self, 'on_fs_selected'))
|
||||
signaller.connect('fs_update_color', Callable(self, 'set_fs_color'))
|
||||
interfer.connect('interfer_update', Callable(self, 'on_interfer_new'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_chk_interfer_prinuditelno'))
|
||||
signaller.connect('fs_update_state', Callable(self, 'on_fs_update_state'))
|
||||
signaller.connect('map_user_panning', Callable(self, 'on_user_panning'))
|
||||
signaller.connect('update_coordinates_map', Callable(self, 'on_update_coordinates_label'))
|
||||
signaller.connect('update_scale_map', Callable(self, 'on_update_scale_label'))
|
||||
signaller.connect('sector_klaster', Callable(self, 'sector_klaster'))
|
||||
signaller.connect('clear_klaster', Callable(self, 'clear_all_klaster'))
|
||||
signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update'))
|
||||
$btn_close.button_connect('pressed', on_btn_close)
|
||||
$btn_work.button_connect('pressed', on_btn_work)
|
||||
var unit_nav = network.get_unit_instance('навигация')
|
||||
unit_nav.connect('data_received', on_navi_data_received)
|
||||
on_btn_center_toggled(true)
|
||||
on_btn_activate_toggled(true)
|
||||
signaller.connect('режим_работа', connect_all)
|
||||
signaller.connect('режим_контроль', disconnect_all)
|
||||
signaller.connect('режим_журнал', disconnect_all)
|
||||
signaller.connect('режим_эмс', disconnect_all)
|
||||
signaller.connect('режим_эмс2', disconnect_all)
|
||||
signaller.connect('режим_настройки', disconnect_all)
|
||||
connect_all()
|
||||
|
||||
|
||||
func connect_all() -> void:
|
||||
signal_conections.clear()
|
||||
for item in SIGNALS_CONNECTIONS:
|
||||
var proc = Callable(self, item[2])
|
||||
var rc = item[0].connect(item[1], proc)
|
||||
if rc == Error.OK:
|
||||
signal_conections.append([item[0], item[1], proc])
|
||||
else:
|
||||
var ers = error_string(rc)
|
||||
push_error('%s: %s %s %s' % [ers, item[0], item[1], item[2]])
|
||||
|
||||
|
||||
func disconnect_all() -> void:
|
||||
for item in signal_conections:
|
||||
item[0].disconnect(item[1], item[2])
|
||||
signal_conections.clear()
|
||||
|
||||
|
||||
func sector_klaster(sector_data):
|
||||
@@ -320,13 +352,13 @@ func on_threat_lost(th) -> void:
|
||||
|
||||
|
||||
## обработчик нажатия на цель на экране.
|
||||
func on_bip_pressed(th_id, _ecm_btns):
|
||||
func on_bip_pressed(th_id):
|
||||
if btn_select == BtnSel.THREAT:
|
||||
signaller.emit_signal('rto_threat_sel', th_id)
|
||||
|
||||
|
||||
## Обработчик выбора РТО цели.
|
||||
func on_rto_threat_sel(th_id, ecm_btns):
|
||||
func on_rto_threat_sel(th_id):
|
||||
var bips: Array = get_children().filter(func(item): return item.name.is_valid_int())
|
||||
for item in bips:
|
||||
if th_id == item.name.to_int():
|
||||
@@ -336,6 +368,7 @@ func on_rto_threat_sel(th_id, ecm_btns):
|
||||
item.set_sel_visible(false)
|
||||
var th = thrs_dict[th_id]
|
||||
var krp = interfer.get_krp(th)
|
||||
var ecm_btns: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
for btn in ecm_btns:
|
||||
set_btns_disabled(false, btn)
|
||||
var btn_meta = btn.get_meta('rfi_name')
|
||||
@@ -346,13 +379,14 @@ func on_rto_threat_sel(th_id, ecm_btns):
|
||||
|
||||
|
||||
## Обработчик снятия выбора РТО цели.
|
||||
func on_rto_threat_unsel(th_id, ecm_btns):
|
||||
func on_rto_threat_unsel(th_id):
|
||||
var bips: Array = get_children().filter(func(item): return item.name.is_valid_int())
|
||||
for item in bips:
|
||||
if th_id == item.name.to_int():
|
||||
item.set_sel_visible(false)
|
||||
break
|
||||
set_ecm_btns_state(true)
|
||||
var ecm_btns: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
for btn in ecm_btns:
|
||||
btn.set_rec_visible(false)
|
||||
|
||||
@@ -377,21 +411,22 @@ func on_button_select(btn_this, btn_others) -> void:
|
||||
func on_button_pressed(btn_this, btn_others) -> void:
|
||||
$chk_auto.set_pressed_no_signal(false)
|
||||
on_value_changed(false)
|
||||
var fs_arr: Array = []
|
||||
for btn_other in btn_others: btn_other.set_pressed(btn_this == btn_other)
|
||||
var interfer_name: String = btn_this.get_meta('rfi_name')
|
||||
var interfer_name: String = btn_this.get_meta('rfi_name', 'off')
|
||||
var fs_arr: Array = []
|
||||
for key in fs_selected.keys():
|
||||
fs_arr.append(prd.get_fs_param(key))
|
||||
signaller.emit_signal('interfer_init', interfer_name, fs_arr, interfer.POW_DEFAULT)
|
||||
|
||||
|
||||
## Управляет состоянием кнопок в радиогруппе при выборе помехи.
|
||||
func on_interfer_selected(ecm, btns) -> void:
|
||||
func on_interfer_selected(ecm) -> void:
|
||||
var ecm_name: String
|
||||
if ecm != null:
|
||||
ecm_name = ecm.krp
|
||||
else:
|
||||
ecm_name = interfer.INTERFER_OFF
|
||||
var btns: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
for btn in btns:
|
||||
set_btns_disabled(false, btn)
|
||||
btn.get_meta('rfi_name')
|
||||
@@ -538,7 +573,7 @@ func update_fs_colors():
|
||||
$canvas.set_band_failures(fs_failed)
|
||||
if fs_emit.size():
|
||||
if $btn_activate.pressed:
|
||||
$btn_activate.self_modulate = Color.RED
|
||||
$btn_activate.self_modulate = col_btn_act
|
||||
else:
|
||||
$btn_activate.self_modulate = Color.WHITE
|
||||
else:
|
||||
@@ -578,13 +613,14 @@ func set_btns_disabled(value: bool, btn):
|
||||
btn.set_disabled(value)
|
||||
|
||||
|
||||
func on_interfer_prinuditelno (prenuditelno_sectors, btns):
|
||||
func on_interfer_prinuditelno(prenuditelno_sectors):
|
||||
for key in prenuditelno_sectors:
|
||||
var sectors = []
|
||||
for sector in prenuditelno_sectors[key]:
|
||||
sectors.append(prd.get_fs_param(sector))
|
||||
signaller.emit_signal('interfer_init', key, sectors, interfer.POW_DEFAULT)
|
||||
update_fs_colors()
|
||||
var btns: Array = get_tree().get_nodes_in_group('группа-режим-помехи')
|
||||
for btn in btns:
|
||||
btn.set_pressed(false)
|
||||
set_btns_disabled(true, btn)
|
||||
@@ -616,16 +652,16 @@ func on_update_scale_label(scale_label) -> void:
|
||||
$scale_map.text = str(scale_label)
|
||||
|
||||
|
||||
func on_btn_close(btn):
|
||||
func on_btn_close():
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
btn.pressed = false
|
||||
$btn_close.pressed = false
|
||||
fs_closed.merge(fs_selected)
|
||||
signaller.emit_signal('update_fs_closed', fs_closed)
|
||||
|
||||
|
||||
func on_btn_work(btn):
|
||||
func on_btn_work():
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
btn.pressed = false
|
||||
$btn_work.pressed = false
|
||||
fs_closed.clear()
|
||||
for fs_index in prd.FS_PRD.keys():
|
||||
if fs_index in fs_selected: continue
|
||||
|
||||
@@ -197,6 +197,7 @@ size_flags_vertical = 3
|
||||
tooltip_text = "Кнопка для выбора сектора при помощи клика мышкой"
|
||||
strips_rotation = 25.0
|
||||
text = "Сектор"
|
||||
pressed = true
|
||||
metadata/state = 2
|
||||
|
||||
[node name="chk_auto" type="CheckBox" parent="."]
|
||||
@@ -306,36 +307,36 @@ vertical_alignment = 1
|
||||
|
||||
[node name="coordinates_map" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 654.0
|
||||
offset_top = -23.0
|
||||
offset_right = 766.0
|
||||
offset_bottom = -4.0
|
||||
offset_left = 660.0
|
||||
offset_top = -24.0
|
||||
offset_right = 772.0
|
||||
offset_bottom = -5.0
|
||||
text = "Координаты:"
|
||||
|
||||
[node name="scale_map" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1009.0
|
||||
offset_top = -23.0
|
||||
offset_right = 1119.0
|
||||
offset_bottom = -2.0
|
||||
offset_left = 1003.0
|
||||
offset_top = -24.0
|
||||
offset_right = 1113.0
|
||||
offset_bottom = -3.0
|
||||
text = "Масштаб:"
|
||||
|
||||
[node name="zoom_plus" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 952.0
|
||||
offset_top = 43.0
|
||||
offset_right = 984.0
|
||||
offset_bottom = 75.0
|
||||
offset_left = 1056.0
|
||||
offset_top = 230.0
|
||||
offset_right = 1088.0
|
||||
offset_bottom = 262.0
|
||||
theme_override_fonts/font = SubResource("SystemFont_5ffal")
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "+"
|
||||
|
||||
[node name="zoom_minus" type="Button" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 952.0
|
||||
offset_top = 84.0
|
||||
offset_right = 984.0
|
||||
offset_bottom = 116.0
|
||||
offset_left = 1056.0
|
||||
offset_top = 270.0
|
||||
offset_right = 1088.0
|
||||
offset_bottom = 302.0
|
||||
theme_override_font_sizes/font_size = 20
|
||||
text = "−"
|
||||
|
||||
@@ -383,8 +384,8 @@ texture_normal = ExtResource("14_ggrwd")
|
||||
[connection signal="toggled" from="btn_activate" to="." method="on_btn_activate_toggled"]
|
||||
[connection signal="toggled" from="btn_center" to="." method="on_btn_center_toggled"]
|
||||
[connection signal="button_down" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_down"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_plus_button_up"]
|
||||
[connection signal="button_up" from="zoom_plus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="button_down" from="zoom_minus" to="tilemap" method="_on_zoom_minus_button_down"]
|
||||
[connection signal="button_up" from="zoom_minus" to="tilemap" method="_on_zoom_button_up"]
|
||||
[connection signal="pressed" from="btn_all_work" to="." method="_on_btn_all_work_pressed"]
|
||||
|
||||
@@ -54,15 +54,15 @@ const EMS_G_BOARDS = {
|
||||
|
||||
## Таблица с данными для входов, первое значение - индекс устройства в ячейке КЭМС.
|
||||
const INPUT_KEMS = [
|
||||
[1 ,['УИЗП №1', 'Х7', '0.00', '0.00']],
|
||||
[1 ,['5П-26М', 'Х7', '0.00', '0.00']],
|
||||
[2 ,['УИЗПФ №1','Х8', '0.00', '0.00']],
|
||||
[3 ,['УИЗП №2', 'Х10', '0.00', '0.00']],
|
||||
[3 ,['НРЛС МР-231', 'Х10', '0.00', '0.00']],
|
||||
[4 ,['УИЗПФ №2','Х11', '0.00', '0.00']],
|
||||
[5 ,['УИЗП №3', 'Х13', '0.00', '0.00']],
|
||||
[5 ,['НРЛС-231-3', 'Х13', '0.00', '0.00']],
|
||||
[6 ,['УИЗПФ №3','Х14', '0.00', '0.00']],
|
||||
[7 ,['УИЗП №4', 'Х16', '0.00', '0.00']],
|
||||
[7 ,['3Р87-1Ф', 'Х16', '0.00', '0.00']],
|
||||
[8 ,['УИЗПФ №4','Х17', '0.00', '0.00']],
|
||||
[9 ,['УИЗП №5', 'Х19', '0.00', '0.00']],
|
||||
[9 ,['ПРЛ ИСБУ-23900', 'Х19', '0.00', '0.00']],
|
||||
[10,['УИЗПФ №5','Х20', '0.00', '0.00']],
|
||||
[11,['УИЗП №6', 'Х22', '0.00', '0.00']],
|
||||
[12,['УИЗПФ №6','Х23', '0.00', '0.00']],
|
||||
@@ -77,11 +77,11 @@ const INPUT_KEMS = [
|
||||
|
||||
## Таблица с данными для выходов, первое значение - индекс устройства в ячейке КЭМС.
|
||||
const OUTPUT_KEMS = [
|
||||
[47,['Бланк №1','Х6', '0.00', '0.00']],
|
||||
[48,['Бланк №2','Х9', '0.00', '0.00']],
|
||||
[49,['Бланк №3','Х12', '0.00', '0.00']],
|
||||
[50,['Бланк №4','Х15', '0.00', '0.00']],
|
||||
[51,['Бланк №5','Х18', '0.00', '0.00']],
|
||||
[47,['5П-26М','Х6', '0.00', '0.00']],
|
||||
[48,['НРЛС МР-231','Х9', '0.00', '0.00']],
|
||||
[49,['НРЛС-231-3','Х12', '0.00', '0.00']],
|
||||
[50,['3Р87-1Ф','Х15', '0.00', '0.00']],
|
||||
[51,['ПРЛ ИСБУ-23900','Х18', '0.00', '0.00']],
|
||||
[52,['Бланк №6','Х21', '0.00', '0.00']],
|
||||
[53,['Бланк №7','Х24', '0.00', '0.00']],
|
||||
[55,['Бланк_МП №1', 'X28 : 8', '0.00', '0.00']],
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://hkcvl2waf63s" path="res://data/вид сверху.png" id="1_b7vcf"]
|
||||
[ext_resource type="Script" uid="uid://bvlqgv7aapebl" path="res://scenes/эмс2/эмс_тг.gd" id="1_l3ueu"]
|
||||
[ext_resource type="Texture2D" uid="uid://b1dw06ahtftq2" path="res://data/Окно частот0.png" id="3_2spgl"]
|
||||
[ext_resource type="Texture2D" uid="uid://0w6q4vfst0ry" path="res://data/OP-63.png" id="3_8gk36"]
|
||||
[ext_resource type="Texture2D" uid="uid://coxhivvc6uibs" path="res://data/Состояние РЭС 40.png" id="4_b3mus"]
|
||||
[ext_resource type="Texture2D" uid="uid://073el51yholj" path="res://data/454.png" id="4_nqi0i"]
|
||||
@@ -34,7 +33,11 @@
|
||||
[ext_resource type="Texture2D" uid="uid://carr8bw5rwiwj" path="res://data/Кнопка подтверждения01.png" id="32_p41nv"]
|
||||
[ext_resource type="Texture2D" uid="uid://3siondd3feev" path="res://data/Скруглённый прямоугольник белый.png" id="33_5ifkb"]
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_5u4bk"]
|
||||
load_path = "res://.godot/imported/Окно частот0.png-6b01791c971bddb01337caf9077bf060.ctex"
|
||||
|
||||
[sub_resource type="CompressedTexture2D" id="CompressedTexture2D_l3ueu"]
|
||||
load_path = "res://.godot/imported/Скруглённый квадрат серый.png-4655829309cca3b1dec2c9ae01376d54.ctex"
|
||||
|
||||
[node name="Panel" type="Panel"]
|
||||
script = ExtResource("1_l3ueu")
|
||||
@@ -53,7 +56,7 @@ offset_top = 240.0
|
||||
offset_right = 1649.0
|
||||
offset_bottom = 813.0
|
||||
scale = Vector2(0.95, 0.95)
|
||||
texture = ExtResource("3_2spgl")
|
||||
texture = SubResource("CompressedTexture2D_5u4bk")
|
||||
expand_mode = 1
|
||||
|
||||
[node name="Op-63" type="TextureRect" parent="."]
|
||||
@@ -66,13 +69,13 @@ scale = Vector2(0.312207, 0.312207)
|
||||
texture = ExtResource("3_8gk36")
|
||||
|
||||
[node name="СостояниеРэс44" type="Sprite2D" parent="Op-63"]
|
||||
position = Vector2(285.067, 253.037)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(277.772, 259.444)
|
||||
scale = Vector2(1.77945, 1.77945)
|
||||
texture = ExtResource("4_b3mus")
|
||||
|
||||
[node name="СостояниеРэс24" type="Sprite2D" parent="Op-63"]
|
||||
position = Vector2(285.067, 150.541)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(277.772, 192.18)
|
||||
scale = Vector2(1.77945, 1.77945)
|
||||
texture = ExtResource("5_yqn2y")
|
||||
|
||||
[node name="СостояниеРэс2" type="Sprite2D" parent="Op-63"]
|
||||
@@ -91,18 +94,18 @@ scale = Vector2(0.312, 0.312)
|
||||
texture = ExtResource("4_nqi0i")
|
||||
|
||||
[node name="СостояниеРэс45" type="Sprite2D" parent="454"]
|
||||
position = Vector2(287.571, 253.205)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(277.956, 259.615)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("4_b3mus")
|
||||
|
||||
[node name="СостояниеРэс25" type="Sprite2D" parent="454"]
|
||||
position = Vector2(287.571, 153.847)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(277.956, 192.308)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("5_yqn2y")
|
||||
|
||||
[node name="СостояниеРэс3" type="Sprite2D" parent="454"]
|
||||
position = Vector2(285.256, 41.6667)
|
||||
scale = Vector2(4, 4)
|
||||
position = Vector2(275.641, 38.4615)
|
||||
scale = Vector2(3.20513, 3.20513)
|
||||
texture = ExtResource("6_m57px")
|
||||
|
||||
[node name="lbl_trassa" type="Label" parent="454"]
|
||||
@@ -117,25 +120,25 @@ text = "Трасса"
|
||||
[node name="Го" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 488.0
|
||||
offset_top = 84.0
|
||||
offset_top = 85.0
|
||||
offset_right = 701.0
|
||||
offset_bottom = 376.0
|
||||
offset_bottom = 377.0
|
||||
scale = Vector2(0.312, 0.312)
|
||||
texture = ExtResource("5_e7tlv")
|
||||
|
||||
[node name="СостояниеРэс40" type="Sprite2D" parent="Го"]
|
||||
position = Vector2(287.66, 253.205)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(278.045, 253.205)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("4_b3mus")
|
||||
|
||||
[node name="СостояниеРэс20" type="Sprite2D" parent="Го"]
|
||||
position = Vector2(287.66, 150.641)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(278.045, 185.897)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("5_yqn2y")
|
||||
|
||||
[node name="СостояниеЭмсСлабыйСигнал" type="Sprite2D" parent="Го"]
|
||||
position = Vector2(284.455, 38.4619)
|
||||
scale = Vector2(4, 3.796)
|
||||
position = Vector2(278.045, 118.59)
|
||||
scale = Vector2(3.37683, 3.20513)
|
||||
texture = ExtResource("9_5u4bk")
|
||||
|
||||
[node name="Рлс1" type="TextureRect" parent="."]
|
||||
@@ -148,18 +151,18 @@ scale = Vector2(0.312, 0.312)
|
||||
texture = ExtResource("6_y58bl")
|
||||
|
||||
[node name="СостояниеРэс41" type="Sprite2D" parent="Рлс1"]
|
||||
position = Vector2(287.661, 253.205)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(278.045, 259.615)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("4_b3mus")
|
||||
|
||||
[node name="СостояниеРэс21" type="Sprite2D" parent="Рлс1"]
|
||||
position = Vector2(287.661, 153.846)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(278.045, 192.308)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("5_yqn2y")
|
||||
|
||||
[node name="СостояниеЭмсСлабыйСигнал2" type="Sprite2D" parent="Рлс1"]
|
||||
position = Vector2(287.66, 38.4615)
|
||||
scale = Vector2(4, 3.796)
|
||||
position = Vector2(278.045, 125)
|
||||
scale = Vector2(3.37683, 3.20513)
|
||||
texture = ExtResource("9_5u4bk")
|
||||
|
||||
[node name="Рлс2" type="TextureRect" parent="."]
|
||||
@@ -172,37 +175,37 @@ scale = Vector2(0.312, 0.312)
|
||||
texture = ExtResource("7_mxw8g")
|
||||
|
||||
[node name="СостояниеРэс42" type="Sprite2D" parent="Рлс2"]
|
||||
position = Vector2(287.661, 253.205)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(278.045, 259.615)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("4_b3mus")
|
||||
|
||||
[node name="СостояниеРэс22" type="Sprite2D" parent="Рлс2"]
|
||||
position = Vector2(287.661, 153.846)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(278.045, 192.308)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("5_yqn2y")
|
||||
|
||||
[node name="СостояниеЭмсСлабыйСигнал3" type="Sprite2D" parent="Рлс2"]
|
||||
position = Vector2(287.66, 38.4615)
|
||||
scale = Vector2(4, 3.796)
|
||||
position = Vector2(278.045, 125)
|
||||
scale = Vector2(3.37683, 3.20513)
|
||||
texture = ExtResource("9_5u4bk")
|
||||
|
||||
[node name="Ннвс" type="TextureRect" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 1240.0
|
||||
offset_top = 84.0
|
||||
offset_top = 88.0
|
||||
offset_right = 1453.0
|
||||
offset_bottom = 376.0
|
||||
offset_bottom = 380.0
|
||||
scale = Vector2(0.312, 0.312)
|
||||
texture = ExtResource("8_q16jd")
|
||||
|
||||
[node name="СостояниеРэс43" type="Sprite2D" parent="Ннвс"]
|
||||
position = Vector2(287.571, 253.205)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(277.956, 253.205)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("4_b3mus")
|
||||
|
||||
[node name="СостояниеРэс23" type="Sprite2D" parent="Ннвс"]
|
||||
position = Vector2(287.571, 153.846)
|
||||
scale = Vector2(2.1, 2.1)
|
||||
position = Vector2(277.956, 185.897)
|
||||
scale = Vector2(1.78063, 1.78063)
|
||||
texture = ExtResource("5_yqn2y")
|
||||
|
||||
[node name="УгловойКвадрат2" type="Sprite2D" parent="."]
|
||||
@@ -403,9 +406,9 @@ texture = SubResource("CompressedTexture2D_l3ueu")
|
||||
|
||||
[node name="Label" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 799.0
|
||||
offset_left = 800.0
|
||||
offset_top = 246.0
|
||||
offset_right = 872.0
|
||||
offset_right = 873.0
|
||||
offset_bottom = 265.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
@@ -413,7 +416,7 @@ text = "Излучение"
|
||||
|
||||
[node name="Label2" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
offset_left = 814.0
|
||||
offset_left = 813.0
|
||||
offset_top = 503.0
|
||||
offset_right = 861.0
|
||||
offset_bottom = 522.0
|
||||
@@ -481,52 +484,52 @@ theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Изделие"
|
||||
|
||||
[node name="Label" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = -33.7501
|
||||
offset_left = -33.0
|
||||
offset_top = -10.2857
|
||||
offset_right = 34.2499
|
||||
offset_bottom = 8.7143
|
||||
offset_right = 35.0
|
||||
offset_bottom = 8.71429
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Комплекс"
|
||||
|
||||
[node name="Label3" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 132.75
|
||||
offset_top = -11.1428
|
||||
offset_right = 179.75
|
||||
offset_bottom = 11.8572
|
||||
offset_left = 133.0
|
||||
offset_top = -10.0
|
||||
offset_right = 180.0
|
||||
offset_bottom = 9.0
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Режим"
|
||||
|
||||
[node name="Label4" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 210.751
|
||||
offset_left = 209.25
|
||||
offset_top = -10.2857
|
||||
offset_right = 259.751
|
||||
offset_right = 258.25
|
||||
offset_bottom = 8.7143
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Азимут"
|
||||
|
||||
[node name="Label5" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 620.252
|
||||
offset_top = -23.1428
|
||||
offset_right = 699.252
|
||||
offset_bottom = 25.8572
|
||||
offset_left = 627.0
|
||||
offset_top = -20.5713
|
||||
offset_right = 693.0
|
||||
offset_bottom = 20.4287
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Запрет
|
||||
передачи"
|
||||
horizontal_alignment = 1
|
||||
|
||||
[node name="Label6" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 518.251
|
||||
offset_top = -12.0
|
||||
offset_right = 576.251
|
||||
offset_bottom = 11.0
|
||||
offset_left = 516.75
|
||||
offset_top = -10.2857
|
||||
offset_right = 574.75
|
||||
offset_bottom = 8.7143
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Верхняя"
|
||||
|
||||
[node name="Label7" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 440.0
|
||||
offset_top = -11.0
|
||||
offset_right = 494.0
|
||||
offset_bottom = 12.0
|
||||
offset_left = 441.0
|
||||
offset_top = -10.2857
|
||||
offset_right = 495.0
|
||||
offset_bottom = 8.7143
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Нижняя"
|
||||
|
||||
@@ -539,14 +542,12 @@ theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Кластер"
|
||||
|
||||
[node name="Label9" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 276.001
|
||||
offset_top = -20.5714
|
||||
offset_right = 350.001
|
||||
offset_bottom = 20.4286
|
||||
offset_left = 275.25
|
||||
offset_top = -10.2857
|
||||
offset_right = 349.25
|
||||
offset_bottom = 8.7143
|
||||
theme_override_colors/font_color = Color(0, 0, 0, 1)
|
||||
text = "Угол
|
||||
места"
|
||||
horizontal_alignment = 1
|
||||
text = "Угол места"
|
||||
|
||||
[node name="Label10" type="Label" parent="СкруглённыйПрямоугСалатный"]
|
||||
offset_left = 747.0
|
||||
|
||||
@@ -30,7 +30,7 @@ func on_trassa_line_changed(unit_trassa):
|
||||
$'СкруглённыйПрямоугольникБелый/Label10'.text = '-'
|
||||
|
||||
|
||||
func on_sector_klaster(data, unit_trassa):
|
||||
func on_sector_klaster(_data, unit_trassa):
|
||||
$'СкруглённыйПрямоугольникБелый/Label6'.text = str(unit_trassa.dap)
|
||||
$'СкруглённыйПрямоугольникБелый/Label7'.text = str(unit_trassa.daa)
|
||||
$'СкруглённыйПрямоугольникБелый/Label8'.text = '1'
|
||||
|
||||
@@ -111,6 +111,12 @@ var gos_nmfs: Array ## Список номеров
|
||||
var fs_closed: Dictionary ## Словарь секторов запрета
|
||||
|
||||
|
||||
## Режимы работы АФСП и БПО (Протокол ТНИИС-СТЦ, пункт 2.5.10)
|
||||
enum AFSP_BPO_MODE {
|
||||
run = 1,
|
||||
test = 2 }
|
||||
|
||||
|
||||
## Сеанс помехи.
|
||||
class Interfer:
|
||||
var ispp: int = 0 ## Индекс сеанса.
|
||||
@@ -127,6 +133,7 @@ class Interfer:
|
||||
var um: float ## Угол места для помехи.
|
||||
var nmfs: int = 0 ## Номер модуля ФС в нумерации СТЦ
|
||||
var priority: int = 0 ## Приоритет помехи
|
||||
static var afsp_bpo_mode: = AFSP_BPO_MODE.run ## Режим работы АФСП и БПО
|
||||
|
||||
func _to_string() -> String:
|
||||
return 'номер: %d название: %s частота: %0.1f МГц пеленг: %0.1f гр.' % [ispp, ITERFER_MODE[krp][0], params['freq'], kni]
|
||||
@@ -138,6 +145,7 @@ class Interfer:
|
||||
data_to_json['ispp'] = ispp
|
||||
data_to_json['krp'] = ITERFER_MODE[krp][0]
|
||||
data_to_json['nmfs'] = nmfs
|
||||
data_to_json['sa'] = afsp_bpo_mode
|
||||
if krp != INTERFER_OFF:
|
||||
data_to_json['kni'] = kni
|
||||
data_to_json['powp'] = powp
|
||||
@@ -205,12 +213,14 @@ func _ready() -> void:
|
||||
signaller.connect('interfer_new', Callable(self, 'on_interfer_new').bind(unit_caps))
|
||||
signaller.connect('interfer_off_all', Callable(self, 'on_interfer_off_all').bind(unit_caps, ecms))
|
||||
signaller.connect('th_aoa_update', Callable(self, 'on_th_aoa_update').bind(ecms, unit_caps))
|
||||
signaller.connect('interfer_off', Callable(self, 'on_interfer_off').bind(ecms))
|
||||
signaller.connect('interfer_off', Callable(self, 'on_interfer_off').bind(ecms, unit_caps))
|
||||
signaller.connect('manual_control', Callable(self, 'on_manual_control'))
|
||||
signaller.connect('full_auto', Callable(self, 'on_full_auto'))
|
||||
signaller.connect('interfer_prinuditelno', Callable(self, 'on_interfer_prinuditelno'))
|
||||
signaller.connect('emit_changed', Callable(self, 'on_emit_changed').bind(ecms))
|
||||
signaller.connect('режим_тренаж', on_trenazh_mode)
|
||||
signaller.connect('режим_контроль', on_kontrol_mode)
|
||||
signaller.connect('режим_работа', on_rabota_mode)
|
||||
signaller.connect('update_fs_closed', Callable(self, 'on_update_fs_closed'))
|
||||
threats.connect('threat_lost', Callable(self, 'on_threats_lost').bind(ecms, unit_caps))
|
||||
threats.connect('threats_resized', Callable(self, 'on_threats_resized'))
|
||||
@@ -218,9 +228,12 @@ func _ready() -> void:
|
||||
ProjectSettings.connect('settings_changed', on_settings_changed)
|
||||
var unit_nav: = network.get_unit_instance('навигация')
|
||||
unit_nav.connect('data_received', on_nav_data_received.bind(unit_caps))
|
||||
call_deferred('emit_signal', 'interfer_resized', ecms)
|
||||
|
||||
|
||||
func on_trenazh_mode(val: bool): trenazh_mode = val
|
||||
func on_kontrol_mode(): Interfer.afsp_bpo_mode = AFSP_BPO_MODE.test
|
||||
func on_rabota_mode(): Interfer.afsp_bpo_mode = AFSP_BPO_MODE.run
|
||||
|
||||
|
||||
func on_nav_data_received(coords: Dictionary, unit_caps):
|
||||
@@ -334,10 +347,12 @@ func map_msvk_to_ecms(unit_instance: unit.Unit, ecms: Dictionary):
|
||||
var json_dic = unit_instance.json_dic
|
||||
if not json_dic.has('msvk'): return
|
||||
var msvk = unit_instance.json_dic.get('msvk', [])
|
||||
var ispp_arr: Array = []
|
||||
for dic_msvk in msvk:
|
||||
if dic_msvk is not Dictionary: continue
|
||||
if not dic_msvk.has('ispp'): continue
|
||||
var ispp = int(dic_msvk['ispp'])
|
||||
ispp_arr.append(ispp)
|
||||
var errmsg = dic_msvk.get('errmsg', '')
|
||||
if errmsg:
|
||||
log.error('сеанс %d: \"%s\"' % [ispp, errmsg])
|
||||
@@ -345,11 +360,17 @@ func map_msvk_to_ecms(unit_instance: unit.Unit, ecms: Dictionary):
|
||||
var ecm = ecms[ispp]
|
||||
ecm.set_from_dic(dic_msvk)
|
||||
call_deferred('emit_signal', 'interfer_update', ecm)
|
||||
else:
|
||||
var ecm = Interfer.new()
|
||||
ecm.set_from_dic(dic_msvk)
|
||||
ecm.krp = INTERFER_OFF
|
||||
send_ecm(ecm, unit_instance)
|
||||
for ecm in ecms.values():
|
||||
if (ecm.ispp not in ispp_arr) and (ecm.krp == INTERFER_OFF):
|
||||
var sz = ecms.size()
|
||||
signaller.emit_signal('on_prog_ecm_off', ecm)
|
||||
ecms.erase(ecm.ispp)
|
||||
thrs.erase(ecm.ispp)
|
||||
cu.erase(ecm.ispp)
|
||||
fs.erase(ecm.ispp)
|
||||
push_id(ecm.ispp)
|
||||
if sz != ecms.size():
|
||||
interfer.call_deferred('emit_signal', 'interfer_resized', ecms)
|
||||
|
||||
|
||||
## Извлекает массив пространственно-частотных фильтров
|
||||
@@ -638,21 +659,12 @@ func get_krp(threat: threats.Threat):
|
||||
return krp
|
||||
|
||||
|
||||
func on_interfer_off(ecm: Interfer, ecms):
|
||||
var sz = ecms.size()
|
||||
signaller.emit_signal('on_prog_ecm_off', ecm)
|
||||
ecms.erase(ecm.ispp)
|
||||
thrs.erase(ecm.ispp)
|
||||
interfer.cu.erase(ecm.ispp)
|
||||
interfer.fs.erase(ecm.ispp)
|
||||
interfer.push_id(ecm.ispp)
|
||||
if sz != ecms.size():
|
||||
interfer.call_deferred('emit_signal', 'interfer_resized', ecms)
|
||||
|
||||
|
||||
func interfer_off(ecm, unit_caps):
|
||||
func on_interfer_off(ecm: Interfer, _ecms, unit_caps):
|
||||
ecm.krp = INTERFER_OFF
|
||||
send_ecm(ecm, unit_caps)
|
||||
|
||||
|
||||
func interfer_off(ecm, _unit_caps):
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
|
||||
|
||||
@@ -405,7 +405,7 @@ func _process(_delta: float) -> void:
|
||||
var sock: = send_sockets[unit_name]
|
||||
var dst_port: = dst_ports[unit_name]
|
||||
var dst_addr: = dst_addrs[unit_name]
|
||||
while (Error.OK == unit_udptx.process(tick)):
|
||||
while Error.OK == unit_udptx.process(tick):
|
||||
var tx_data: = unit_udptx.tx_data.slice(0, unit_udptx.tx_len)
|
||||
sock.send_to([dst_addr, dst_port], tx_data)
|
||||
for unit_name: StringName in units_udprx:
|
||||
|
||||
240
scripts/prd-ctl-config.gd
Normal file
240
scripts/prd-ctl-config.gd
Normal file
@@ -0,0 +1,240 @@
|
||||
class_name PRDConfigManager
|
||||
extends RefCounted
|
||||
|
||||
## Менеджер конфигурации для системы контроля ПРД
|
||||
## Загружает и управляет настройками из JSON-конфигурации
|
||||
|
||||
#region CONSTANTS
|
||||
const CONFIG_PATH = "user://config/setting_prd_control.json"
|
||||
const DEFAULT_CONFIG_PATH = "res://config/setting_prd_control.json"
|
||||
const CONFIG_VERSION = "1.0.0" # Версия конфигурации - увеличивать при изменениях
|
||||
#endregion
|
||||
|
||||
#region PRIVATE_VARIABLES
|
||||
var _config_data: Dictionary # Все данные конфигурации
|
||||
var _device_constants: Dictionary # Константы устройств
|
||||
var _base_configs: Dictionary # Базовые конфигурации
|
||||
var _device_configs: Dictionary # Конфигурации устройств
|
||||
var _data_indices: Dictionary # Индексы данных
|
||||
var _fs_keys: Dictionary # Ключи ФС (функциональных систем)
|
||||
var _temperature_constants: Dictionary # Константы температуры
|
||||
var _ems_input_bits_config: Dictionary # Конфигурация битов ввода ЭМС
|
||||
var _fs_rules: Array # Правила ФС
|
||||
|
||||
var _is_loaded: bool = false # Флаг успешной загрузки
|
||||
var _current_version: String = "" # Текущая версия загруженной конфигурации
|
||||
#endregion
|
||||
|
||||
#region INITIALIZATION
|
||||
func _init() -> void:
|
||||
"""Инициализация менеджера конфигурации"""
|
||||
_load_configuration()
|
||||
#endregion
|
||||
|
||||
#region PUBLIC_API
|
||||
## Проверяет, успешно ли загружена конфигурация
|
||||
func is_loaded() -> bool:
|
||||
return _is_loaded
|
||||
|
||||
## Возвращает текущую версию загруженной конфигурации
|
||||
func get_config_version() -> String:
|
||||
return _current_version
|
||||
|
||||
## Проверяет, актуальна ли конфигурация
|
||||
func is_config_up_to_date() -> bool:
|
||||
return _current_version == CONFIG_VERSION
|
||||
|
||||
## Возвращает все данные конфигурации
|
||||
func get_config_data() -> Dictionary:
|
||||
return _config_data.duplicate(true)
|
||||
|
||||
## Возвращает константы устройств
|
||||
func get_device_constants() -> Dictionary:
|
||||
return _device_constants.duplicate(true)
|
||||
|
||||
## Возвращает базовые конфигурации
|
||||
func get_base_configs() -> Dictionary:
|
||||
return _base_configs.duplicate(true)
|
||||
|
||||
## Возвращает конфигурации устройств
|
||||
func get_device_configs() -> Dictionary:
|
||||
return _device_configs.duplicate(true)
|
||||
|
||||
## Возвращает индексы данных
|
||||
func get_data_indices() -> Dictionary:
|
||||
return _data_indices.duplicate(true)
|
||||
|
||||
## Возвращает ключи ФС
|
||||
func get_fs_keys() -> Dictionary:
|
||||
return _fs_keys.duplicate(true)
|
||||
|
||||
## Возвращает константы температуры
|
||||
func get_temperature_constants() -> Dictionary:
|
||||
return _temperature_constants.duplicate(true)
|
||||
|
||||
## Возвращает конфигурацию битов ввода ЭМС
|
||||
func get_ems_input_bits_config() -> Dictionary:
|
||||
return _ems_input_bits_config.duplicate(true)
|
||||
|
||||
## Возвращает правила ФС
|
||||
func get_fs_rules() -> Array:
|
||||
return _fs_rules.duplicate(true)
|
||||
|
||||
## Возвращает индекс данных по ключу
|
||||
func get_data_index(key: String) -> int:
|
||||
return _data_indices.get(key, -1)
|
||||
#endregion
|
||||
|
||||
#region PRIVATE_METHODS
|
||||
## Загружает конфигурацию из JSON файла
|
||||
func _load_configuration() -> void:
|
||||
if not _ensure_config_exists():
|
||||
_is_loaded = false
|
||||
return
|
||||
|
||||
var config_file = FileAccess.open(CONFIG_PATH, FileAccess.READ)
|
||||
if config_file:
|
||||
var json_text = config_file.get_as_text()
|
||||
config_file.close()
|
||||
|
||||
var json = JSON.new()
|
||||
var parse_result = json.parse(json_text)
|
||||
if parse_result == OK:
|
||||
_config_data = json.data
|
||||
_current_version = _config_data.get("config_version", "0.0.0")
|
||||
_parse_config_data()
|
||||
_is_loaded = true
|
||||
else:
|
||||
push_error("Ошибка разбора JSON конфигурации: " + json.get_error_message())
|
||||
_is_loaded = false
|
||||
else:
|
||||
push_error("Ошибка загрузки файла конфигурации: " + CONFIG_PATH)
|
||||
_is_loaded = false
|
||||
|
||||
|
||||
## Парсит данные конфигурации по секциям
|
||||
func _parse_config_data() -> void:
|
||||
_device_constants = _convert_numbers(_config_data.get("device_constants", {}))
|
||||
_base_configs = _convert_numbers(_config_data.get("base_configs", {}))
|
||||
_device_configs = _convert_numbers(_config_data.get("device_configs", {}))
|
||||
_data_indices = _convert_numbers(_config_data.get("data_indices", {}))
|
||||
_fs_keys = _convert_numbers(_config_data.get("fs_keys", {}))
|
||||
_temperature_constants = _convert_numbers(_config_data.get("temperature_constants", {}))
|
||||
_ems_input_bits_config = _convert_numbers(_config_data.get("ems_input_bits_config", {}))
|
||||
_fs_rules = _convert_numbers(_config_data.get("fs_rules", []))
|
||||
|
||||
|
||||
## Конвертирует числовые значения в правильные типы (float -> int если возможно)
|
||||
static func _convert_numbers(value):
|
||||
if value is float:
|
||||
# Конвертируем float в int если нет дробной части
|
||||
if value == int(value):
|
||||
return int(value)
|
||||
return value
|
||||
elif value is Dictionary:
|
||||
var result = {}
|
||||
for key in value:
|
||||
result[key] = _convert_numbers(value[key])
|
||||
return result
|
||||
elif value is Array:
|
||||
var result = []
|
||||
for item in value:
|
||||
result.append(_convert_numbers(item))
|
||||
return result
|
||||
else:
|
||||
return value
|
||||
|
||||
|
||||
## Обеспечивает существование файла конфигурации
|
||||
## Создает папку и копирует дефолтный файл если нужно
|
||||
func _ensure_config_exists() -> bool:
|
||||
# Создаем папку конфигурации если не существует
|
||||
DirAccess.make_dir_recursive_absolute("user://config")
|
||||
|
||||
# Проверяем, нужно ли обновить конфигурацию
|
||||
if _should_update_config():
|
||||
return _update_config()
|
||||
|
||||
# Если файл уже существует - все ок
|
||||
if FileAccess.file_exists(CONFIG_PATH):
|
||||
return true
|
||||
|
||||
# Если дефолтного файла нет - ошибка
|
||||
if not FileAccess.file_exists(DEFAULT_CONFIG_PATH):
|
||||
return false
|
||||
|
||||
# Копируем дефолтный конфиг в user директорию
|
||||
return _copy_default_config()
|
||||
|
||||
|
||||
## Проверяет, нужно ли обновить конфигурацию
|
||||
func _should_update_config() -> bool:
|
||||
# Если файла конфигурации нет - нужно создать
|
||||
if not FileAccess.file_exists(CONFIG_PATH):
|
||||
return true
|
||||
|
||||
# Проверяем версию существующей конфигурации
|
||||
var config_file = FileAccess.open(CONFIG_PATH, FileAccess.READ)
|
||||
if config_file:
|
||||
var json_text = config_file.get_as_text()
|
||||
config_file.close()
|
||||
|
||||
var json = JSON.new()
|
||||
if json.parse(json_text) == OK:
|
||||
var existing_version = json.data.get("config_version", "0.0.0")
|
||||
# Сравниваем версии
|
||||
return _compare_versions(existing_version, CONFIG_VERSION) < 0
|
||||
else:
|
||||
# Если ошибка парсинга - нужно обновить
|
||||
return true
|
||||
|
||||
return false
|
||||
|
||||
|
||||
## Сравнивает две версии (semantic versioning)
|
||||
## Возвращает -1 если version1 < version2, 0 если равны, 1 если version1 > version2
|
||||
static func _compare_versions(version1: String, version2: String) -> int:
|
||||
var v1_parts = version1.split(".")
|
||||
var v2_parts = version2.split(".")
|
||||
|
||||
for i in range(max(v1_parts.size(), v2_parts.size())):
|
||||
var v1_part = int(v1_parts[i]) if i < v1_parts.size() else 0
|
||||
var v2_part = int(v2_parts[i]) if i < v2_parts.size() else 0
|
||||
|
||||
if v1_part < v2_part:
|
||||
return -1
|
||||
elif v1_part > v2_part:
|
||||
return 1
|
||||
|
||||
return 0
|
||||
|
||||
|
||||
## Обновляет конфигурацию до актуальной версии
|
||||
func _update_config() -> bool:
|
||||
# Создаем резервную копию старой конфигурации
|
||||
if FileAccess.file_exists(CONFIG_PATH):
|
||||
var backup_path = CONFIG_PATH + ".backup_v" + _current_version
|
||||
DirAccess.copy_absolute(CONFIG_PATH, backup_path)
|
||||
print("Создана резервная копия: ", backup_path)
|
||||
|
||||
# Копируем актуальную конфигурацию
|
||||
return _copy_default_config()
|
||||
|
||||
|
||||
## Копирует дефолтную конфигурацию в user директорию
|
||||
func _copy_default_config() -> bool:
|
||||
if not FileAccess.file_exists(DEFAULT_CONFIG_PATH):
|
||||
push_error("Дефолтный файл конфигурации не найден: " + DEFAULT_CONFIG_PATH)
|
||||
return false
|
||||
|
||||
var src := FileAccess.open(DEFAULT_CONFIG_PATH, FileAccess.READ)
|
||||
var dst := FileAccess.open(CONFIG_PATH, FileAccess.WRITE)
|
||||
if src == null or dst == null:
|
||||
push_error("Ошибка копирования конфигурации")
|
||||
return false
|
||||
|
||||
dst.store_string(src.get_as_text())
|
||||
src.close()
|
||||
dst.close()
|
||||
return true
|
||||
#endregion
|
||||
1
scripts/prd-ctl-config.gd.uid
Normal file
1
scripts/prd-ctl-config.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bi7elq60squds
|
||||
101
scripts/prd.gd
101
scripts/prd.gd
@@ -105,8 +105,8 @@ class Fs:
|
||||
[10, 20],
|
||||
[20, 30],
|
||||
[30, 40],
|
||||
[40, 50],
|
||||
[50, 55]]
|
||||
[40, 90],
|
||||
[90, 100]]
|
||||
|
||||
var index ## Индекс блока усилителей
|
||||
var modulation: bool ## Состояние модуляции
|
||||
@@ -151,22 +151,33 @@ class Fs:
|
||||
|
||||
|
||||
class PRD:
|
||||
enum STATE_DEVICE {
|
||||
NONE,
|
||||
GOOD,
|
||||
ERROR
|
||||
}
|
||||
var prd_name: String ## Имя прибора
|
||||
var unit_yau07 ## Юнит эмс
|
||||
var unit_yau07: Object ## Юнит эмс
|
||||
var unit_control: Object ## Класс проверки прибора ПРД
|
||||
var fs_dic: Dictionary ## Массив блоков ФС
|
||||
var yemsg_board: yemsboards.EmsBoard ## Плата ЭМС-Г
|
||||
var state = PrdState.WORK
|
||||
var cmd_array: Array ## Очередь команд
|
||||
var ug_online: bool = false ## Состояние ячейки УГ
|
||||
var serviceability: bool = false
|
||||
var set_ug_state: bool = true ## Необходимо ли записать в УГ настройки
|
||||
signal update_serviceability()
|
||||
signal update_serviceability(state: int) ## Сообщает изменение текущего состояния юнита ПРД
|
||||
var serviceability: int:
|
||||
set(v):
|
||||
if v != serviceability:
|
||||
serviceability = v
|
||||
emit_signal('update_serviceability', v)
|
||||
|
||||
func _init(u_name, u_yau07):
|
||||
prd_name = u_name
|
||||
unit_yau07 = u_yau07
|
||||
init_ems_g()
|
||||
|
||||
|
||||
func init_ems_g():
|
||||
var in_tbl: Array = []
|
||||
var out_tbl: Array = []
|
||||
@@ -199,11 +210,11 @@ class PRD:
|
||||
|
||||
|
||||
func on_line_changed(unit_ems):
|
||||
emit_signal('update_serviceability')
|
||||
if not unit_ems.online:
|
||||
yemsg_board.ems_load = yemsg_board.LoadState.NOT_DEFINED
|
||||
yemsg_board.set_wait()
|
||||
set_ug_state = true
|
||||
serviceability = STATE_DEVICE.NONE
|
||||
|
||||
func on_data_received(_u):
|
||||
set_prd_status()
|
||||
@@ -221,18 +232,76 @@ class PRD:
|
||||
return
|
||||
execute_cmd()
|
||||
|
||||
func set_prd_status():
|
||||
## Мониторинг состояния юнита прд
|
||||
func set_prd_status() -> void:
|
||||
# Обновление статуса платы ЯУ-07
|
||||
yemsg_board.set_status(unit_yau07.status)
|
||||
|
||||
# Проверка онлайн-статусов основных модулей
|
||||
ug_online = (unit_yau07.status[0] >> 1) & 1
|
||||
if not ug_online:
|
||||
set_ug_state = true
|
||||
var ukp_1_online = (unit_yau07.status[0] >> 2) & 1
|
||||
var ukp_2_online = (unit_yau07.status[0] >> 3) & 1
|
||||
var ems_g_online = (unit_yau07.status[0] & 1) & 1
|
||||
var check_serviceability = ug_online and ukp_1_online and ukp_2_online and ems_g_online
|
||||
if serviceability != check_serviceability:
|
||||
serviceability = check_serviceability
|
||||
emit_signal('update_serviceability')
|
||||
var ems_g_online = (unit_yau07.status[0] & 1) & 1
|
||||
|
||||
# Установка флага состояния УГ
|
||||
if not ug_online:
|
||||
set_ug_state = true
|
||||
|
||||
# Проверка источников питания
|
||||
var ip_online: bool = _check_dry_contact(unit_yau07.status, prd_name)
|
||||
var check_temperature_um: bool = unit_control.flags.temperature_ok
|
||||
var check_dic: Dictionary = {
|
||||
'ukp_1_online': ukp_1_online,
|
||||
'ukp_2_online': ukp_2_online,
|
||||
'ems_g_online': ems_g_online,
|
||||
'ip_online': ip_online,
|
||||
'ug_online': ug_online,
|
||||
'temperature_um': check_temperature_um
|
||||
}
|
||||
# Определение состояния обслуживания
|
||||
if unit_control:
|
||||
if unit_control.flags.control_is_over:
|
||||
serviceability = _set_serviceability_from_control_results(unit_control)
|
||||
else:
|
||||
serviceability = _set_serviceability_from_online_status(check_dic)
|
||||
|
||||
## Проверка онлайн-статуса сухих контактов
|
||||
static func _check_dry_contact(unit_yau07_status: PackedByteArray, self_name: String) -> bool:
|
||||
var bit_ip_config: Array = [0, 1, 2, 3, 4, 5, 6, 7]
|
||||
var is_k_type: bool = self_name in ['уарэп-яу07-1к', 'уарэп-яу07-2к', 'уарэп-яу07-3к', 'уарэп-яу07-4к']
|
||||
for bit in bit_ip_config:
|
||||
if not is_k_type and bit in [5, 6]: # Игнорируем биты 5 и 6 для всех приборов, кроме типа "к"
|
||||
continue
|
||||
var status: bool = unit_yau07_status[27] >> bit & 1
|
||||
if status:
|
||||
return false
|
||||
return true
|
||||
|
||||
## Установка состояния обслуживания на основе результатов контроля
|
||||
static func _set_serviceability_from_control_results(unit_ctrl: Object) -> int:
|
||||
var control_results = unit_ctrl.get_control_results()
|
||||
var result_dic = control_results.result_dic
|
||||
const CRITICAL_DEVICES: Array = [
|
||||
'fs_1', 'fs_2', 'fs_3', 'fs_4', 'fs_5', 'fs_6', 'fs_7',
|
||||
'dkm_1', 'dkm_2', 'dkm_3', 'dkm_4', 'dkm_5', 'dkm_6', 'dkm_7',
|
||||
'block_ip', 'dou_2', 'dou_3', 'dou_4', 'dou_5', 'dou_6', 'dou_7'
|
||||
]
|
||||
var all_ok: bool = true
|
||||
for device_key in CRITICAL_DEVICES:
|
||||
if result_dic.has(device_key) and result_dic[device_key] is bool:
|
||||
if not result_dic[device_key]:
|
||||
all_ok = false
|
||||
break
|
||||
return STATE_DEVICE.GOOD if all_ok else STATE_DEVICE.ERROR
|
||||
|
||||
## Установка состояния обслуживания на основе онлайн-статусов
|
||||
static func _set_serviceability_from_online_status(check_dic: Dictionary) -> int:
|
||||
var all_online: bool = true
|
||||
for status in check_dic:
|
||||
if not check_dic[status]:
|
||||
all_online = false
|
||||
break
|
||||
return STATE_DEVICE.NONE if all_online else STATE_DEVICE.ERROR
|
||||
|
||||
|
||||
func execute_cmd():
|
||||
@@ -277,12 +346,16 @@ class PRD:
|
||||
cmd_array.append([unit_yau07.CmdCode.WRITE_ISA, data_arr])
|
||||
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
check_dir()
|
||||
for prd_name in PRD_NAMES:
|
||||
var unit_prd = network.get_unit_instance(prd_name)
|
||||
var new_prd = PRD.new(prd_name, unit_prd)
|
||||
prd_dict[prd_name] = new_prd
|
||||
var unit_control = TestPRD.new({'unit_prd': unit_prd}, new_prd.cmd_array)
|
||||
add_child(unit_control)
|
||||
new_prd.unit_control = unit_control
|
||||
for key in FS_PRD.keys():
|
||||
var fs = Fs.new(key, FS_PRD[key][0])
|
||||
fs_dict[key] = fs
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -182,6 +182,11 @@ signal kb_pressed(state)
|
||||
signal ems2_hide_pressed(state)
|
||||
|
||||
|
||||
## Вызывается при нажатии на кнопку отладки контроля
|
||||
## [param state] - состояние показа отладки контроля
|
||||
signal debag_control_pressed(state)
|
||||
|
||||
|
||||
## Вызывается при нажатии на кнопку экранной клавиатуры
|
||||
## [param state] - состояние скрытия кнопки ЭМС2
|
||||
signal emit_changed(state)
|
||||
@@ -216,6 +221,10 @@ signal sector_klaster (new_sector_data)
|
||||
signal clear_klaster ()
|
||||
|
||||
|
||||
## Вызывается при нажатии на кнопку "Запуск контроля".[br]
|
||||
signal start_contol_device()
|
||||
|
||||
|
||||
## Вызывается при программном отключении помехи.[br]
|
||||
## [param ecm] - выключаемая помеха ([b]true[/b]
|
||||
signal on_prog_ecm_off(ecm: interfer.Interfer)
|
||||
|
||||
@@ -269,8 +269,6 @@ class Trassa extends unit.Unit:
|
||||
tx_stack[65] = 0
|
||||
for ecm in ecms.values():
|
||||
if ecm.krp == "srni1" and ecm.svk == 1:
|
||||
ecm.krp = interfer.INTERFER_OFF
|
||||
interfer.send_ecm(ecm, unit_caps)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
if jtids == 1:
|
||||
tx_stack[66] = 1
|
||||
@@ -279,6 +277,4 @@ class Trassa extends unit.Unit:
|
||||
tx_stack[66] = 0
|
||||
for ecm in ecms.values():
|
||||
if ecm.krp == 'svi1' and ecm.svk == 1:
|
||||
ecm.krp = interfer.INTERFER_OFF
|
||||
interfer.send_ecm(ecm, unit_caps)
|
||||
signaller.emit_signal('interfer_off', ecm)
|
||||
|
||||
@@ -303,24 +303,24 @@ class YaU07 extends unit.Unit:
|
||||
if cmd_result != 1: # Команда не выполнена
|
||||
return false
|
||||
|
||||
var cmd_code: CmdCode = rx_data[cmd_code_pos] as CmdCode # "код команды"
|
||||
var rc: = true
|
||||
if (cmd_code == CmdCode.READ_ISA) or (cmd_code == CmdCode.WRITE_ISA):
|
||||
rc = parse_isa(rx_data, status_len)
|
||||
var cmd_code: int = rx_data[cmd_code_pos] # Код команды
|
||||
|
||||
elif (cmd_code == CmdCode.READ_BLOCK) or (cmd_code == CmdCode.WRITE_BLOCK):
|
||||
rc = parse_block(rx_data, status_len)
|
||||
if (cmd_state == CmdState.WAIT) and (cmd_num_rx == cmd_num_tx) and (cmd_code == cmd_code_tx):
|
||||
cmd_code_rx = cmd_code
|
||||
cmd_state = CmdState.DONE
|
||||
var rc: = true
|
||||
if (cmd_code == CmdCode.READ_ISA) or (cmd_code == CmdCode.WRITE_ISA):
|
||||
rc = parse_isa(rx_data, status_len)
|
||||
elif (cmd_code == CmdCode.READ_BLOCK) or (cmd_code == CmdCode.WRITE_BLOCK):
|
||||
rc = parse_block(rx_data, status_len)
|
||||
elif (cmd_code == CmdCode.ERASE_FLASH) or (cmd_code == CmdCode.WRITE_FLASH) \
|
||||
or (cmd_code == CmdCode.READ_FLASH_MP550) or (cmd_code == CmdCode.WRITE_FLASH_MP550) \
|
||||
or (cmd_code == CmdCode.READ_FLASH) or (cmd_code == CmdCode.LOAD_FLASH):
|
||||
rc = parse_flash(rx_data, status_len, cmd_code)
|
||||
|
||||
elif (cmd_code == CmdCode.ERASE_FLASH) or (cmd_code == CmdCode.WRITE_FLASH) \
|
||||
or (cmd_code == CmdCode.READ_FLASH_MP550) or (cmd_code == CmdCode.WRITE_FLASH_MP550) \
|
||||
or (cmd_code == CmdCode.READ_FLASH) or (cmd_code == CmdCode.LOAD_FLASH):
|
||||
rc = parse_flash(rx_data, status_len, cmd_code)
|
||||
|
||||
if rc:
|
||||
if (cmd_state == CmdState.WAIT) and (cmd_num_rx == cmd_num_tx):
|
||||
cmd_state = CmdState.DONE
|
||||
cmd_code_rx = cmd_code
|
||||
if rc:
|
||||
emit_signal('command_done', self)
|
||||
else:
|
||||
emit_signal('parse_failed', self)
|
||||
else:
|
||||
emit_signal('parse_failed', self)
|
||||
|
||||
return true
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[gd_scene load_steps=2 format=3 uid="uid://pd3fcx55duj2"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bw3yv3smvaxqn" path="res://table/nine-patch.png" id="1_ik10p"]
|
||||
[ext_resource type="Texture2D" uid="uid://vqajxsh5xamt" path="res://data/nine-patch.png" id="1_ik10p"]
|
||||
|
||||
[node name="NinePatchRect" type="NinePatchRect"]
|
||||
offset_right = 17.0
|
||||
|
||||
@@ -281,7 +281,7 @@ func check_event_pos(event_pos: Vector2, obj: Control):
|
||||
|
||||
|
||||
##
|
||||
func setselector_color_proc(instance: Object, function: String) -> void:
|
||||
func set_selector_color_proc(instance: Object, function: String) -> void:
|
||||
selector_color_proc = Callable(instance, function)
|
||||
_assert(selector_color_proc.is_valid())
|
||||
|
||||
@@ -322,7 +322,6 @@ func _set_row_selected(i_row: int, selected: bool = true) -> void:
|
||||
push_error('нет такого ряда: %d (всего %d рядов)\n' % [i_row, rows_count])
|
||||
return
|
||||
if nodes.has(selector_key) and (not selected):
|
||||
var node = nodes[node_key]
|
||||
var selector = nodes[selector_key]
|
||||
nodes.erase(selector_key)
|
||||
if is_instance_valid(selector):
|
||||
@@ -392,13 +391,17 @@ func add_row(row_types: Array) -> void:
|
||||
add_child(node)
|
||||
if allow_set_size:
|
||||
node.custom_minimum_size.x = columns_min_size[i_col]
|
||||
node.size.x = columns_min_size[i_col]
|
||||
node.set_deferred('size', Vector2(columns_min_size[i_col], node.size.y))
|
||||
nodes[node_key] = node
|
||||
var conn = Callable(self, '_on_focus_entered').bind(node)
|
||||
node.connect('focus_entered', conn)
|
||||
set_node_meta(i_col, i_row, 'callable_focus_entered', conn)
|
||||
|
||||
|
||||
func _set_size_x_defered(node: Control, val: Vector2):
|
||||
node.size = val
|
||||
|
||||
|
||||
##
|
||||
func _on_focus_entered(node):
|
||||
var indexes = get_key_indexes(node.name)
|
||||
@@ -450,9 +453,11 @@ func remove_row(i_row: int):
|
||||
|
||||
if nodes.has(sel_key):
|
||||
var selector = nodes[sel_key]
|
||||
var prnt = selector.get_parent()
|
||||
prnt.remove_child(selector)
|
||||
selector.queue_free()
|
||||
if is_instance_valid(selector):
|
||||
var prnt = selector.get_parent()
|
||||
if prnt:
|
||||
prnt.remove_child(selector)
|
||||
selector.queue_free()
|
||||
nodes.erase(sel_key)
|
||||
|
||||
for i_col in columns:
|
||||
|
||||
8
table/ячейка-цвет.tscn
Normal file
8
table/ячейка-цвет.tscn
Normal file
@@ -0,0 +1,8 @@
|
||||
[gd_scene format=3 uid="uid://cug5xjbfdm7x7"]
|
||||
|
||||
[node name="ячейка-цвет" type="ColorPickerButton"]
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
Reference in New Issue
Block a user