Рефактор. Общий список прибор теперь использует имя прибора для индекса

(cherry picked from commit 56df30a3ba)
This commit is contained in:
sasha80
2025-08-01 13:02:13 +03:00
committed by Maxim
parent 8bc1a1547d
commit c5f193b5fd

View File

@@ -1,4 +1,5 @@
extends 'res://scenes/контроль/прибор.gd'
@tool
extends "res://scenes/контроль/прибор.gd"
const Constants: Dictionary = {
'IN_BLANK_PRD': 1,
@@ -154,12 +155,9 @@ func on_state_mashine() -> void:
func initialize_connections() -> void:
signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state').bind(fs_mapping_k))
var unit_key = settings.get_unit_key(get_meta('unit_name')[0])
var unit_prd = network.units[unit_key]
var currecnt_unit = unit_prd.name
var parts = currecnt_unit.split('-')
pribor = parts[-1]
signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state'))
var unit_name = get_meta('unit_name')[0]
var unit_prd = network.get_unit_instance(unit_name)
unit_prd.connect('data_received', Callable(self, 'on_data_received'))
unit_prd.connect('line_changed', Callable(self, 'on_line_changed'))
@@ -191,10 +189,9 @@ func _enter_tree() -> void:
func _exit_tree() -> void:
var unit_key = settings.get_unit_key(get_meta('unit_name')[0])
var unit_prd = network.units[unit_key]
var unit_name = get_meta('unit_name')[0]
var unit_prd = network.get_unit_instance(unit_name)
var prd_module = prd.prd_dict[unit_prd.name]
prd_module.cmd_array.append([unit_prd.CmdCode.WRITE_ISA, [Constants.ADDR_UG_LITERA_1, ug_work_1, Constants.ADDR_UG_LITERA_2, ug_work_2]])
@@ -455,8 +452,8 @@ func on_fs_update_state(packet_type_7: Dictionary, fs_mapping: Dictionary) -> vo
func on_ug_setting() -> void:
var unit_key = settings.get_unit_key(get_meta('unit_name')[0])
var unit_prd = network.units[unit_key]
var unit_name = get_meta('unit_name')[0]
var unit_prd = network.units[unit_name]
if unit_prd.isa_ports.has(Constants.ADDR_UG_LITERA_1):
ug_work_1 = unit_prd.isa_ports[Constants.ADDR_UG_LITERA_1]