Доработка. Режим Контроль. Больше времени для получения ответа от АФСП

This commit is contained in:
sasha80
2025-10-02 16:16:33 +03:00
parent a903dae55d
commit a76ec7f1b0
6 changed files with 10 additions and 8 deletions

View File

@@ -31,11 +31,11 @@ interfer/select_color=Vector3(1, 1, 1)
interfer/interfer_color=Vector3(0.58, 0.47, 0.51)
interfer/resend_timeout=1000.0
config/external_cu=false
config/unit_rr_request_period=20.0
config/unit_rr_request_period=30.0
config/kems_files_path="user://kems/"
config/emsg_files_path="user://emsg/"
config/settings_path="user://settings.json"
config/unit_bpo_request_period=20.0
config/unit_bpo_request_period=30.0
[autoload]

View File

@@ -7,7 +7,7 @@
[sub_resource type="GDScript" id="GDScript_yhnwg"]
script/source = "extends Timer
func _ready(): wait_time = ProjectSettings.get_setting('application/config/unit_rr_request_period')
func _ready(): wait_time = ProjectSettings.get_setting('application/config/unit_bpo_request_period')
"
[node name="pribor_afsp" type="Control"]
@@ -29,7 +29,7 @@ projsettings_path_left = "application/config/Адрес АФСП левого б
projsettings_path_right = "application/config/Адрес АФСП правого борта"
[node name="timer" type="Timer" parent="request"]
wait_time = 20.0
wait_time = 30.0
autostart = true
script = SubResource("GDScript_yhnwg")

View File

@@ -29,6 +29,7 @@ projsettings_path_left = "application/config/Адрес АФСП левого б
projsettings_path_right = "application/config/Адрес АФСП правого борта"
[node name="timer" type="Timer" parent="request"]
wait_time = 30.0
autostart = true
script = SubResource("GDScript_yhnwg")

View File

@@ -7,6 +7,7 @@ class_name pribor_afsp extends 'res://scenes/контроль/прибор.gd'
static var json_conv: JSON = JSON.new()
static var node_maper = load('res://scenes/контроль/node-maper.gd')
# SystemName: "gen" DevList - там состояние связи с генератором по кан шине
func _on_request_completed(result, _response_code, headers, body: PackedByteArray):
@@ -50,7 +51,7 @@ func _on_request_completed(result, _response_code, headers, body: PackedByteArra
var received_afsp_name: StringName = ret_val[0]
if this_afsp_name != received_afsp_name:
push_error('не известное устройство: \"%s\"' % received_afsp_name)
push_error('не известное устройство: \"%s\", ожидадось: \"%s\"' % [received_afsp_name, this_afsp_name])
return
if not unit_instance.online:

View File

@@ -198,13 +198,14 @@ self_size = Vector2i(50, 145)
fname = "Яч. связи"
[node name="request" type="HTTPRequest" parent="."]
use_threads = true
script = ExtResource("4_crej3")
projsettings_path_left = "application/config/Адрес БПО левого борта"
projsettings_path_right = "application/config/Адрес БПО правого борта"
projsettings_path_wait_time = "application/config/Период опроса состояния БПО, секунды"
[node name="timer" type="Timer" parent="request"]
wait_time = 5.0
wait_time = 30.0
autostart = true
script = SubResource("GDScript_bhc4e")

View File

@@ -64,11 +64,10 @@ func _ready():
func _on_request_timer():
cancel_request()
var addr = [addr_right, addr_left][i_bort]
var hdrs = [headers_right, headers_left][i_bort]
var rc: = request(addr, hdrs)
if rc != Error.OK:
var s: String = '%s: %s' % [error_string(rc), addr]
log.error('%s' % s)
i_bort = (i_bort + 1) % 2
i_bort = (i_bort + 1) % 2