Доработка. В процессе. Разделить прибор РТР на два АФСП
This commit is contained in:
BIN
data/СПТ.png
BIN
data/СПТ.png
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 1.6 KiB |
@@ -34,8 +34,8 @@ config/mod_bus_driver_port="48000"
|
||||
config/mod_bus_driver_address="localhost"
|
||||
interfer/resend_timeout=1000.0
|
||||
config/external_cu=false
|
||||
config/unit_rr_left_bort="http://127.0.0.1:8080/reports/left_SelfTestReport.json"
|
||||
config/unit_rr_right_bort="http://127.0.0.1:8080/reports/right_SelfTestReport.json"
|
||||
config/unit_afsp_left_bort="http://127.0.0.1:8080/reports/left_SelfTestReport.json"
|
||||
config/unit_afsp_right_bort="http://127.0.0.1:8080/reports/right_SelfTestReport.json"
|
||||
config/unit_rr_request_period=5.0
|
||||
config/kems_files_path="user://kems/"
|
||||
config/emsg_files_path="user://emsg/"
|
||||
@@ -119,10 +119,10 @@ folder_colors={
|
||||
"res://scenes/frame/": "blue",
|
||||
"res://scenes/grid-buttons-ecm/": "blue",
|
||||
"res://scenes/grid-side-panel/": "blue",
|
||||
"res://scenes/pribor-afsp/": "purple",
|
||||
"res://scenes/pribor-prd-k/": "purple",
|
||||
"res://scenes/pribor-prd-n/": "purple",
|
||||
"res://scenes/pribor-prd-v/": "purple",
|
||||
"res://scenes/pribor-rtr/": "purple",
|
||||
"res://scenes/pribor-uf/": "purple",
|
||||
"res://scenes/pribor-uyep/": "purple",
|
||||
"res://scenes/tabs-switch/": "blue",
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
class_name pribor_rtr extends 'res://scenes/контроль/прибор.gd'
|
||||
class_name pribor_afsp extends 'res://scenes/контроль/прибор.gd'
|
||||
|
||||
@export var prefix_path: String = ''
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
[gd_scene load_steps=5 format=3 uid="uid://5uv1idl3lqet"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://d0jwv5opi3mrl" path="res://scenes/pribor-rtr/pribor-rtr.gd" id="1_sqyma"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnxq870xf6pkh" path="res://scenes/pribor-rtr/bort-rtr.tscn" id="3_tig5m"]
|
||||
[ext_resource type="Script" uid="uid://bux47vkw71w1t" path="res://scenes/pribor-rtr/request-rtr.gd" id="6_iwtoo"]
|
||||
[ext_resource type="Script" uid="uid://d0jwv5opi3mrl" path="res://scenes/pribor-afsp/pribor-afsp.gd" id="1_f33d3"]
|
||||
[ext_resource type="Script" uid="uid://bux47vkw71w1t" path="res://scenes/контроль/request.gd" id="2_0b8u2"]
|
||||
[ext_resource type="PackedScene" uid="uid://dnxq870xf6pkh" path="res://scenes/pribor-afsp/bort-afsp.tscn" id="3_6rjuf"]
|
||||
|
||||
[sub_resource type="GDScript" id="GDScript_yhnwg"]
|
||||
script/source = "extends Timer
|
||||
@@ -18,7 +18,7 @@ offset_top = 78.0
|
||||
offset_right = 10.0
|
||||
offset_bottom = 78.0
|
||||
scale = Vector2(0.9, 0.9)
|
||||
script = ExtResource("1_sqyma")
|
||||
script = ExtResource("1_f33d3")
|
||||
|
||||
[node name="lbl_header" type="Label" parent="."]
|
||||
layout_mode = 0
|
||||
@@ -31,18 +31,18 @@ horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="request_rtr" type="HTTPRequest" parent="."]
|
||||
script = ExtResource("6_iwtoo")
|
||||
script = ExtResource("2_0b8u2")
|
||||
|
||||
[node name="timer" type="Timer" parent="request_rtr"]
|
||||
wait_time = 4.168
|
||||
autostart = true
|
||||
script = SubResource("GDScript_yhnwg")
|
||||
|
||||
[node name="left" parent="." instance=ExtResource("3_tig5m")]
|
||||
[node name="left" parent="." instance=ExtResource("3_6rjuf")]
|
||||
scale = Vector2(0.9, 0.9)
|
||||
metadata/DeviceName = &"Устройство РР левого борта"
|
||||
|
||||
[node name="right" parent="." instance=ExtResource("3_tig5m")]
|
||||
[node name="right" parent="." instance=ExtResource("3_6rjuf")]
|
||||
offset_left = 522.0
|
||||
offset_right = 1102.0
|
||||
scale = Vector2(0.9, 0.9)
|
||||
@@ -1,41 +0,0 @@
|
||||
extends HTTPRequest
|
||||
|
||||
|
||||
const RESULT_STRINGS = {
|
||||
RESULT_SUCCESS: 'Request successful',
|
||||
RESULT_CHUNKED_BODY_SIZE_MISMATCH: 'Chunked body size mismatch',
|
||||
RESULT_CANT_CONNECT: 'Request failed while connecting',
|
||||
RESULT_CANT_RESOLVE: 'Request failed while resolving',
|
||||
RESULT_CONNECTION_ERROR: 'Request failed due to connection (read/write) error',
|
||||
RESULT_TLS_HANDSHAKE_ERROR: 'Request failed on TLS handshake',
|
||||
RESULT_NO_RESPONSE: 'Request does not have a response (yet)',
|
||||
RESULT_BODY_SIZE_LIMIT_EXCEEDED: 'Request exceeded its maximum size limit, see body_size_limit',
|
||||
RESULT_BODY_DECOMPRESS_FAILED: 'Body decompress failed',
|
||||
RESULT_REQUEST_FAILED: 'Request failed (currently unused)',
|
||||
RESULT_DOWNLOAD_FILE_CANT_OPEN: 'HTTPRequest couldn\'t open the download file',
|
||||
RESULT_DOWNLOAD_FILE_WRITE_ERROR: 'HTTPRequest couldn\'t write to the download file',
|
||||
RESULT_REDIRECT_LIMIT_REACHED: 'Request reached its maximum redirect limit, see max_redirects',
|
||||
RESULT_TIMEOUT: 'Timeout' }
|
||||
|
||||
|
||||
var i_bort: int = 0
|
||||
var addr_left: String
|
||||
var addr_right: String
|
||||
|
||||
|
||||
func get_result_string(result: Result):
|
||||
return RESULT_STRINGS[result] if RESULT_STRINGS.has(result) else '<неизвестный код результата HTTPRequest - %d>' % result
|
||||
|
||||
|
||||
func _ready():
|
||||
addr_left = ProjectSettings.get_setting('application/config/unit_rr_left_bort')
|
||||
addr_right = ProjectSettings.get_setting('application/config/unit_rr_right_bort')
|
||||
|
||||
|
||||
func _on_request_timer():
|
||||
var addr = [addr_left, addr_right][i_bort]
|
||||
var rc = request(addr)
|
||||
if rc != Error.OK:
|
||||
var s: String = '%s: %s' % [error_string(rc), addr]
|
||||
log.error('ошибка: %s' % s)
|
||||
i_bort = (i_bort + 1) % 2
|
||||
42
scenes/контроль/request.gd
Normal file
42
scenes/контроль/request.gd
Normal file
@@ -0,0 +1,42 @@
|
||||
extends HTTPRequest
|
||||
|
||||
## Для приборов АФСП и РТР
|
||||
|
||||
const RESULT_STRINGS = {
|
||||
RESULT_SUCCESS: 'Запрос успешен',
|
||||
RESULT_CHUNKED_BODY_SIZE_MISMATCH: 'Несоответствие размеров частей сообщения',
|
||||
RESULT_CANT_CONNECT: 'Запрос не выполнен при подключении',
|
||||
RESULT_CANT_RESOLVE: 'Запрос не выполнен при разрешении',
|
||||
RESULT_CONNECTION_ERROR: 'Запрос не выполнен из-за ошибки соединения (чтения/записи)',
|
||||
RESULT_TLS_HANDSHAKE_ERROR: 'Запрос не выполнен на TLS рукопожатии',
|
||||
RESULT_NO_RESPONSE: 'Запрос не имеет ответа (пока)',
|
||||
RESULT_BODY_SIZE_LIMIT_EXCEEDED: 'Запрос превысил максимальный размер, см. `body_size_limit`',
|
||||
RESULT_BODY_DECOMPRESS_FAILED: 'Не удалось распаковать сообщение',
|
||||
RESULT_REQUEST_FAILED: 'Запрос не удался (в настоящее время не используется)',
|
||||
RESULT_DOWNLOAD_FILE_CANT_OPEN: 'Невозможно открыть файл загрузки',
|
||||
RESULT_DOWNLOAD_FILE_WRITE_ERROR: 'Невозможно записать в файл загрузки',
|
||||
RESULT_REDIRECT_LIMIT_REACHED: 'Запрос достиг максимального предела перенаправления, см. `max_redirects`',
|
||||
RESULT_TIMEOUT: 'Время истекло' }
|
||||
|
||||
|
||||
var i_bort: int = 0
|
||||
var addr_left: String
|
||||
var addr_right: String
|
||||
|
||||
|
||||
func get_result_string(result: Result):
|
||||
return RESULT_STRINGS[result] if RESULT_STRINGS.has(result) else '<неизвестный код результата HTTPRequest - %d>' % result
|
||||
|
||||
|
||||
func _ready():
|
||||
addr_left = ProjectSettings.get_setting('application/config/unit_afsp_left_bort')
|
||||
addr_right = ProjectSettings.get_setting('application/config/unit_afsp_right_bort')
|
||||
|
||||
|
||||
func _on_request_timer():
|
||||
var addr = [addr_left, addr_right][i_bort]
|
||||
var rc = request(addr)
|
||||
if rc != Error.OK:
|
||||
var s: String = '%s: %s' % [error_string(rc), addr]
|
||||
log.error('ошибка: %s' % s)
|
||||
i_bort = (i_bort + 1) % 2
|
||||
@@ -19,6 +19,8 @@ const PRIBORS_RES = \
|
||||
'pribor_prd_v_3': ['res://scenes/pribor-prd-v/pribor-prd-v.tscn', 'Контроль исправности прибора ПРД-В 3'],
|
||||
'pribor_prd_v_4': ['res://scenes/pribor-prd-v/pribor-prd-v.tscn', 'Контроль исправности прибора ПРД-В 4'],
|
||||
'pribor_rtr': ['res://scenes/pribor-rtr/pribor-rtr.tscn', 'Контроль исправности прибора РТР'],
|
||||
'pribor_afsp_1': ['res://scenes/pribor-afsp/pribor-afsp.tscn', 'Контроль исправности прибора АФСП 1'],
|
||||
'pribor_afsp_2': ['res://scenes/pribor-afsp/pribor-afsp.tscn', 'Контроль исправности прибора АФСП 2'],
|
||||
'pribor_uf': ['res://scenes/pribor-uf/pribor-uf.tscn', 'Контроль исправности прибора УФ'],
|
||||
'pribor_uyep': ['res://scenes/pribor-uyep/pribor-uyep.tscn', 'Контроль исправности устройства У-ЭП'],
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=15 format=3 uid="uid://lwmw4egynmd1"]
|
||||
[gd_scene load_steps=16 format=3 uid="uid://lwmw4egynmd1"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://b0wcp76bbl2jx" path="res://scenes/контроль/контроль.gd" id="1_x5d6w"]
|
||||
[ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"]
|
||||
@@ -11,6 +11,7 @@
|
||||
[ext_resource type="Texture2D" uid="uid://c6nve6f8sfyj2" path="res://data/состояние-исправности-0.png" id="7_6j01w"]
|
||||
[ext_resource type="Texture2D" uid="uid://u3tnejvpm8it" path="res://data/disconnect-a.png" id="8_gs2be"]
|
||||
[ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="8_isjua"]
|
||||
[ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="9_iqgf5"]
|
||||
[ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="9_ll0vs"]
|
||||
[ext_resource type="Script" uid="uid://bncy1x53jp73d" path="res://scenes/контроль/connect_pribor.gd" id="11_u7tym"]
|
||||
|
||||
@@ -41,9 +42,9 @@ metadata/_edit_lock_ = true
|
||||
editor_description = "Кнопка для выбора прибора."
|
||||
layout_mode = 0
|
||||
offset_left = 1194.0
|
||||
offset_top = 500.0
|
||||
offset_top = 473.0
|
||||
offset_right = 1305.0
|
||||
offset_bottom = 685.0
|
||||
offset_bottom = 658.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
toggle_mode = true
|
||||
@@ -92,9 +93,9 @@ script = ExtResource("11_u7tym")
|
||||
[node name="pribor_rtr" type="TextureButton" parent="." groups=["pribor_buttons"]]
|
||||
editor_description = "Кнопка для выбора прибора."
|
||||
layout_mode = 0
|
||||
offset_left = 992.0
|
||||
offset_left = 1198.0
|
||||
offset_top = 264.0
|
||||
offset_right = 1504.0
|
||||
offset_right = 1304.0
|
||||
offset_bottom = 420.0
|
||||
pivot_offset = Vector2(-10, -65)
|
||||
size_flags_horizontal = 15
|
||||
@@ -106,43 +107,13 @@ stretch_mode = 0
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)]
|
||||
|
||||
[node name="label" type="Label" parent="pribor_rtr"]
|
||||
layout_mode = 0
|
||||
offset_left = 217.0
|
||||
offset_top = -53.0
|
||||
offset_right = 300.0
|
||||
offset_bottom = -34.0
|
||||
text = "РТР"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="label-l" type="Label" parent="pribor_rtr"]
|
||||
layout_mode = 0
|
||||
offset_left = 47.0
|
||||
offset_top = -18.0
|
||||
offset_right = 130.0
|
||||
offset_bottom = 1.0
|
||||
text = "АФСП левый"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="label-r" type="Label" parent="pribor_rtr"]
|
||||
layout_mode = 0
|
||||
offset_left = 377.0
|
||||
offset_top = -18.0
|
||||
offset_right = 460.0
|
||||
offset_bottom = 1.0
|
||||
text = "АФСП правый"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="frame" type="NinePatchRect" parent="pribor_rtr"]
|
||||
visible = false
|
||||
self_modulate = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
layout_mode = 0
|
||||
offset_left = -17.0
|
||||
offset_top = -69.0
|
||||
offset_right = 528.0
|
||||
offset_left = -13.0
|
||||
offset_top = -34.0
|
||||
offset_right = 117.0
|
||||
offset_bottom = 171.0
|
||||
texture = ExtResource("4_rasbe")
|
||||
region_rect = Rect2(-3, -3, 89, 89)
|
||||
@@ -151,22 +122,141 @@ patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
|
||||
[node name="label" type="Label" parent="pribor_rtr"]
|
||||
layout_mode = 0
|
||||
offset_left = 12.0
|
||||
offset_top = -54.0
|
||||
offset_right = 95.0
|
||||
offset_bottom = -35.0
|
||||
text = "РТР"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"]
|
||||
modulate = Color(0.498039, 0.498039, 0.498039, 1)
|
||||
light_mask = 3
|
||||
position = Vector2(259, -20)
|
||||
position = Vector2(55, -15)
|
||||
scale = Vector2(0.615385, 0.625)
|
||||
sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="pribor_afsp_1" type="TextureButton" parent="." groups=["pribor_buttons"]]
|
||||
editor_description = "Кнопка для выбора прибора."
|
||||
layout_mode = 0
|
||||
offset_left = 980.0
|
||||
offset_top = 330.0
|
||||
offset_right = 1813.0
|
||||
offset_bottom = 970.0
|
||||
scale = Vector2(0.2, 0.2)
|
||||
pivot_offset = Vector2(-10, -65)
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
toggle_mode = true
|
||||
action_mode = 0
|
||||
texture_normal = ExtResource("9_iqgf5")
|
||||
stretch_mode = 0
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)]
|
||||
|
||||
[node name="frame" type="NinePatchRect" parent="pribor_afsp_1"]
|
||||
visible = false
|
||||
self_modulate = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
layout_mode = 0
|
||||
offset_left = -60.0
|
||||
offset_top = -165.0
|
||||
offset_right = 130.0
|
||||
offset_bottom = 10.0
|
||||
scale = Vector2(5, 5)
|
||||
texture = ExtResource("4_rasbe")
|
||||
region_rect = Rect2(-3, -3, 89, 89)
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
|
||||
[node name="label" type="Label" parent="pribor_afsp_1"]
|
||||
layout_mode = 0
|
||||
offset_left = 165.0
|
||||
offset_top = -245.0
|
||||
offset_right = 262.0
|
||||
offset_bottom = -225.0
|
||||
scale = Vector2(5, 5)
|
||||
text = "АФСП правый"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_1"]
|
||||
modulate = Color(0.498039, 0.498039, 0.498039, 1)
|
||||
light_mask = 3
|
||||
position = Vector2(415, -40)
|
||||
scale = Vector2(3.07692, 3.125)
|
||||
sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="pribor_afsp_2" type="TextureButton" parent="." groups=["pribor_buttons"]]
|
||||
editor_description = "Кнопка для выбора прибора."
|
||||
layout_mode = 0
|
||||
offset_left = 1368.0
|
||||
offset_top = 330.0
|
||||
offset_right = 2201.0
|
||||
offset_bottom = 970.0
|
||||
scale = Vector2(0.2, 0.2)
|
||||
pivot_offset = Vector2(-10, -65)
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
toggle_mode = true
|
||||
action_mode = 0
|
||||
texture_normal = ExtResource("9_iqgf5")
|
||||
stretch_mode = 0
|
||||
flip_h = true
|
||||
script = ExtResource("3_4pt7j")
|
||||
state_colors = [Color(1, 1, 1, 1), Color(0, 0.87, 0, 1), Color(0.65, 0.0715, 0.0715, 1)]
|
||||
|
||||
[node name="frame" type="NinePatchRect" parent="pribor_afsp_2"]
|
||||
visible = false
|
||||
self_modulate = Color(0.890196, 0.486275, 0.196078, 1)
|
||||
layout_mode = 0
|
||||
offset_left = -50.0
|
||||
offset_top = -165.0
|
||||
offset_right = 140.0
|
||||
offset_bottom = 10.0
|
||||
scale = Vector2(5, 5)
|
||||
texture = ExtResource("4_rasbe")
|
||||
region_rect = Rect2(-3, -3, 89, 89)
|
||||
patch_margin_left = 16
|
||||
patch_margin_top = 16
|
||||
patch_margin_right = 16
|
||||
patch_margin_bottom = 16
|
||||
|
||||
[node name="label" type="Label" parent="pribor_afsp_2"]
|
||||
layout_mode = 0
|
||||
offset_left = 200.0
|
||||
offset_top = -240.0
|
||||
offset_right = 297.0
|
||||
offset_bottom = -220.0
|
||||
scale = Vector2(5, 5)
|
||||
text = "АФСП правый"
|
||||
horizontal_alignment = 1
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"]
|
||||
modulate = Color(0.498039, 0.498039, 0.498039, 1)
|
||||
light_mask = 3
|
||||
position = Vector2(425, -40)
|
||||
scale = Vector2(3.07692, 3.125)
|
||||
sprite_frames = SubResource("SpriteFrames_foasq")
|
||||
frame_progress = 0.72355
|
||||
script = ExtResource("11_u7tym")
|
||||
|
||||
[node name="pribor_uyep" type="TextureButton" parent="." groups=["pribor_buttons"]]
|
||||
editor_description = "Кнопка для выбора прибора."
|
||||
layout_mode = 0
|
||||
offset_left = 1201.0
|
||||
offset_top = 739.0
|
||||
offset_top = 712.0
|
||||
offset_right = 1295.0
|
||||
offset_bottom = 925.0
|
||||
offset_bottom = 898.0
|
||||
size_flags_horizontal = 15
|
||||
size_flags_vertical = 15
|
||||
toggle_mode = true
|
||||
@@ -903,6 +993,8 @@ text = "Сбой"
|
||||
|
||||
[connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_rtr" to="pribor_rtr" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_afsp_1" to="pribor_afsp_1" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_afsp_2" to="pribor_afsp_2" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_uyep" to="pribor_uyep" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_prd_v_2" to="pribor_prd_v_2" method="_on_toggled"]
|
||||
[connection signal="toggled" from="pribor_prd_n_2" to="pribor_prd_n_2" method="_on_toggled"]
|
||||
|
||||
Reference in New Issue
Block a user