Отладка контроля, загрузки ЭМС-Г, состояния ЯУ-07

This commit is contained in:
Maxim
2025-05-27 09:57:39 +03:00
parent eba949f5d4
commit eb36856831
10 changed files with 267 additions and 147 deletions

View File

@@ -26,6 +26,7 @@ var save_path = "res://saves/"
const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
var current_meta: Array = [Constants.META.MODUL_UM_1, Constants.META.MODUL_UM_2, Constants.META.MODUL_UM_3, Constants.META.MODUL_UM_28]
var modul_um: Array = [0, 0, 0, 0]
var receive_yau_counter: Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
func _ready() -> void:
@@ -223,7 +224,7 @@ func _ready() -> void:
Network.connect('yau_receive', Callable(self, '_on_data_received'))
Network.connect('yau_read_isa', Callable(self, '_on_read_isa'))
Network.connect('port_fs_opened', _on_port_changed.bind(Color.AQUAMARINE))
Network.connect('port_fs_closed', _on_port_changed.bind(Color.CRIMSON))
Network.connect('port_fs_closed', _on_port_changed.bind(Color.DARK_GRAY))
Network.connect('data_from_fs_1', _on_data_fs_1)
Network.connect('data_from_fs_2', _on_data_fs_2)
Network.connect('data_from_fs_3', _on_data_fs_3)
@@ -321,16 +322,32 @@ func add_signs_scene():
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
# Список статусов ячеек ЯУ-07б
func _on_yau_status(addr: String):
if addr != '':
for check in Constants.ADDRESSES:
if check[1] == addr:
$TabContainer/PRD/status_yau.modulate = Color.AQUAMARINE
$TabContainer/PRD/status_yau.text = 'ЯУ-07Б: ' + check[0]
else:
$TabContainer/PRD/status_yau.modulate = Color.CRIMSON
$TabContainer/PRD/status_yau.text = 'ЯУ-07Б: нет связи'
var count_packets_await: int = 10
var status_yau_list = $TabContainer/PRD/status_yau_list.get_children()
var status_label = $TabContainer/PRD/status_yau
if addr.is_empty():
# Сброс состояния, если адрес пуст (нет связи)
for label in status_yau_list:
label.text = ''
status_label.modulate = Color.CRIMSON
status_label.text = 'ЯУ-07Б: нет связи'
modul_um = [0, 0, 0, 0]
return
status_label.text = '' # Убираем статус, если есть сигнал от ЯУ-07Б
# Обновляем счетчики
for i in Constants.ADDRESSES.size():
var address_match = (Constants.ADDRESSES[i][1] == addr)
receive_yau_counter[i] = 0 if address_match else (receive_yau_counter[i] + 1) & 0xFFF
# Обновляем статусы элементов
for i in status_yau_list.size():
var label = status_yau_list[i]
var address_info = Constants.ADDRESSES[i]
label.text = address_info[0]
label.modulate = Color.AQUAMARINE if receive_yau_counter[i] < count_packets_await else Color.DARK_GRAY # Если счетчик >= count_packets_await, помечаем серым, иначе — аквамарином
func _on_read_isa(unit_isa_ports: Dictionary) -> void: