From b7359c5fabc20d903c497c2d6a07d82967207a90 Mon Sep 17 00:00:00 2001 From: QAMuser Date: Wed, 9 Oct 2024 11:58:03 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9E=D1=82=D0=BB=D0=B0=D0=B4=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=81=D1=82=D0=B0=D0=BD=D1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Main.gd | 16 +++++++++++----- constants.gd | 8 ++++---- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/Main.gd b/Main.gd index 8cdf4e0..6f0bbd5 100644 --- a/Main.gd +++ b/Main.gd @@ -94,7 +94,15 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник var rx_data = sock.get_packet() var addr_receive = sock.get_packet_ip() var port_receive = sock.get_packet_port() - $BROADCAST.text = 'BROADCAST: ' + str(rx_data) + if rx_data: + $BROADCAST.text = 'BROADCAST: ' + str(rx_data) + var line_yau07_control = node_select.get_node2(0, 0) + line_yau07_control.text = ' ЯУ-07Б НА СВЯЗИ' + line_yau07_control.modulate = Color(0, 1, 0, 1) + else: + var line_yau07_control = node_select.get_node2(0, 0) + line_yau07_control.text = ' НЕТ СВЯЗИ С ЯУ-07' + line_yau07_control.modulate = Color(1, 0, 0, 1) if (address == addr_receive) and (port == port_receive): unit.parse(rx_data) return false @@ -128,12 +136,10 @@ func on_timer() -> void: func on_line_changed(_unit) -> void: print_debug() if unit.online: - var line_yau07_control = node_select.get_node2(0, 0) - line_yau07_control.text = ' ЯУ-07Б НА СВЯЗИ' + var line_yau07_control = node_select.get_node2(0, 1) line_yau07_control.modulate = Color(0, 1, 0, 1) else: - var line_yau07_control = node_select.get_node2(0, 0) - line_yau07_control.text = ' НЕТ СВЯЗИ С ЯУ-07' + var line_yau07_control = node_select.get_node2(0, 1) line_yau07_control.modulate = Color(1, 0, 0, 1) var light_interval = node_select.get_node2(1, 2) light_interval.modulate = Color(0.5, 0.5, 0.5, 1) diff --git a/constants.gd b/constants.gd index 478ac7d..8d89341 100644 --- a/constants.gd +++ b/constants.gd @@ -2,11 +2,11 @@ extends Node const TableNode = preload("res://table/node.tscn") var file = FileAccess.open("user://constants.txt", FileAccess.READ) const UNICAST_PORT: int = 50003 -const UNICAST_ADDRESS: String = '10.1.1.3' +const UNICAST_ADDRESS: String = '10.1.1.14' const BROADCAST_PORT: int = 50000 -var DEFAULT_ADDRESS: String = file.get_line() -var DEFAULT_PORT: String = file.get_line() -var BASE_ADDR: int = int(file.get_line()) +var DEFAULT_ADDRESS: String = file.get_line() if file else '10.1.1.70' +var DEFAULT_PORT: String = file.get_line() if file else '50070' +var BASE_ADDR: int = int(file.get_line()) if file else 0x100 const ROWS_REGS_DATA: Array = [ [TableNode, TableNode, TableNode, TableNode, TableNode], [TableNode, TableNode, TableNode, TableNode, TableNode],