Отладка индикации подключения

This commit is contained in:
2024-10-09 13:47:01 +03:00
parent b7359c5fab
commit 5aacc4f2dc
3 changed files with 32 additions and 26 deletions

35
Main.gd
View File

@@ -58,7 +58,7 @@ func _ready():
# Поле для ввода (базовый порт)
var edit_addr = node_select.get_node2(0, 2)
edit_addr.editable = true
edit_addr.placeholder_text = ' 0x%x' % port_select
edit_addr.text = '%x' % port_select
edit_addr.connect('text_submitted', Callable(self, '_on_written_addres'))
# Поле для ввода (интервал непрерывной записи)
@@ -98,13 +98,14 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник
$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):
line_yau07_control.modulate = Constants.GREEN
if (address == addr_receive) and (port == port_receive) and flag_online:
unit.parse(rx_data)
var line_board_control = node_select.get_node2(0, 1)
line_board_control.modulate = Constants.GREEN
else:
var line_board_control = node_select.get_node2(0, 1)
line_board_control.modulate = Constants.RED
return false
@@ -134,15 +135,17 @@ func on_timer() -> void:
func on_line_changed(_unit) -> void:
print_debug()
if unit.online:
var line_yau07_control = node_select.get_node2(0, 1)
line_yau07_control.modulate = Color(0, 1, 0, 1)
var line_yau07_control = node_select.get_node2(0, 0)
line_yau07_control.modulate = Constants.GREEN
else:
var line_yau07_control = node_select.get_node2(0, 1)
line_yau07_control.modulate = Color(1, 0, 0, 1)
var line_yau07_control = node_select.get_node2(0, 0)
line_yau07_control.modulate = Constants.RED
var light_interval = node_select.get_node2(1, 2)
light_interval.modulate = Color(0.5, 0.5, 0.5, 1)
var line_board_control = node_select.get_node2(0, 1)
line_board_control.modulate = Constants.RED
$Turn_on.button_pressed = false
flag_online = false
flag_interval = false
@@ -162,7 +165,7 @@ func on_command_done(_unit) -> void:
$ISA.text = 'ISA: ' + str(isa)
$ISA.modulate = Color(1, 1, 1, 1)
else:
$ISA.modulate = Color(1, 0, 0, 1)
$ISA.modulate = Constants.RED
func state_machine() -> void:
@@ -209,7 +212,7 @@ func _on_written_interval(write_interval) -> void:
timer.start(float(write_interval))
flag_interval = true
var light_interval = node_select.get_node2(1, 2)
light_interval.modulate = Color(0, 1, 0, 1)
light_interval.modulate = Constants.GREEN
## Подключение
@@ -223,6 +226,8 @@ func _on_button_pressed(turn_on) -> void:
else:
flag_online = false
flag_interval = false
var light_interval = node_select.get_node2(1, 2)
light_interval.modulate = Color(1,1,1,1)
func _on_button_read() -> void:
@@ -241,5 +246,5 @@ func save_settings():
if file:
file.store_line(address) # Сохранить IP-адрес
file.store_line(str(port)) # Сохранить порт
file.store_line(str(port_select)) # Сохранить базовый адрес
file.store_line(str(port_select)) # Сохранить базовый адрес
file.close()