Актуальная версия 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

@@ -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: