module fs half-stable
This commit is contained in:
@@ -122,10 +122,10 @@ func _process(delta: float) -> void:
|
||||
|
||||
if client_fs_1:
|
||||
poll_receive_fs(client_fs_1, peerstream_fs_1, ip_fs_1)
|
||||
state_machine_fs()
|
||||
state_machine_fs(client_fs_1)
|
||||
if client_fs_2:
|
||||
poll_receive_fs(client_fs_2, peerstream_fs_2, ip_fs_2)
|
||||
state_machine_fs_2()
|
||||
state_machine_fs(client_fs_2)
|
||||
|
||||
poll_receive_yau07(soc_brodcast)
|
||||
poll_receive_yau07(soc_unicast)
|
||||
@@ -190,18 +190,18 @@ func on_command_change_device(meta_device):
|
||||
ip_fs_2 = meta_device[4]
|
||||
#ip_fs_3 = meta_device[5]
|
||||
connect_fs_1()
|
||||
#connect_fs_2()
|
||||
connect_fs_2()
|
||||
|
||||
|
||||
func state_machine_fs():
|
||||
func state_machine_fs(client_fs):
|
||||
## State fs machine
|
||||
if client_fs_1:
|
||||
if client_fs == client_fs_1:
|
||||
if (state_fs == Constants.STATE.IDLE) or (state_fs == Constants.STATE.DONE):
|
||||
if command_stack:
|
||||
var pack: Array = command_stack.pop_front()
|
||||
unit_fs_1.send_fs_data(pack, client_fs_1, peerstream_fs_1)
|
||||
state_fs = Constants.STATE.SEND
|
||||
if client_fs_2:
|
||||
if client_fs == client_fs_2:
|
||||
if (state_fs_2 == Constants.STATE.IDLE) or (state_fs_2 == Constants.STATE.DONE):
|
||||
if command_stack_2:
|
||||
var pack: Array = command_stack_2.pop_front()
|
||||
@@ -232,42 +232,42 @@ func disconnect_fs(client_for_leave):
|
||||
|
||||
func start_work_fs():
|
||||
counter_fs_1 = 0
|
||||
unit_fs_1.start_session(counter_fs_1)
|
||||
unit_fs_1.start_session(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.get_gen_state(counter_fs_1)
|
||||
unit_fs_1.get_gen_state(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.get_att_batch(counter_fs_1)
|
||||
unit_fs_1.get_att_batch(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.get_carrier(counter_fs_1)
|
||||
unit_fs_1.get_carrier(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1)
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func get_fs_gen_status(state_gen):
|
||||
unit_fs_1.set_gen_state(state_gen, counter_fs_1)
|
||||
unit_fs_1.set_gen_state(state_gen, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.get_gen_state(counter_fs_1)
|
||||
unit_fs_1.get_gen_state(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1)
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier(freq: int):
|
||||
unit_fs_1.set_carrier(freq, counter_fs_1)
|
||||
unit_fs_1.set_carrier(freq, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1)
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.get_carrier(counter_fs_1)
|
||||
unit_fs_1.get_carrier(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_fs_attenuation(attenuation: float):
|
||||
unit_fs_1.set_att_batch(attenuation, counter_fs_1)
|
||||
unit_fs_1.set_att_batch(attenuation, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.get_att_batch(counter_fs_1)
|
||||
unit_fs_1.get_att_batch(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1)
|
||||
unit_fs_1.base_get_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
@@ -291,45 +291,43 @@ func disconnect_fs_2(client_for_leave):
|
||||
client_for_leave.disconnect_from_host()
|
||||
state_fs_2 = Constants.STATE.IDLE
|
||||
command_stack_2 = []
|
||||
|
||||
|
||||
# Отправить команду для ФС
|
||||
func send_fs_data_2(data_to_sand: PackedByteArray):
|
||||
if client_fs_2.get_status() == 2:
|
||||
var peer = peerstream_fs_2.get_stream_peer()
|
||||
if peer:
|
||||
peer.put_data(data_to_sand)
|
||||
|
||||
|
||||
func state_machine_fs_2():
|
||||
if client_fs_2:
|
||||
## State fs_2 machine
|
||||
if (state_fs_2 == Constants.STATE.IDLE) or (state_fs_2 == Constants.STATE.DONE):
|
||||
if command_stack_2:
|
||||
var pack: Array = command_stack_2.pop_front()
|
||||
send_fs_data_2(pack)
|
||||
state_fs_2 = Constants.STATE.SEND
|
||||
func start_work_fs_2():
|
||||
counter_fs_2 = 0
|
||||
unit_fs_1.start_session(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.get_gen_state(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.get_att_batch(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.get_carrier(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
#
|
||||
func get_fs_gen_status_2(state_gen):
|
||||
unit_fs_1.set_gen_state(state_gen, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.get_gen_state(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
#
|
||||
#func start_work_fs_2():
|
||||
#unit_fs_2.start_session()
|
||||
#unit_fs_2.base_get_current_temp()
|
||||
#
|
||||
#
|
||||
#func get_fs_gen_status_2(state_gen):
|
||||
#unit_fs_2.set_gen_state(state_gen)
|
||||
#unit_fs_2.get_gen_state()
|
||||
#unit_fs_2.base_get_current_temp()
|
||||
#
|
||||
#
|
||||
#func set_fs_ferq_carrier_2(freq: int):
|
||||
#unit_fs_2.set_carrier(freq)
|
||||
#unit_fs_2.base_get_current_temp()
|
||||
#unit_fs_2.get_carrier()
|
||||
#
|
||||
#
|
||||
#func set_fs_attenuation_2(attenuation: float):
|
||||
#unit_fs_2.set_att_batch(attenuation)
|
||||
#unit_fs_2.get_att_batch()
|
||||
#unit_fs_2.base_get_current_temp()
|
||||
func set_fs_ferq_carrier_2(freq: int):
|
||||
unit_fs_1.set_carrier(freq, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.get_carrier(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
func set_fs_attenuation_2(attenuation: float):
|
||||
unit_fs_1.set_att_batch(attenuation, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.get_att_batch(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs_1.base_get_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
Reference in New Issue
Block a user