Новый клиент от ФС
This commit is contained in:
189
scripts/FS.gd
189
scripts/FS.gd
@@ -3,9 +3,15 @@ extends Node
|
||||
const ONLINE_TIMEOUT = 5.0 ## Время ожидания пакета от ячейки, секунды
|
||||
const RETRY_COUNT = 5 ## Количество повторных отправок
|
||||
|
||||
|
||||
## Блок управления ФС
|
||||
class FGOS:
|
||||
class ClientFs extends Node:
|
||||
## Сигналы статусов
|
||||
signal connected(unit: ClientFs)
|
||||
signal data_fs(unit: ClientFs)
|
||||
signal disconnected(unit: ClientFs)
|
||||
signal error_connect(unit: ClientFs)
|
||||
signal line_changed(unit: ClientFs) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
|
||||
## Коды выполняемых команд
|
||||
enum CmdCode {
|
||||
START_SESSION = 0x0, ## Команда начала сессии
|
||||
@@ -79,11 +85,69 @@ class FGOS:
|
||||
const INIT: int = 0xFFFFFFFF
|
||||
const FINAL_XOR_VALUE: int = 0x00000000
|
||||
|
||||
signal line_changed(unit: FGOS) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
var self_name: String
|
||||
var _status: int = 0
|
||||
var _stream: StreamPeerTCP = StreamPeerTCP.new()
|
||||
var _peerstream: PacketPeer = PacketPeerStream.new()
|
||||
|
||||
var online: bool = false ## Состояние связи с ячейкой
|
||||
var command_stack: Array
|
||||
var status: = PackedByteArray() ## Поле "состояние прибора"
|
||||
#var fgos_data = {} ## Результат выполнения команды "читать порт"
|
||||
var counter: int = 0
|
||||
var online: bool = false ## Состояние связи с ФС
|
||||
|
||||
func _init(nm):
|
||||
self.self_name = nm
|
||||
|
||||
func _ready() -> void:
|
||||
_status = _stream.get_status()
|
||||
|
||||
## Основной процесс отслеживания сосотяни соединения
|
||||
func _process(_delta: float) -> void:
|
||||
if _stream.poll() != OK:
|
||||
print('Ошибка _stream.poll')
|
||||
return
|
||||
|
||||
var new_status: int = _stream.get_status()
|
||||
if new_status != _status:
|
||||
_status = new_status
|
||||
match _status:
|
||||
_stream.STATUS_NONE:
|
||||
online = false
|
||||
emit_signal("disconnected", _stream.get_connected_host())
|
||||
_stream.STATUS_CONNECTED:
|
||||
_peerstream.set_stream_peer(_stream)
|
||||
online = true
|
||||
emit_signal("connected", _stream.get_connected_host())
|
||||
_stream.STATUS_ERROR:
|
||||
print_debug("Error with socket stream.")
|
||||
online = false
|
||||
emit_signal("error_connect", _stream.get_connected_host())
|
||||
|
||||
if _status == _stream.STATUS_CONNECTED:
|
||||
var available_bytes: int = _peerstream.get_stream_peer().get_available_bytes()
|
||||
if available_bytes > 0:
|
||||
var data: Array = _stream.get_partial_data(available_bytes)
|
||||
if data[0] != OK:
|
||||
print_debug("Error getting data from stream: ", data[0])
|
||||
emit_signal("error_connect")
|
||||
else:
|
||||
#parse_data(data[1])
|
||||
emit_signal("data_fs", data[1])
|
||||
if not command_stack.is_empty():
|
||||
send_fs_data()
|
||||
|
||||
func connect_to_host(host: String, port: int) -> void:
|
||||
print('Connect to %s:%s' % [host, port])
|
||||
if _stream.get_status() == 2:
|
||||
print_debug("Already connected to host.")
|
||||
return
|
||||
|
||||
_status = _stream.STATUS_NONE
|
||||
command_stack = []
|
||||
counter = 0
|
||||
if _stream.connect_to_host(host, port) != OK:
|
||||
print_debug("Error connecting to host.")
|
||||
emit_signal("error_connect")
|
||||
|
||||
|
||||
func crc32(data: PackedByteArray) -> int:
|
||||
@@ -95,8 +159,7 @@ class FGOS:
|
||||
var final_crc = crc ^ FINAL_XOR_VALUE
|
||||
return final_crc
|
||||
|
||||
|
||||
func _form_packet(group: int, cmd: int, index_size: int, counter: int, data = null):
|
||||
func _form_packet(group: int, cmd: int, index_size: int, data = null) -> PackedByteArray:
|
||||
var packet = PackedByteArray()
|
||||
packet.resize(index_size)
|
||||
packet.encode_u8(GROUP_OFFSET, group)
|
||||
@@ -107,90 +170,81 @@ class FGOS:
|
||||
packet.encode_float(PAYLOAD_OFFSET, data)
|
||||
return packet
|
||||
|
||||
|
||||
func send_packet_to(packet: PackedByteArray, client: StreamPeer):
|
||||
func send_packet_to(packet: PackedByteArray) -> void:
|
||||
var crc = crc32(packet)
|
||||
packet.resize(packet.size() + 4)
|
||||
packet.encode_u32(packet.size() - 4, crc)
|
||||
if client == Network.client_fs_1:
|
||||
Network.command_stack_1.append(packet)
|
||||
elif client == Network.client_fs_2:
|
||||
Network.command_stack_2.append(packet)
|
||||
elif client == Network.client_fs_3:
|
||||
Network.command_stack_3.append(packet)
|
||||
online = true
|
||||
command_stack.append(packet)
|
||||
|
||||
func send_fs_data() -> bool:
|
||||
if _status != _stream.STATUS_CONNECTED:
|
||||
print("Error: Stream is not currently connected.")
|
||||
return false
|
||||
|
||||
func send_fs_data(data_to_sand: PackedByteArray, client_fs: StreamPeer, peerstream_fs: PacketPeer):
|
||||
if client_fs.get_status() == 2:
|
||||
var peer = peerstream_fs.get_stream_peer()
|
||||
if peer:
|
||||
peer.put_data(data_to_sand)
|
||||
var error: int = _stream.put_data(command_stack.pop_front())
|
||||
if error != OK:
|
||||
print("Error writing to stream: ", error)
|
||||
return false
|
||||
return true
|
||||
|
||||
# Приемник данных от ФС
|
||||
func parse_data(data_from_fs: PackedByteArray) -> void:
|
||||
print_debug('Принял пакет от ФС: %s' % data_from_fs)
|
||||
var _GRP = data_from_fs.decode_u8(0x0)
|
||||
var _CMD = data_from_fs.decode_u8(0x1)
|
||||
|
||||
func start_session(counter: int, client: StreamPeer):
|
||||
func start_session():
|
||||
command_stack = []
|
||||
counter = 0
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.START_SESSION, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
## MSK
|
||||
func set_configure_state_msk_modul_1(counter: int, client: StreamPeer):
|
||||
## MSK модуляция
|
||||
func set_configure_state_msk_modul_1() -> void:
|
||||
var index_size = 0x20
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
|
||||
packet.encode_u8(0x3, 0x09)
|
||||
packet.encode_u16(0x8, 0x0014)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func set_configure_state_msk_modul_2(counter: int, client: StreamPeer):
|
||||
var index_size = 0x20
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
|
||||
packet.encode_u8(0x3, 0x0d)
|
||||
packet.encode_u16(0x8, 0x0014)
|
||||
send_packet_to(packet, client)
|
||||
|
||||
## Constant
|
||||
func set_configure_state_msk_const_1(counter: int, client: StreamPeer):
|
||||
## Constant модуляция
|
||||
func set_configure_state_msk_const_1():
|
||||
var index_size = 0x20
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
|
||||
packet.encode_u8(0x3, 0x09)
|
||||
packet.encode_u16(0x8, 0x0014)
|
||||
packet.encode_u8(0x1C, 0x0f)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func set_gen_state(button_state: bool, counter: int, client: StreamPeer):
|
||||
func set_gen_state(button_state: bool):
|
||||
var index_size = 0x1C
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_GEN_STATUS, index_size, counter)
|
||||
packet.encode_u16(0x8, 0x0010)
|
||||
packet.encode_u32(0xC, button_state) ## MODE GEN STATUS
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func status_can_macro_exec(button_state: bool, counter: int, client: StreamPeer):
|
||||
func status_can_macro_exec(button_state: bool):
|
||||
var index_size = 0x1C
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.STATUS_CAN_MACRO, index_size, counter)
|
||||
packet.encode_u16(0x8, 0x0010)
|
||||
packet.encode_u32(0xC, button_state) ## mode can status
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func set_carrier(installation_frequency: int, counter: int, client: StreamPeer):
|
||||
func set_carrier(installation_frequency: int):
|
||||
var index_size = 0x1C
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.SET_CARRIER, index_size, counter)
|
||||
packet.encode_u16(0x8, 0x10)
|
||||
packet.encode_u64(0xC, installation_frequency) ## uint64_t freq low dword/high dword
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func set_att_batch(attenuation: float, counter: int, client: StreamPeer):
|
||||
func set_att_batch(attenuation: float):
|
||||
var index_size = 0x1C
|
||||
var packet = _form_packet(GROUP.RF, CmdCode.SET_ATT, index_size, counter)
|
||||
packet.encode_u16(0x8, 0x10)
|
||||
packet.encode_float(0x18, attenuation)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func set_base_can_macro(installation_can_frequency: int, counter: int, client: StreamPeer):
|
||||
func set_base_can_macro(installation_can_frequency: int, ):
|
||||
var index_size = 0x34
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_WRITE, index_size, counter)
|
||||
packet.encode_u16(0x08, 0x28)
|
||||
@@ -200,35 +254,28 @@ class FGOS:
|
||||
packet.encode_u16(0x20, installation_can_frequency)
|
||||
packet.encode_u16(0x28, 0x2aff)
|
||||
packet.encode_u8(0x2B, 0x04)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func get_carrier(counter: int, client: StreamPeer):
|
||||
func get_carrier():
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.READ_CARRIER, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func get_att_batch(counter: int, client: StreamPeer):
|
||||
func get_att_batch():
|
||||
var packet = _form_packet(GROUP.RF, CmdCode.READ_ATT, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func get_gen_state(counter: int, client: StreamPeer):
|
||||
func get_gen_state():
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.READ_GEN_STATUS, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func get_base_current_temp(counter: int, client: StreamPeer):
|
||||
func get_base_current_temp():
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_GET_CURRENT_TEMP, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
send_packet_to(packet)
|
||||
|
||||
|
||||
func get_base_can_macro(counter: int, client: StreamPeer):
|
||||
func get_base_can_macro():
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_READ, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
|
||||
send_packet_to(packet)
|
||||
|
||||
# Разорвать соединение с ФС
|
||||
func disconnect_fs(client_for_leave: StreamPeer):
|
||||
client_for_leave.disconnect_from_host()
|
||||
online = false
|
||||
func disconnect_fs() -> void:
|
||||
_stream.disconnect_from_host()
|
||||
|
||||
328
scripts/PRD.gd
328
scripts/PRD.gd
@@ -202,37 +202,49 @@ func _ready() -> void:
|
||||
node_select_fs_1.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_1'))
|
||||
node_select_fs_1.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_1'))
|
||||
node_select_fs_1.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs_1'))
|
||||
node_select_fs_1.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_1'))
|
||||
node_select_fs_1.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_1))
|
||||
node_select_fs_1.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro'))
|
||||
node_select_fs_1.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_1'))
|
||||
## FS 2
|
||||
node_select_fs_2.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_2'))
|
||||
node_select_fs_2.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_2'))
|
||||
node_select_fs_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs_2'))
|
||||
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_2'))
|
||||
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_2))
|
||||
node_select_fs_2.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro_2'))
|
||||
node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_2'))
|
||||
## FS 3
|
||||
node_select_fs_3.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_3'))
|
||||
node_select_fs_3.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_3'))
|
||||
node_select_fs_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs_3'))
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_3'))
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_3))
|
||||
node_select_fs_3.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro_3'))
|
||||
node_select_fs_3.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_3'))
|
||||
|
||||
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
Network.connect('yau_read_isa', Callable(self, '_on_read_isa'))
|
||||
Network.connect('port_fs_opened', _on_port_changed.bind(Color.AQUAMARINE))
|
||||
Network.connect('port_fs_closed', _on_port_changed.bind(Color.DARK_GRAY))
|
||||
Network.connect('data_from_fs_1', _on_data_fs_1)
|
||||
Network.connect('data_from_fs_2', _on_data_fs_2)
|
||||
Network.connect('data_from_fs_3', _on_data_fs_3)
|
||||
#Network.connect('port_fs_opened', _on_port_changed.bind(Color.AQUAMARINE))
|
||||
#Network.connect('port_fs_closed', _on_port_changed.bind(Color.DARK_GRAY))
|
||||
#Network.connect('data_from_fs_1', _on_data_fs_1)
|
||||
#Network.connect('data_from_fs_2', _on_data_fs_2)
|
||||
#Network.connect('data_from_fs_3', _on_data_fs_3)
|
||||
|
||||
|
||||
Network.unit_fs_1.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, true))
|
||||
Network.unit_fs_1.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, false))
|
||||
Network.unit_fs_1.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, false))
|
||||
Network.unit_fs_1.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_1))
|
||||
|
||||
Network.unit_fs_2.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, true))
|
||||
Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, false))
|
||||
Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, false))
|
||||
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2))
|
||||
|
||||
|
||||
self.add_child(timer_modul_um)
|
||||
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
|
||||
self.connect('write_ems_g_start', _on_write_ems_g)
|
||||
$Background/switch_panel/burgerButton.button_pressed = true
|
||||
$Background/switch_panel/burgerButton.set_pressed_no_signal(true)
|
||||
|
||||
|
||||
func add_signs_scene():
|
||||
@@ -324,10 +336,12 @@ func add_signs_scene():
|
||||
|
||||
# Список статусов ячеек ЯУ-07б
|
||||
func _on_yau_status(addr: String):
|
||||
var count_packets_await: int = 10
|
||||
var count_packets_await: int = 20
|
||||
var status_yau_list = $TabContainer/PRD/status_yau_list.get_children()
|
||||
var status_label = $TabContainer/PRD/status_yau
|
||||
if addr.is_empty():
|
||||
if Network.unit.online:
|
||||
return
|
||||
# Сброс состояния, если адрес пуст (нет связи)
|
||||
for label in status_yau_list:
|
||||
label.text = ''
|
||||
@@ -398,15 +412,15 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
if tmp_device_mode == Constants.META.CI_1_B_UF:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
|
||||
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1,1).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14)
|
||||
if tmp_device_mode == Constants.META.CI_2_B_UF:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14)
|
||||
if tmp_device_mode == Constants.META.CI_3_B_UF:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14)
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_1: ## Синхронизация с Модуляцией УМ лиетры 1
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
@@ -437,107 +451,137 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
if tmp_device_mode == Constants.META.FGOZ_4:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,5).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15)
|
||||
if tmp_device_mode == Constants.META.FGOZ_3:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15)
|
||||
|
||||
|
||||
## Процесс обработки данных от модулей ФС в таблице
|
||||
func _on_data_fs(fs_data: PackedByteArray, unit_fs_client: Node):
|
||||
var GRP = fs_data.decode_u8(0x0)
|
||||
var CMD = fs_data.decode_u8(0x1)
|
||||
var node_select
|
||||
var ray_node_path
|
||||
var fs_control_node_path
|
||||
|
||||
var fs_number = 1 if unit_fs_client == Network.unit_fs_1 else 2 if unit_fs_client == Network.unit_fs_2 else 3
|
||||
match fs_number:
|
||||
1:
|
||||
node_select = node_select_fs_1
|
||||
ray_node_path = $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1
|
||||
fs_control_node_path = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control
|
||||
2:
|
||||
node_select = node_select_fs_2
|
||||
ray_node_path = $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2
|
||||
fs_control_node_path = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
|
||||
3:
|
||||
pass
|
||||
|
||||
|
||||
func _on_data_fs_1(fs_1_data):
|
||||
var GRP = fs_1_data.decode_u8(0x0)
|
||||
var CMD = fs_1_data.decode_u8(0x1)
|
||||
match CMD:
|
||||
Constants.CMD.READ_CARRIER:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
freq_fs_1 = fs_1_data.decode_u64(0xC) / 1_000_000
|
||||
node_select_fs_1.set_node_text(2, 2, str(freq_fs_1) + ' МГц')
|
||||
var freq = int(fs_data.decode_u64(0xC) / 1_000_000.0)
|
||||
node_select.set_node_text(2, 2, str(freq) + ' МГц')
|
||||
match fs_number:
|
||||
1: freq_fs_1 = freq
|
||||
2: freq_fs_2 = freq
|
||||
3: freq_fs_3 = freq
|
||||
|
||||
Constants.CMD.READ_ATT:
|
||||
if GRP == Constants.GROUP.RF:
|
||||
att_fs_1 = fs_1_data.decode_float(0x18)
|
||||
node_select_fs_1.set_node_text(2, 3, str(att_fs_1) + ' dB')
|
||||
var att = fs_data.decode_float(0x18)
|
||||
node_select.set_node_text(2, 3, str(att) + ' dB')
|
||||
match fs_number:
|
||||
1: att_fs_1 = att
|
||||
2: att_fs_2 = att
|
||||
3: att_fs_3 = att
|
||||
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_1_data.decode_u32(0xC) == 0:
|
||||
node_select_fs_1.set_node_text(2, 5, 'Включен')
|
||||
node_select_fs_1.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/speed', 2.5)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 5).get_child(1).button_pressed = true
|
||||
if fs_data.decode_u32(0xC) == 0:
|
||||
node_select.set_node_text(2, 5, 'Включен')
|
||||
node_select.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
ray_node_path.material.set('shader_parameter/speed', 2.5)
|
||||
fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
|
||||
else:
|
||||
node_select_fs_1.set_node_text(2, 5, 'Отключен')
|
||||
node_select_fs_1.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/speed', 0.0)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 5).get_child(1).button_pressed = false
|
||||
node_select.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
ray_node_path.material.set('shader_parameter/speed', 0.0)
|
||||
fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
|
||||
|
||||
Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_1.set_node_text(2, 0, '%.2f' % fs_1_data.decode_float(0xC) + ' °C')
|
||||
node_select.set_node_text(2, 0, '%.2f' % fs_data.decode_float(0xC) + ' °C')
|
||||
Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_1.set_node_text(2, 7, str(fs_1_data.decode_u16(0x20)) + ' МГц')
|
||||
node_select.set_node_text(2, 7, str(fs_data.decode_u16(0x20)) + ' МГц')
|
||||
|
||||
|
||||
func _on_data_fs_2(fs_2_data):
|
||||
var GRP = fs_2_data.decode_u8(0x0)
|
||||
var CMD = fs_2_data.decode_u8(0x1)
|
||||
match CMD:
|
||||
Constants.CMD.READ_CARRIER:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000
|
||||
node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
|
||||
Constants.CMD.READ_ATT:
|
||||
if GRP == Constants.GROUP.RF:
|
||||
att_fs_2 = fs_2_data.decode_float(0x18)
|
||||
node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_2_data.decode_u32(0xC) == 0:
|
||||
node_select_fs_2.set_node_text(2, 5, 'Включен')
|
||||
node_select_fs_2.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
node_select_fs_2.get_node2(1, 5).get_child(1).button_pressed = true
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
|
||||
else:
|
||||
node_select_fs_2.set_node_text(2, 5, 'Отключен')
|
||||
node_select_fs_2.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
node_select_fs_2.get_node2(1, 5).get_child(1).button_pressed = false
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
|
||||
Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
|
||||
Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц')
|
||||
|
||||
|
||||
func _on_data_fs_3(fs_3_data):
|
||||
var GRP = fs_3_data.decode_u8(0x0)
|
||||
var CMD = fs_3_data.decode_u8(0x1)
|
||||
match CMD:
|
||||
Constants.CMD.READ_CARRIER:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
freq_fs_3 = fs_3_data.decode_u64(0xC) / 1_000_000
|
||||
node_select_fs_3.set_node_text(2, 2, str(freq_fs_3) + ' МГц')
|
||||
Constants.CMD.READ_ATT:
|
||||
if GRP == Constants.GROUP.RF:
|
||||
att_fs_3 = fs_3_data.decode_float(0x18)
|
||||
node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB')
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_3_data.decode_u32(0xC) == 0:
|
||||
node_select_fs_3.set_node_text(2, 5, 'Включен')
|
||||
node_select_fs_3.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = true
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
|
||||
else:
|
||||
node_select_fs_3.set_node_text(2, 5, 'Отключен')
|
||||
node_select_fs_3.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = false
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
|
||||
Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
|
||||
Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц')
|
||||
#func _on_data_fs_2(fs_2_data):
|
||||
#var GRP = fs_2_data.decode_u8(0x0)
|
||||
#var CMD = fs_2_data.decode_u8(0x1)
|
||||
#match CMD:
|
||||
#Constants.CMD.READ_CARRIER:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000.0
|
||||
#node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
|
||||
#Constants.CMD.READ_ATT:
|
||||
#if GRP == Constants.GROUP.RF:
|
||||
#att_fs_2 = fs_2_data.decode_float(0x18)
|
||||
#node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
|
||||
#Constants.CMD.READ_GEN_STATUS:
|
||||
#if GRP == Constants.GROUP.GENERATOR:
|
||||
#if fs_2_data.decode_u32(0xC) == 0:
|
||||
#node_select_fs_2.set_node_text(2, 5, 'Включен')
|
||||
#node_select_fs_2.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
#node_select_fs_2.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
|
||||
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
|
||||
#else:
|
||||
#node_select_fs_2.set_node_text(2, 5, 'Отключен')
|
||||
#node_select_fs_2.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
#node_select_fs_2.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
|
||||
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
|
||||
#Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
|
||||
#Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц')
|
||||
#
|
||||
#
|
||||
#func _on_data_fs_3(fs_3_data):
|
||||
#var GRP = fs_3_data.decode_u8(0x0)
|
||||
#var CMD = fs_3_data.decode_u8(0x1)
|
||||
#match CMD:
|
||||
#Constants.CMD.READ_CARRIER:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#freq_fs_3 = fs_3_data.decode_u64(0xC) / 1_000_000
|
||||
#node_select_fs_3.set_node_text(2, 2, str(freq_fs_3) + ' МГц')
|
||||
#Constants.CMD.READ_ATT:
|
||||
#if GRP == Constants.GROUP.RF:
|
||||
#att_fs_3 = fs_3_data.decode_float(0x18)
|
||||
#node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB')
|
||||
#Constants.CMD.READ_GEN_STATUS:
|
||||
#if GRP == Constants.GROUP.GENERATOR:
|
||||
#if fs_3_data.decode_u32(0xC) == 0:
|
||||
#node_select_fs_3.set_node_text(2, 5, 'Включен')
|
||||
#node_select_fs_3.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
#node_select_fs_3.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
|
||||
#$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
|
||||
#else:
|
||||
#node_select_fs_3.set_node_text(2, 5, 'Отключен')
|
||||
#node_select_fs_3.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
#node_select_fs_3.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
|
||||
#$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
|
||||
#Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
|
||||
#Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц')
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
@@ -708,10 +752,10 @@ func on_mode_select(intem_from_sector: int) -> void:
|
||||
add_signs_scene()
|
||||
Network.on_command_change_device(meta)
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+0xA])
|
||||
Network.start_work_fs_1(pribor_selec)
|
||||
Network.start_work_fs_2(pribor_selec)
|
||||
if meta[2] == Constants.MODE.PRD_K:
|
||||
Network.start_work_fs_3(pribor_selec)
|
||||
#Network.start_work_fs_1(pribor_selec)
|
||||
#Network.start_work_fs_2(pribor_selec)
|
||||
#if meta[2] == Constants.MODE.PRD_K:
|
||||
#Network.start_work_fs_3(pribor_selec)
|
||||
$load_status_yau.value = 0
|
||||
emit_signal('read_ems_g_start')
|
||||
$load_status_yau.visible = true
|
||||
@@ -862,16 +906,18 @@ func set_bits(v, a, m):
|
||||
|
||||
|
||||
## ФС Connect close
|
||||
func _on_port_changed(port_name: String, color: Color) -> void:
|
||||
if port_name == Network.ip_fs_1:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, port_name)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = color
|
||||
elif port_name == Network.ip_fs_2:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, port_name)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = color
|
||||
elif port_name == Network.ip_fs_3:
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, port_name)
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = color
|
||||
func _on_port_changed(client_addr: String, unit_fs_client: Node, status_online:bool) -> void:
|
||||
|
||||
if unit_fs_client == Network.unit_fs_1:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, client_addr)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
|
||||
elif unit_fs_client == Network.unit_fs_2:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, client_addr)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
|
||||
elif unit_fs_client == Network.unit_fs_3:
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, client_addr)
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
|
||||
|
||||
|
||||
# Установка формы сигнала (модуляция константа или msk)
|
||||
func _on_modul_fs_1(modulation_select_1) -> void:
|
||||
@@ -882,14 +928,14 @@ func _on_modul_fs_1(modulation_select_1) -> void:
|
||||
|
||||
|
||||
# Установка и получение статуса генератора фс
|
||||
func _on_get_status_1(toggled_btn):
|
||||
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
|
||||
func _on_get_status(toggled_btn: bool, unit_fs_client: Node):
|
||||
if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
|
||||
var inverted_state = not toggled_btn
|
||||
Network.set_fs_gen_status(inverted_state)
|
||||
Network.get_gen_state_1()
|
||||
unit_fs_client.set_gen_state(inverted_state)
|
||||
unit_fs_client.get_gen_state()
|
||||
|
||||
|
||||
func _on_set_ferq_1(freq: String):
|
||||
func _on_set_ferq(freq: String, unit_fs_client: Node):
|
||||
# Проверка на наличие символов в строке freq
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^[0-9]+$")
|
||||
@@ -904,12 +950,14 @@ func _on_set_ferq_1(freq: String):
|
||||
print_debug('Некорректная частота')
|
||||
return
|
||||
|
||||
Network.set_fs_ferq_carrier(freq_int)
|
||||
unit_fs_client.set_carrier(freq_int)
|
||||
unit_fs_client.get_carrier()
|
||||
|
||||
|
||||
func _on_set_att_1(att: String):
|
||||
Network.set_fs_attenuation(float(att))
|
||||
Network.unit_fs_1.set_att_batch(float(att))
|
||||
save_settings(float(att), 0)
|
||||
Network.unit_fs_1.get_att_batch()
|
||||
|
||||
|
||||
func _on_set_base_can_macro(can_freq: String):
|
||||
@@ -920,29 +968,29 @@ func _on_status_can_macro_1(toggled_btn: bool):
|
||||
Network.status_can_macro_1(toggled_btn)
|
||||
|
||||
|
||||
## 2 ФС
|
||||
func _on_get_status_2(toggled_btn):
|
||||
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
|
||||
var inverted_state = not toggled_btn
|
||||
Network.set_fs_gen_status_2(inverted_state)
|
||||
Network.get_gen_state_2()
|
||||
### 2 ФС
|
||||
#func _on_get_status_2(toggled_btn):
|
||||
#if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
|
||||
#var inverted_state = not toggled_btn
|
||||
#Network.unit_fs_2.set_gen_state(inverted_state)
|
||||
#Network.unit_fs_2.get_gen_state()
|
||||
|
||||
|
||||
func _on_set_ferq_2(freq: String):
|
||||
# Проверка на наличие символов в строке freq
|
||||
var regex = RegEx.new()
|
||||
regex.compile("^[0-9]+$")
|
||||
if not regex.search(freq):
|
||||
print_debug('Ошибка: частота должна быть числом без букв')
|
||||
return
|
||||
# Преобразование строки в число
|
||||
var freq_int = int(freq) * 1_000_000
|
||||
|
||||
# Проверка на диапазон
|
||||
if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
|
||||
print_debug('Некорректная частота')
|
||||
return
|
||||
Network.set_fs_ferq_carrier_2(freq_int)
|
||||
#func _on_set_ferq_2(freq: String):
|
||||
## Проверка на наличие символов в строке freq
|
||||
#var regex = RegEx.new()
|
||||
#regex.compile("^[0-9]+$")
|
||||
#if not regex.search(freq):
|
||||
#print_debug('Ошибка: частота должна быть числом без букв')
|
||||
#return
|
||||
## Преобразование строки в число
|
||||
#var freq_int = int(freq) * 1_000_000
|
||||
#
|
||||
## Проверка на диапазон
|
||||
#if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
|
||||
#print_debug('Некорректная частота')
|
||||
#return
|
||||
#Network.set_fs_ferq_carrier_2(freq_int)
|
||||
|
||||
|
||||
func _on_set_att_2(att: String):
|
||||
@@ -967,7 +1015,7 @@ func _on_modul_fs_2(modulation_select_2) -> void:
|
||||
|
||||
## ФС 3
|
||||
func _on_get_status_3(toggled_btn):
|
||||
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
|
||||
if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
|
||||
var inverted_state = not toggled_btn
|
||||
Network.set_fs_gen_status_3(inverted_state)
|
||||
Network.get_gen_state_3()
|
||||
@@ -1015,8 +1063,8 @@ func _on_prd_select() -> void:
|
||||
$load_status_yau.value = 0
|
||||
emit_signal('read_ems_g_start')
|
||||
set_tab_and_buttons(0, 'select_prd', 'texture_prd')
|
||||
Network.get_gen_state_1()
|
||||
Network.get_gen_state_2()
|
||||
Network.unit_fs_1.get_gen_state()
|
||||
Network.unit_fs_2.get_gen_state()
|
||||
|
||||
|
||||
func _on_control_button() -> void:
|
||||
@@ -1076,7 +1124,7 @@ func set_tab_and_buttons(tab_index: int, button_name: String, txt_button_name: S
|
||||
for button in switch_panel.get_children():
|
||||
if button is Button or TextureButton:
|
||||
if button.name != 'burgerButton':
|
||||
button.button_pressed = (button.name == button_name or button.name == txt_button_name)
|
||||
button.set_pressed_no_signal(button.name == button_name or button.name == txt_button_name)
|
||||
if button.name == 'select_control' or button.name == 'texture_control':
|
||||
if button_name == 'select_control' or button_name == 'texture_control':
|
||||
$load_status_yau.visible = false
|
||||
|
||||
@@ -1,130 +0,0 @@
|
||||
extends Node
|
||||
|
||||
const INDEX_SIZE = 0xC
|
||||
var unit_fs_1 = Fs.FGOS.new()
|
||||
var counter: int = 0
|
||||
var client_fs_1: StreamPeer
|
||||
var ip_fs_1: String = Constants.ADDRESSES[0][4]
|
||||
var peerstream_fs_1: PacketPeer
|
||||
var state_fs = Constants.STATE.IDLE
|
||||
var command_stack: Array
|
||||
var counter_fs_1: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
# Подключится к модулю ФС
|
||||
func connect_fs_1():
|
||||
if client_fs_1:
|
||||
unit_fs_1.disconnect_fs(client_fs_1)
|
||||
state_fs = Constants.STATE.IDLE
|
||||
command_stack = []
|
||||
|
||||
client_fs_1 = StreamPeerTCP.new()
|
||||
peerstream_fs_1 = PacketPeerStream.new()
|
||||
var rc = client_fs_1.connect_to_host(ip_fs_1, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_1)
|
||||
else:
|
||||
peerstream_fs_1.set_stream_peer(client_fs_1)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if client_fs_1:
|
||||
poll_receive_fs(client_fs_1, peerstream_fs_1, ip_fs_1)
|
||||
state_machine_fs(client_fs_1)
|
||||
|
||||
|
||||
func state_machine_fs(client_fs):
|
||||
## State fs machine
|
||||
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
|
||||
|
||||
|
||||
func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: String):
|
||||
client.poll()
|
||||
var peer = peerstream.get_stream_peer()
|
||||
# Проверяем, существует ли соединение
|
||||
if not peer:
|
||||
emit_signal("port_error", ip_fs)
|
||||
return
|
||||
# Проверяем состояние подключения
|
||||
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
|
||||
if client == client_fs_1:
|
||||
emit_signal("port_fs_closed_1", ip_fs)
|
||||
return
|
||||
|
||||
if peer.get_available_bytes() > 0:
|
||||
var rx_data: PackedByteArray
|
||||
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
|
||||
if client == client_fs_1:
|
||||
emit_signal("data_from_fs_1", rx_data)
|
||||
emit_signal("port_fs_opened_1", ip_fs)
|
||||
if state_fs == Constants.STATE.SEND:
|
||||
state_fs = Constants.STATE.DONE
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
pass
|
||||
# Подключаем сигналы к методам
|
||||
#Network.connect('data_send', _on_data_send)
|
||||
#Network.connect('data_from_fs_1', _on_data_received)
|
||||
#Network.connect('port_opened', _on_port_changed.bind(Color.GREEN))
|
||||
#Network.connect('port_closed', _on_port_changed.bind(Color.GRAY))
|
||||
#Network.connect('port_error', _on_port_changed.bind(Color.RED))
|
||||
|
||||
|
||||
#func _on_port_changed(port_name: String, color: Color) -> void:
|
||||
#$manage_panel/con/ip_connect.text = port_name
|
||||
#$fs_connect.self_modulate = color
|
||||
|
||||
|
||||
func _on_data_send():
|
||||
pass
|
||||
|
||||
#
|
||||
#func _on_data_received(data: PackedByteArray):
|
||||
#var GRP = data.decode_u8(0x0)
|
||||
#var CMD = data.decode_u8(0x1)
|
||||
#match CMD:
|
||||
#Constants.CMD.READ_CARRIER:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#$manage_panel/get_freq/freq_ind.text = str(data.decode_u64(0xC)) + ' Гц'
|
||||
#Constants.CMD.READ_ATT:
|
||||
#if GRP == Constants.GROUP.RF:
|
||||
#$manage_panel/get_att/att_ind.text = '-' + str(data.decode_float(0x18)) + ' dB'
|
||||
#Constants.CMD.READ_GEN_STATUS:
|
||||
#if GRP == Constants.GROUP.GENERATOR:
|
||||
#if data.decode_u32(0xC) == 0:
|
||||
#$manage_panel/get_gen_status/status_ind.text = 'Включен'
|
||||
#$manage_panel/get_gen_status/status_ind.modulate = Color.GREEN
|
||||
#else:
|
||||
#$manage_panel/get_gen_status/status_ind.text = 'Выключен'
|
||||
#$manage_panel/get_gen_status/status_ind.modulate = Color.RED
|
||||
#Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
#if GRP == Constants.GROUP.BASE:
|
||||
#$temp_1.text = '%.2f' % data.decode_float(0xC) + ' °C'
|
||||
#$temp_2.text = str(data.decode_float(0x10)) + ' °C'
|
||||
#$temp_3.text = str(data.decode_float(0x14)) + ' °C'
|
||||
#$read.text = str(data.hex_encode())
|
||||
|
||||
|
||||
func _on_start():
|
||||
unit_fs_1.start_session(counter, Network.client_fs_1)
|
||||
unit_fs_1.get_base_current_temp(counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_get_status(toggled_btn):
|
||||
var inverted_state = not toggled_btn
|
||||
unit_fs_1.set_gen_state(inverted_state, counter, Network.client_fs_1)
|
||||
unit_fs_1.get_gen_state(counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_addres_fs(input_addr: String) -> void:
|
||||
ip_fs_1 = input_addr
|
||||
@@ -2,7 +2,6 @@ extends Node
|
||||
|
||||
# ЯУ-07 Блок
|
||||
var unit = Yau07.YaU07.new('ЯУ-07Б')
|
||||
var unit_fs = Fs.FGOS.new()
|
||||
var soc_unicast: Socket
|
||||
var soc_brodcast: Socket
|
||||
var ip_address_yau: String = Constants.ADDRESSES[0][1]
|
||||
@@ -15,30 +14,13 @@ var state = Constants.STATE.WAIT
|
||||
var send_array: Array = []
|
||||
|
||||
# ФС Блок
|
||||
var client_fs_1: StreamPeer
|
||||
var ip_fs_1: String = Constants.ADDRESSES[0][4]
|
||||
var peerstream_fs_1: PacketPeer
|
||||
var state_fs_1 = Constants.STATE.IDLE
|
||||
var command_stack_1: Array
|
||||
var counter_fs_1: int = 0
|
||||
const ClientFs = preload("res://scripts/FS.gd")
|
||||
var unit_fs_1: Node = ClientFs.ClientFs.new('FS1')
|
||||
var unit_fs_2: Node = ClientFs.ClientFs.new('FS2')
|
||||
var unit_fs_3: Node = ClientFs.ClientFs.new('FS3')
|
||||
|
||||
## 2 ФС
|
||||
var client_fs_2: StreamPeer
|
||||
var ip_fs_2: String = Constants.ADDRESSES[0][5]
|
||||
var peerstream_fs_2: PacketPeer
|
||||
var state_fs_2 = Constants.STATE.IDLE
|
||||
var command_stack_2: Array
|
||||
var counter_fs_2: int = 0
|
||||
|
||||
## 3 ФС
|
||||
var client_fs_3: StreamPeer
|
||||
var ip_fs_3: String = Constants.ADDRESSES[0][5]
|
||||
var peerstream_fs_3: PacketPeer
|
||||
var state_fs_3 = Constants.STATE.IDLE
|
||||
var command_stack_3: Array
|
||||
var counter_fs_3: int = 0
|
||||
|
||||
# Яу-07б
|
||||
# Яу-07Б
|
||||
signal yau_status_line(status, addr) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
signal yau_receive(data_from_yau)
|
||||
signal yau_feedback_receive(data_from_yau)
|
||||
@@ -81,39 +63,6 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
return false
|
||||
|
||||
|
||||
func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: String): ## Приемник ФС
|
||||
client.poll()
|
||||
var peer = peerstream.get_stream_peer()
|
||||
# Проверяем, существует ли соединение
|
||||
if not peer:
|
||||
emit_signal("port_error", ip_fs)
|
||||
return
|
||||
|
||||
# Проверяем состояние подключения
|
||||
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
|
||||
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])
|
||||
if client == client_fs_1:
|
||||
emit_signal("data_from_fs_1", rx_data)
|
||||
emit_signal("port_fs_opened", ip_fs)
|
||||
if state_fs_1 == Constants.STATE.SEND:
|
||||
state_fs_1 = Constants.STATE.DONE
|
||||
elif client == client_fs_2:
|
||||
emit_signal("data_from_fs_2", rx_data)
|
||||
emit_signal("port_fs_opened", ip_fs)
|
||||
if state_fs_2 == Constants.STATE.SEND:
|
||||
state_fs_2 = Constants.STATE.DONE
|
||||
elif client == client_fs_3:
|
||||
emit_signal("data_from_fs_3", rx_data)
|
||||
emit_signal("port_fs_opened", ip_fs)
|
||||
if state_fs_3 == Constants.STATE.SEND:
|
||||
state_fs_3 = Constants.STATE.DONE
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Привязка для принятия широковещательного канала
|
||||
soc_brodcast = Socket.new()
|
||||
@@ -127,6 +76,9 @@ func _ready() -> void:
|
||||
print_debug('Ошибка: неудачная привязка адреса: ', Constants.UNICAST_ADDRESS)
|
||||
|
||||
unit.connect('line_changed', Callable(self, '_on_connect_change'))
|
||||
add_child(unit_fs_1)
|
||||
add_child(unit_fs_2)
|
||||
## Настройка при старте программы
|
||||
set_config()
|
||||
|
||||
|
||||
@@ -141,29 +93,12 @@ func set_config():
|
||||
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
|
||||
write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.FGOZ_3)
|
||||
read_port_isa([Constants.BASE_PORTS.EMS_G+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+8])
|
||||
connect_fs_1()
|
||||
connect_fs_2()
|
||||
connect_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
|
||||
|
||||
if client_fs_1:
|
||||
poll_receive_fs(client_fs_1, peerstream_fs_1, ip_fs_1)
|
||||
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(client_fs_2)
|
||||
if client_fs_3:
|
||||
poll_receive_fs(client_fs_3, peerstream_fs_3, ip_fs_3)
|
||||
state_machine_fs(client_fs_3)
|
||||
|
||||
poll_receive_yau07(soc_brodcast)
|
||||
poll_receive_yau07(soc_unicast)
|
||||
|
||||
@@ -214,357 +149,19 @@ func write_port_isa(port_isa: int, data_isa: int) -> void:
|
||||
|
||||
## Изменения состояния соединения с ячейкой ЯУ-07Б
|
||||
func _on_connect_change(unit_state_connect) -> void:
|
||||
print("%s" % unit_state_connect)
|
||||
print_debug("%s" % unit_state_connect)
|
||||
|
||||
|
||||
func on_command_change_device(meta_device):
|
||||
send_array = []
|
||||
ip_address_yau = meta_device[0]
|
||||
ip_port_yau = meta_device[1]
|
||||
ip_fs_1 = meta_device[3]
|
||||
ip_fs_2 = meta_device[4]
|
||||
ip_fs_3 = meta_device[5]
|
||||
connect_fs_1()
|
||||
connect_fs_2()
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
connect_fs_3()
|
||||
|
||||
|
||||
func state_machine_fs(client_fs):
|
||||
## State fs machine
|
||||
if client_fs == client_fs_1:
|
||||
if (state_fs_1 == Constants.STATE.IDLE) or (state_fs_1 == Constants.STATE.DONE):
|
||||
if command_stack_1:
|
||||
var pack: Array = command_stack_1.pop_front()
|
||||
unit_fs.send_fs_data(pack, client_fs_1, peerstream_fs_1)
|
||||
state_fs_1 = Constants.STATE.SEND
|
||||
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()
|
||||
unit_fs.send_fs_data(pack, client_fs_2, peerstream_fs_2)
|
||||
state_fs_2 = Constants.STATE.SEND
|
||||
if client_fs == client_fs_3:
|
||||
if (state_fs_3 == Constants.STATE.IDLE) or (state_fs_3 == Constants.STATE.DONE):
|
||||
if command_stack_3:
|
||||
var pack: Array = command_stack_3.pop_front()
|
||||
unit_fs.send_fs_data(pack, client_fs_3, peerstream_fs_3)
|
||||
state_fs_3 = Constants.STATE.SEND
|
||||
|
||||
|
||||
# Подключится к модулю ФС
|
||||
func connect_fs_1():
|
||||
if client_fs_1:
|
||||
unit_fs.disconnect_fs(client_fs_1)
|
||||
state_fs_1 = Constants.STATE.IDLE
|
||||
command_stack_1 = []
|
||||
|
||||
client_fs_1 = StreamPeerTCP.new()
|
||||
peerstream_fs_1 = PacketPeerStream.new()
|
||||
var rc = client_fs_1.connect_to_host(ip_fs_1, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_1)
|
||||
else:
|
||||
peerstream_fs_1.set_stream_peer(client_fs_1)
|
||||
|
||||
|
||||
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
|
||||
unit_fs.set_gen_state(false, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.set_gen_state(true, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_gen_state(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
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[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)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_fs_gen_status(state_gen):
|
||||
unit_fs.set_gen_state(state_gen, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func get_gen_state_1():
|
||||
unit_fs.get_gen_state(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier(freq: int):
|
||||
unit_fs.set_carrier(freq, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_carrier(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_fs_attenuation(attenuation: float):
|
||||
unit_fs.set_att_batch(attenuation, 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_base_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_can_macro(can_frequency: int):
|
||||
unit_fs.set_base_can_macro(can_frequency, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func status_can_macro_1(state_can: bool):
|
||||
unit_fs.status_can_macro_exec(state_can, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_configure_gen_msk_1():
|
||||
unit_fs.set_configure_state_msk_modul_1(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.set_configure_state_msk_modul_2(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_configure_gen_const_1():
|
||||
unit_fs.set_configure_state_msk_const_1(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
## 2 ФС коннект
|
||||
func connect_fs_2():
|
||||
if client_fs_2:
|
||||
unit_fs.disconnect_fs(client_fs_2)
|
||||
state_fs_2 = Constants.STATE.IDLE
|
||||
command_stack_2 = []
|
||||
|
||||
client_fs_2 = StreamPeerTCP.new()
|
||||
peerstream_fs_2 = PacketPeerStream.new()
|
||||
var rc = client_fs_2.connect_to_host(ip_fs_2, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_2)
|
||||
else:
|
||||
peerstream_fs_2.set_stream_peer(client_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
|
||||
unit_fs.set_gen_state(false, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.set_gen_state(true, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.set_att_batch(19.0, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_gen_state(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
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[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
|
||||
|
||||
unit_fs.get_att_batch(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_carrier(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
func set_fs_gen_status_2(state_gen: bool):
|
||||
unit_fs.set_gen_state(state_gen, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
func get_gen_state_2():
|
||||
unit_fs.get_gen_state(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier_2(freq: int):
|
||||
unit_fs.set_carrier(freq, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_carrier(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
func set_fs_attenuation_2(attenuation: float):
|
||||
unit_fs.set_att_batch(attenuation, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_att_batch(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
## Установка CAN частоты для подстройки фильтра ФС
|
||||
func set_can_macro_2(can_frequency: int):
|
||||
unit_fs.set_base_can_macro(can_frequency, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
## Установка CAN статуса(вкл/откл) для подстройки фильтра ФС
|
||||
func status_can_macro_2(state_can: bool):
|
||||
unit_fs.status_can_macro_exec(state_can, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
## Установка модуляции msk на генератор ФС
|
||||
func set_configure_gen_msk_2():
|
||||
unit_fs.set_configure_state_msk_modul_1(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.set_configure_state_msk_modul_2(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
## Установка модуляции const на генератор ФС
|
||||
func set_configure_gen_const_2():
|
||||
unit_fs.set_configure_state_msk_const_1(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
## 3 ФС коннект
|
||||
func connect_fs_3():
|
||||
if client_fs_3:
|
||||
unit_fs.disconnect_fs(client_fs_3)
|
||||
state_fs_3 = Constants.STATE.IDLE
|
||||
command_stack_3 = []
|
||||
|
||||
client_fs_3 = StreamPeerTCP.new()
|
||||
peerstream_fs_3 = PacketPeerStream.new()
|
||||
var rc = client_fs_3.connect_to_host(ip_fs_3, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_3)
|
||||
else:
|
||||
peerstream_fs_3.set_stream_peer(client_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
|
||||
unit_fs.set_gen_state(false, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_gen_state(true, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_gen_state(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
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[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
|
||||
|
||||
unit_fs.get_att_batch(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_carrier(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func set_fs_gen_status_3(state_gen: bool):
|
||||
unit_fs.set_gen_state(state_gen, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func get_gen_state_3():
|
||||
unit_fs.get_gen_state(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier_3(freq: int):
|
||||
unit_fs.set_carrier(freq, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_carrier(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func set_fs_attenuation_3(attenuation: float):
|
||||
unit_fs.set_att_batch(attenuation, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_att_batch(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка CAN частоты для подстройки фильтра ФС
|
||||
func set_can_macro_3(can_frequency: int):
|
||||
unit_fs.set_base_can_macro(can_frequency, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка CAN статуса(вкл/откл) для подстройки фильтра ФС
|
||||
func status_can_macro_3(state_can: bool):
|
||||
unit_fs.status_can_macro_exec(state_can, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка модуляции msk на генератор ФС
|
||||
func set_configure_gen_msk_3():
|
||||
unit_fs.set_configure_state_msk_modul_3(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_configure_state_msk_modul_3(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка модуляции const на генератор ФС
|
||||
func set_configure_gen_const_3():
|
||||
unit_fs.set_configure_state_msk_const_1(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
if unit_fs_1._stream:
|
||||
unit_fs_1.disconnect_fs()
|
||||
unit_fs_1.connect_to_host(meta_device[3], Constants.PORT_FS)
|
||||
|
||||
if unit_fs_2._stream:
|
||||
unit_fs_2.disconnect_fs()
|
||||
unit_fs_2.connect_to_host(meta_device[4], Constants.PORT_FS)
|
||||
#ip_fs_2 = meta_device[4]
|
||||
#ip_fs_3 = meta_device[5]
|
||||
|
||||
Reference in New Issue
Block a user