WIP Исправление. Рассинхрон данных во время работы контроля.

This commit is contained in:
Maxim
2025-12-15 14:09:00 +03:00
parent c9304134ca
commit a8e7a1c6aa
6 changed files with 17 additions and 19 deletions

View File

@@ -654,7 +654,7 @@ func get_krp(threat: threats.Threat):
if not ecm_params.has('files'): continue
if typeof(ecm_params['files']) == TYPE_DICTIONARY:
for value in ecm_params['files'].values():
if typeof(value) == TYPE_STRING:
if typeof(value) == TYPE_STRING:
if value == threat.rparams['filename']:
krp = key
return krp

View File

@@ -290,7 +290,7 @@ func _process(_delta: float) -> void:
func on_data_received(unit_pribor: Object) -> void:
var status: PackedByteArray = unit_pribor.status
if status.size() < 100: push_error('Принимаемые значения от ЯУ-07б:%s не коррентны. (размер пакета: %d)' % [self_name, status.size()]); return
temperature_um = check_temperature_um(status)
flags.temperature_ok = check_overheating(temperature_um)
block_ip_config = check_block_ip(status, block_ip_config)
@@ -1140,7 +1140,7 @@ static func _create_fs_mapping(s_name: String) -> Dictionary:
## Получение статуса ФС
static func on_fs_state(packet_type_7: Dictionary, fs_mapping: Dictionary, fs_results: Dictionary, fs_rules_config: Array) -> Dictionary:
var updated_results := fs_results.duplicate()
var updated_results := fs_results
for fs_num in packet_type_7:
if not (fs_num in fs_mapping and fs_mapping[fs_num]['condition']):
continue
@@ -1209,19 +1209,19 @@ static func power_um_ukp(status: PackedByteArray, litera: int, pwr_result: Array
static func update_max_power_values(power_data: Array, max_power_values: Array) -> Array:
if power_data.size() != 6:
if max_power_values.is_empty():
max_power_values = power_data.duplicate()
max_power_values = power_data
elif power_data[0] > max_power_values[0]:
max_power_values = power_data.duplicate()
max_power_values = power_data
return max_power_values
if max_power_values.is_empty():
max_power_values = power_data.duplicate()
max_power_values = power_data
else:
for i in 6:
if power_data[i] > max_power_values[i]:
max_power_values[i] = power_data[i]
return max_power_values.duplicate()
return max_power_values
## Подготовка принятых данных по контролю для передачи в сцену
@@ -1322,7 +1322,7 @@ func _deep_copy_power_structure() -> Dictionary:
for litera in power_for_litera:
copy[litera] = {}
for ray_type in power_for_litera[litera]:
copy[litera][ray_type] = power_for_litera[litera][ray_type].duplicate()
copy[litera][ray_type] = power_for_litera[litera][ray_type]
return copy
## Восстановление состояний по умолчанию

View File

@@ -72,7 +72,7 @@ func _ready() -> void:
signaller.connect('rto_threat_unsel_all', Callable(self, 'on_rto_threat_unsel_all').bind(threats))
signaller.connect('threat_selected', Callable(self, 'on_threat_selected').bind(threats))
signaller.connect('interfer_init', Callable(self, 'on_interfer_init').bind(threats))
ProjectSettings.connect('settings_changed', on_settings_changed.bind(threats))