сохранение/загрузка в эмс-г на доработке

This commit is contained in:
2025-03-11 18:47:53 +03:00
parent 05143f6f45
commit 228d1dfd19
12 changed files with 257 additions and 220 deletions

View File

@@ -79,7 +79,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
return false
func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: String):
func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: String): ## Приемник ФС
client.poll()
var peer = peerstream.get_stream_peer()
# Проверяем, существует ли соединение
@@ -87,18 +87,11 @@ func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: Strin
emit_signal("port_error", ip_fs)
return
# Проверяем состояние подключения
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
emit_signal("port_fs_closed", ip_fs)
return
# Проверяем состояние подключения
#if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
#if client == client_fs_1:
#emit_signal("port_fs_closed", ip_fs)
#elif client == client_fs_2:
#emit_signal("port_fs_closed", ip_fs)
#elif client == client_fs_3:
#emit_signal("port_fs_closed", ip_fs)
#return
while peer.get_available_bytes() > 0:
var rx_data: PackedByteArray
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
@@ -136,7 +129,6 @@ func _ready() -> void:
set_config()
func set_config():
write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CI_2_B_UF)
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
@@ -151,13 +143,13 @@ func set_config():
connect_fs_1()
connect_fs_2()
connect_fs_3()
start_work_fs()
start_work_fs_2()
start_work_fs_3()
start_work_fs_1(Constants.ADDRESSES[0][0])
start_work_fs_2(Constants.ADDRESSES[0][0])
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
start_work_fs_3(Constants.ADDRESSES[0][0])
func _process(delta: float) -> void:
last_update_time_yau07 += delta
last_update_time_fs += delta
@@ -197,9 +189,10 @@ func state_machine_yau07():
## Режим записи в ИСА
Constants.STATE.WRITE_ISA:
if fl_done:
var ports_write = send_array.pop_front()
var key = ports_write[1].keys()
unit.send_isa(unit.CmdCode.WRITE_ISA, [key[0], ports_write[1][key[0]]])
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]]])
state = Constants.STATE.WAIT
Constants.STATE.DONE:
if fl_done:
@@ -278,7 +271,7 @@ func connect_fs_1():
peerstream_fs_1.set_stream_peer(client_fs_1)
func start_work_fs():
func start_work_fs_1(currecnt_mode_att):
counter_fs_1 = 0
unit_fs.start_session(counter_fs_1, client_fs_1)
counter_fs_1 += 1
@@ -292,11 +285,13 @@ func start_work_fs():
var set_freq = Constants.FS_FREQ.f2 if Constants.CURRENT_MODE == Constants.MODE.PRD_H else Constants.FS_FREQ.f4 if Constants.CURRENT_MODE == Constants.MODE.PRD_B else Constants.FS_FREQ.f6
unit_fs.set_carrier(set_freq * 1_000_000, counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.set_att_batch(Constants.FS_ATT.att_1_prd_H1, counter_fs_1, client_fs_1)
unit_fs.set_att_batch(Constants.FS_ATT[currecnt_mode_att][0], counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.set_base_can_macro(set_freq, counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.get_att_batch(counter_fs_1, client_fs_1)
counter_fs_1 += 1
unit_fs.get_carrier(counter_fs_1, client_fs_1)
@@ -379,7 +374,7 @@ func connect_fs_2():
peerstream_fs_2.set_stream_peer(client_fs_2)
func start_work_fs_2():
func start_work_fs_2(currecnt_mode_att):
counter_fs_2 = 0
unit_fs.start_session(counter_fs_2, client_fs_2)
counter_fs_2 += 1
@@ -395,7 +390,8 @@ func start_work_fs_2():
var set_freq = Constants.FS_FREQ.f3 if Constants.CURRENT_MODE == Constants.MODE.PRD_H else Constants.FS_FREQ.f5 if Constants.CURRENT_MODE == Constants.MODE.PRD_B else Constants.FS_FREQ.f7
unit_fs.set_carrier(set_freq * 1_000_000, counter_fs_2, client_fs_2)
counter_fs_2 += 1
unit_fs.set_att_batch(Constants.FS_ATT.att_2_prd_H1, counter_fs_2, client_fs_2)
unit_fs.set_att_batch(Constants.FS_ATT[currecnt_mode_att][1], counter_fs_2, client_fs_2)
counter_fs_2 += 1
unit_fs.set_base_can_macro(set_freq, counter_fs_2, client_fs_2)
counter_fs_2 += 1
@@ -486,7 +482,7 @@ func connect_fs_3():
peerstream_fs_3.set_stream_peer(client_fs_3)
func start_work_fs_3():
func start_work_fs_3(currecnt_mode_att):
counter_fs_3 = 0
unit_fs.start_session(counter_fs_3, client_fs_3)
counter_fs_3 += 1
@@ -500,8 +496,10 @@ func start_work_fs_3():
var set_freq = Constants.FS_FREQ.f1
unit_fs.set_carrier(set_freq * 1_000_000, counter_fs_3, client_fs_3)
counter_fs_3 += 1
unit_fs.set_att_batch(Constants.FS_ATT.att_3_prd_K1, counter_fs_3, client_fs_3)
unit_fs.set_att_batch(Constants.FS_ATT[currecnt_mode_att][2], counter_fs_3, client_fs_3)
counter_fs_3 += 1
unit_fs.set_base_can_macro(set_freq, counter_fs_3, client_fs_3)
counter_fs_3 += 1