Актуальная версия PRD_TU_MP550, что на полигоне

This commit is contained in:
TotMaxim
2025-11-09 16:49:16 +03:00
parent e202a21162
commit 8a87cc70f6
13 changed files with 5138 additions and 56 deletions

View File

@@ -139,7 +139,9 @@ class ClientFs extends Node:
emit_signal("data_fs", data[1])
if not command_stack.is_empty() and command_done:
send_fs_data()
if _status == _stream.STATUS_CONNECTED:
send_fs_data()
func connect_to_host(host: String, port: int) -> void:
print('Connect to %s:%s' % [host, port])

View File

@@ -151,6 +151,11 @@ func _ready() -> void:
node_select_yau_07b.get_node2(1, 3).add_item(key)
node_select_yau_07b_2.get_node2(1, 3).add_item(key)
_setup_mouse_scroll(node_select_yau_07b.get_node2(1, 3))
_setup_mouse_scroll(node_select_yau_07b.get_node2(1, 4))
_setup_mouse_scroll(node_select_yau_07b_2.get_node2(1, 3))
_setup_mouse_scroll(node_select_yau_07b_2.get_node2(1, 4))
node_select_yau_07b_3.get_node2(1, 3).add_item(' 15°')
## Заполненение списка аттенюатора
@@ -234,7 +239,7 @@ func _ready() -> void:
Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.NONE))
Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.ERROR))
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2))
Network.unit_fs_3.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.GOOD))
Network.unit_fs_3.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.NONE))
Network.unit_fs_3.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.ERROR))
@@ -902,6 +907,7 @@ func _on_prd_select() -> void:
set_tab_and_buttons(0, 'select_prd', 'texture_prd')
Network.unit_fs_1.get_gen_state()
Network.unit_fs_2.get_gen_state()
Network.unit_fs_3.get_gen_state()
func _on_control_button() -> void:
@@ -915,8 +921,10 @@ func _on_emsg_select() -> void:
set_tab_and_buttons(2, 'select_ems_g', 'texture_ems_g')
func _on_mfs_select() -> void:
set_tab_and_buttons(3, 'select_fs', 'texture_fs')
func _on_monitoring_select() -> void:
set_tab_and_buttons(3, 'select_monitoring', 'texture_monitoring')
$load_status_yau.visible = false
# Need Disconnect to yau-07
func _on_burger_button(toggled_on: bool) -> void:
@@ -994,3 +1002,44 @@ func on_ems_block(toggled_on: bool) -> void:
timer_modul_um.start()
else:
timer_modul_um.stop()
var hovered_option_button: OptionButton = null
func _setup_mouse_scroll(option_button: OptionButton):
option_button.mouse_entered.connect(_on_option_button_mouse_entered.bind(option_button))
option_button.mouse_exited.connect(_on_option_button_mouse_exited.bind(option_button))
func _on_option_button_mouse_entered(option_button: OptionButton):
hovered_option_button = option_button
option_button.mouse_filter = Control.MOUSE_FILTER_STOP
func _on_option_button_mouse_exited(option_button: OptionButton):
if hovered_option_button == option_button:
hovered_option_button = null
option_button.mouse_filter = Control.MOUSE_FILTER_PASS
# Обработка прокрутки колеса мыши
func _input(event):
if event is InputEventMouseButton and hovered_option_button != null:
if event.pressed:
_handle_mouse_scroll(event, hovered_option_button)
func _handle_mouse_scroll(event: InputEventMouseButton, option_button: OptionButton):
var current_index = option_button.selected
var item_count = option_button.get_item_count()
var new_index = current_index
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
new_index = wrapi(current_index - 1, 0, item_count)
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
new_index = wrapi(current_index + 1, 0, item_count)
else:
return
# Устанавливаем новый индекс
option_button.selected = new_index
# Вручную испускаем сигнал
option_button.emit_signal("item_selected", new_index)
get_viewport().set_input_as_handled()

View File

@@ -1,6 +1,6 @@
extends Node
var UNICAST_PORT: int = 50002
var UNICAST_ADDRESS: String = '10.1.1.2'
var UNICAST_PORT: int = 50003
var UNICAST_ADDRESS: String = '10.1.1.3'
const BROADCAST_PORT: int = 50000
const DEFAULT_ADDRESS: String = '10.1.1.11'
const DEFAULT_PORT: String = '50011'
@@ -427,10 +427,15 @@ var FS_ATT: Dictionary = {
func _ready() -> void:
# Считывание аргументов с консоли (путь сохранения)
var args = OS.get_cmdline_user_args()
for i in range(args.size()):
if args[i] == "addr" and i + 1 < args.size():
UNICAST_PORT = 50000 + int(args[i + 1])
UNICAST_ADDRESS = '10.1.1.%s' % args[i + 1]
var i = 0
while i < args.size():
if args[i] == "--addr" or args[i] == "-a":
if i + 1 < args.size():
var addr_suffix: int = int(args[i + 1])
UNICAST_PORT = 50000 + addr_suffix
UNICAST_ADDRESS = '10.1.1.%s' % addr_suffix
i += 1 # Пропускаем следующий аргумент
i += 1
read_file()

View File

@@ -28,7 +28,7 @@ var flag_continue_control: bool = false
var prep_set_ug: int = 0
class Logger extends Node:
class Loger extends Node:
var log_level: String = "INFO"
var log_array: Node
@@ -430,7 +430,7 @@ func _on_start_super_control():
$lbl_control.text = 'Контроль запущен'
$lbl_control.modulate = Color.LIGHT_GRAY
$log_array/await.visible = true
logger = Logger.new(get_node('log_array'))
logger = Loger.new(get_node('log_array'))
flag_continue_control = true
if (past_pribor != Constants.CURRENT_MODE):

View File

@@ -38,7 +38,7 @@ signal port_error(error_str: String)
class Socket extends PacketPeerUDP:
func send_to(addr: String, port: int, data: PackedByteArray):
self.set_dest_address(addr, port)
self.put_packet(data)
var _rc = self.put_packet(data)
func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
@@ -47,6 +47,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
broadcast_packet = sock.get_packet()
var addr_receive = sock.get_packet_ip()
var port_receive = sock.get_packet_port()
print('addr_receive: ', addr_receive)
if (ip_address_yau == addr_receive) and (ip_port_yau == port_receive):
last_update_time_yau07 = 0.0
unit.parse(broadcast_packet)
@@ -105,8 +106,9 @@ func _process(delta: float) -> void:
state_machine_yau07()
match unit.process(delta):
Error.OK: soc_unicast.send_to(ip_address_yau, ip_port_yau, unit.tx_data.slice(0, unit.tx_len))
var rc = unit.process(delta)
if rc == Error.OK:
soc_unicast.send_to(ip_address_yau, ip_port_yau, unit.tx_data.slice(0, unit.tx_len))
#Error.FAILED: print_debug('Ошибка отправки данных')
@@ -121,7 +123,7 @@ func state_machine_yau07():
Constants.STATE.READ_ISA:
if fl_done:
var ports_read = send_array.pop_front()
unit.send_isa(unit.CmdCode.READ_ISA, ports_read[1])
var _rc = unit.send_isa(unit.CmdCode.READ_ISA, ports_read[1])
state = Constants.STATE.DONE
## Режим записи в ИСА
Constants.STATE.WRITE_ISA:
@@ -129,7 +131,7 @@ func state_machine_yau07():
var ports_write: Array = send_array.pop_front()
if ports_write[0] == 'wr':
var key = ports_write[1].keys()
unit.send_isa(unit.CmdCode.WRITE_ISA, [key[0], ports_write[1][key[0]]])
var _rc = unit.send_isa(unit.CmdCode.WRITE_ISA, [key[0], ports_write[1][key[0]]])
state = Constants.STATE.WAIT
Constants.STATE.DONE:
if fl_done:
@@ -164,18 +166,18 @@ func on_command_change_device(meta_device: Array):
if unit_fs_2._stream:
unit_fs_2.disconnect_fs()
unit_fs_2.connect_to_host(meta_device[4], Constants.PORT_FS)
if meta_device[5] != '':
if unit_fs_3._stream:
unit_fs_3.disconnect_fs()
unit_fs_3.connect_to_host(meta_device[5], Constants.PORT_FS)
await get_tree().create_timer(0.1).timeout
setup_fs(unit_fs_1, meta_device)
setup_fs(unit_fs_2, meta_device)
if meta_device[5] != '':
setup_fs(unit_fs_3, meta_device)
func setup_fs(unit_fs: Node, meta_device: Array) -> void: