Новый клиент от ФС

This commit is contained in:
Maxim
2025-05-28 14:52:37 +03:00
parent eb36856831
commit f916c742c9
8 changed files with 1779 additions and 849 deletions

1452
PRD92E4.tmp Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=76 format=3 uid="uid://cvor2jm4xk3ha"] [gd_scene load_steps=75 format=3 uid="uid://cvor2jm4xk3ha"]
[ext_resource type="Script" path="res://scripts/PRD.gd" id="1_v273n"] [ext_resource type="Script" path="res://scripts/PRD.gd" id="1_v273n"]
[ext_resource type="Texture2D" uid="uid://cdxdluvyb5uei" path="res://table/on.png" id="2_dv7xx"] [ext_resource type="Texture2D" uid="uid://cdxdluvyb5uei" path="res://table/on.png" id="2_dv7xx"]
@@ -26,7 +26,6 @@
[ext_resource type="Texture2D" uid="uid://bcq6o4fuxh88b" path="res://pictures/эмс_pressed.png" id="12_u035s"] [ext_resource type="Texture2D" uid="uid://bcq6o4fuxh88b" path="res://pictures/эмс_pressed.png" id="12_u035s"]
[ext_resource type="Texture2D" uid="uid://b8jfjs7qh10wh" path="res://pictures/фс.png" id="13_xdqnq"] [ext_resource type="Texture2D" uid="uid://b8jfjs7qh10wh" path="res://pictures/фс.png" id="13_xdqnq"]
[ext_resource type="Texture2D" uid="uid://c8gfddmqnws7v" path="res://pictures/фс_pressed.png" id="14_0dei1"] [ext_resource type="Texture2D" uid="uid://c8gfddmqnws7v" path="res://pictures/фс_pressed.png" id="14_0dei1"]
[ext_resource type="Script" path="res://scripts/modul_fs.gd" id="15_b4pr1"]
[ext_resource type="Texture2D" uid="uid://cyuv78v6vem55" path="res://pictures/сохр.png" id="15_bpwqh"] [ext_resource type="Texture2D" uid="uid://cyuv78v6vem55" path="res://pictures/сохр.png" id="15_bpwqh"]
[ext_resource type="Shader" path="res://Shaders/loadead.gdshader" id="16_4osrw"] [ext_resource type="Shader" path="res://Shaders/loadead.gdshader" id="16_4osrw"]
[ext_resource type="Texture2D" uid="uid://bk2cbbj31mq2x" path="res://pictures/сохр_pressed.png" id="16_55rvl"] [ext_resource type="Texture2D" uid="uid://bk2cbbj31mq2x" path="res://pictures/сохр_pressed.png" id="16_55rvl"]
@@ -1340,86 +1339,6 @@ scale = Vector2(24.5313, 11.2656)
texture = SubResource("GradientTexture2D_0pk2o") texture = SubResource("GradientTexture2D_0pk2o")
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="Modul_fs" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_ooo4i")
script = ExtResource("15_b4pr1")
metadata/_tab_index = 3
metadata/_edit_lock_ = true
[node name="manage_panel" type="GridContainer" parent="TabContainer/Modul_fs"]
layout_mode = 0
offset_left = 200.0
offset_top = 186.0
offset_right = 773.0
offset_bottom = 308.0
columns = 3
[node name="con" type="Button" parent="TabContainer/Modul_fs/manage_panel"]
layout_mode = 2
text = " Подключение "
[node name="ip_connect" type="Label" parent="TabContainer/Modul_fs/manage_panel/con"]
layout_mode = 0
offset_top = 32.0
offset_right = 118.0
offset_bottom = 55.0
[node name="addres_fs" type="LineEdit" parent="TabContainer/Modul_fs/manage_panel"]
custom_minimum_size = Vector2(150, 0)
layout_mode = 2
[node name="get_gen_status" type="Button" parent="TabContainer/Modul_fs/manage_panel"]
layout_mode = 2
toggle_mode = true
text = "Переключатель генератора "
[node name="status_ind" type="Label" parent="TabContainer/Modul_fs/manage_panel/get_gen_status"]
layout_mode = 0
offset_top = 33.0
offset_right = 84.0
offset_bottom = 56.0
[node name="read" type="LineEdit" parent="TabContainer/Modul_fs"]
layout_mode = 0
offset_left = 199.0
offset_top = 322.0
offset_right = 954.0
offset_bottom = 353.0
[node name="fs_connect" type="Label" parent="TabContainer/Modul_fs"]
layout_mode = 0
offset_left = 206.0
offset_top = 144.0
offset_right = 377.0
offset_bottom = 167.0
text = "Связь с модулем ФС"
[node name="temp_1" type="Label" parent="TabContainer/Modul_fs"]
layout_mode = 0
offset_left = 1015.0
offset_top = 119.0
offset_right = 1102.0
offset_bottom = 152.0
text = "Темп"
[node name="temp_2" type="Label" parent="TabContainer/Modul_fs"]
layout_mode = 0
offset_left = 1016.0
offset_top = 156.0
offset_right = 1103.0
offset_bottom = 189.0
text = "Темп"
[node name="temp_3" type="Label" parent="TabContainer/Modul_fs"]
layout_mode = 0
offset_left = 1015.0
offset_top = 193.0
offset_right = 1102.0
offset_bottom = 226.0
text = "Темп"
[node name="load_status_yau" type="ProgressBar" parent="."] [node name="load_status_yau" type="ProgressBar" parent="."]
offset_left = 490.0 offset_left = 490.0
offset_top = 19.0 offset_top = 19.0
@@ -1446,6 +1365,3 @@ metadata/_edit_lock_ = true
[connection signal="pressed" from="Background/switch_panel/texture_save_config" to="." method="_on_save_config"] [connection signal="pressed" from="Background/switch_panel/texture_save_config" to="." method="_on_save_config"]
[connection signal="pressed" from="Background/switch_panel/texture_load_config" to="." method="_on_load_config"] [connection signal="pressed" from="Background/switch_panel/texture_load_config" to="." method="_on_load_config"]
[connection signal="pressed" from="TabContainer/PRD/Connect_prd" to="." method="_on_connect_prd_pressed"] [connection signal="pressed" from="TabContainer/PRD/Connect_prd" to="." method="_on_connect_prd_pressed"]
[connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/con" to="TabContainer/Modul_fs" method="_on_start"]
[connection signal="text_submitted" from="TabContainer/Modul_fs/manage_panel/addres_fs" to="TabContainer/Modul_fs" method="_on_addres_fs"]
[connection signal="toggled" from="TabContainer/Modul_fs/manage_panel/get_gen_status" to="TabContainer/Modul_fs" method="_on_get_status"]

View File

@@ -21,7 +21,6 @@ config/icon="res://icon.svg"
Constants="*res://scripts/constants.gd" Constants="*res://scripts/constants.gd"
Yau07="*res://scripts/yau07.gd" Yau07="*res://scripts/yau07.gd"
Fs="*res://scripts/FS.gd"
Network="*res://scripts/network.gd" Network="*res://scripts/network.gd"
commit="*res://commit.gd" commit="*res://commit.gd"
@@ -37,7 +36,7 @@ window/size/extend_to_title=true
[editor] [editor]
run/main_run_args="-- addr 100" run/main_run_args="-- addr 3"
[rendering] [rendering]

View File

@@ -3,9 +3,15 @@ extends Node
const ONLINE_TIMEOUT = 5.0 ## Время ожидания пакета от ячейки, секунды const ONLINE_TIMEOUT = 5.0 ## Время ожидания пакета от ячейки, секунды
const RETRY_COUNT = 5 ## Количество повторных отправок 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 { enum CmdCode {
START_SESSION = 0x0, ## Команда начала сессии START_SESSION = 0x0, ## Команда начала сессии
@@ -79,11 +85,69 @@ class FGOS:
const INIT: int = 0xFFFFFFFF const INIT: int = 0xFFFFFFFF
const FINAL_XOR_VALUE: int = 0x00000000 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 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: func crc32(data: PackedByteArray) -> int:
@@ -95,8 +159,7 @@ class FGOS:
var final_crc = crc ^ FINAL_XOR_VALUE var final_crc = crc ^ FINAL_XOR_VALUE
return final_crc return final_crc
func _form_packet(group: int, cmd: int, index_size: int, data = null) -> PackedByteArray:
func _form_packet(group: int, cmd: int, index_size: int, counter: int, data = null):
var packet = PackedByteArray() var packet = PackedByteArray()
packet.resize(index_size) packet.resize(index_size)
packet.encode_u8(GROUP_OFFSET, group) packet.encode_u8(GROUP_OFFSET, group)
@@ -107,90 +170,81 @@ class FGOS:
packet.encode_float(PAYLOAD_OFFSET, data) packet.encode_float(PAYLOAD_OFFSET, data)
return packet return packet
func send_packet_to(packet: PackedByteArray) -> void:
func send_packet_to(packet: PackedByteArray, client: StreamPeer):
var crc = crc32(packet) var crc = crc32(packet)
packet.resize(packet.size() + 4) packet.resize(packet.size() + 4)
packet.encode_u32(packet.size() - 4, crc) packet.encode_u32(packet.size() - 4, crc)
if client == Network.client_fs_1: command_stack.append(packet)
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
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): var error: int = _stream.put_data(command_stack.pop_front())
if client_fs.get_status() == 2: if error != OK:
var peer = peerstream_fs.get_stream_peer() print("Error writing to stream: ", error)
if peer: return false
peer.put_data(data_to_sand) 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) var packet = _form_packet(GROUP.BASE, CmdCode.START_SESSION, INDEX_SIZE, counter)
send_packet_to(packet, client) send_packet_to(packet)
## MSK ## MSK модуляция
func set_configure_state_msk_modul_1(counter: int, client: StreamPeer): func set_configure_state_msk_modul_1() -> void:
var index_size = 0x20 var index_size = 0x20
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter) var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
packet.encode_u8(0x3, 0x09) packet.encode_u8(0x3, 0x09)
packet.encode_u16(0x8, 0x0014) packet.encode_u16(0x8, 0x0014)
send_packet_to(packet, client) send_packet_to(packet)
## Constant модуляция
func set_configure_state_msk_modul_2(counter: int, client: StreamPeer): 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, 0x0d)
packet.encode_u16(0x8, 0x0014)
send_packet_to(packet, client)
## Constant
func set_configure_state_msk_const_1(counter: int, client: StreamPeer):
var index_size = 0x20 var index_size = 0x20
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter) var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
packet.encode_u8(0x3, 0x09) packet.encode_u8(0x3, 0x09)
packet.encode_u16(0x8, 0x0014) packet.encode_u16(0x8, 0x0014)
packet.encode_u8(0x1C, 0x0f) packet.encode_u8(0x1C, 0x0f)
send_packet_to(packet, client) send_packet_to(packet)
func set_gen_state(button_state: bool):
func set_gen_state(button_state: bool, counter: int, client: StreamPeer):
var index_size = 0x1C var index_size = 0x1C
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_GEN_STATUS, index_size, counter) var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_GEN_STATUS, index_size, counter)
packet.encode_u16(0x8, 0x0010) packet.encode_u16(0x8, 0x0010)
packet.encode_u32(0xC, button_state) ## MODE GEN STATUS 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):
func status_can_macro_exec(button_state: bool, counter: int, client: StreamPeer):
var index_size = 0x1C var index_size = 0x1C
var packet = _form_packet(GROUP.BASE, CmdCode.STATUS_CAN_MACRO, index_size, counter) var packet = _form_packet(GROUP.BASE, CmdCode.STATUS_CAN_MACRO, index_size, counter)
packet.encode_u16(0x8, 0x0010) packet.encode_u16(0x8, 0x0010)
packet.encode_u32(0xC, button_state) ## mode can status packet.encode_u32(0xC, button_state) ## mode can status
send_packet_to(packet, client) send_packet_to(packet)
func set_carrier(installation_frequency: int):
func set_carrier(installation_frequency: int, counter: int, client: StreamPeer):
var index_size = 0x1C var index_size = 0x1C
var packet = _form_packet(GROUP.BASE, CmdCode.SET_CARRIER, index_size, counter) var packet = _form_packet(GROUP.BASE, CmdCode.SET_CARRIER, index_size, counter)
packet.encode_u16(0x8, 0x10) packet.encode_u16(0x8, 0x10)
packet.encode_u64(0xC, installation_frequency) ## uint64_t freq low dword/high dword 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):
func set_att_batch(attenuation: float, counter: int, client: StreamPeer):
var index_size = 0x1C var index_size = 0x1C
var packet = _form_packet(GROUP.RF, CmdCode.SET_ATT, index_size, counter) var packet = _form_packet(GROUP.RF, CmdCode.SET_ATT, index_size, counter)
packet.encode_u16(0x8, 0x10) packet.encode_u16(0x8, 0x10)
packet.encode_float(0x18, attenuation) packet.encode_float(0x18, attenuation)
send_packet_to(packet, client) send_packet_to(packet)
func set_base_can_macro(installation_can_frequency: int, ):
func set_base_can_macro(installation_can_frequency: int, counter: int, client: StreamPeer):
var index_size = 0x34 var index_size = 0x34
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_WRITE, index_size, counter) var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_WRITE, index_size, counter)
packet.encode_u16(0x08, 0x28) packet.encode_u16(0x08, 0x28)
@@ -200,35 +254,28 @@ class FGOS:
packet.encode_u16(0x20, installation_can_frequency) packet.encode_u16(0x20, installation_can_frequency)
packet.encode_u16(0x28, 0x2aff) packet.encode_u16(0x28, 0x2aff)
packet.encode_u8(0x2B, 0x04) packet.encode_u8(0x2B, 0x04)
send_packet_to(packet, client) send_packet_to(packet)
func get_carrier():
func get_carrier(counter: int, client: StreamPeer):
var packet = _form_packet(GROUP.BASE, CmdCode.READ_CARRIER, INDEX_SIZE, counter) 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():
func get_att_batch(counter: int, client: StreamPeer):
var packet = _form_packet(GROUP.RF, CmdCode.READ_ATT, INDEX_SIZE, counter) 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():
func get_gen_state(counter: int, client: StreamPeer):
var packet = _form_packet(GROUP.GENERATOR, CmdCode.READ_GEN_STATUS, INDEX_SIZE, counter) 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():
func get_base_current_temp(counter: int, client: StreamPeer):
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_GET_CURRENT_TEMP, INDEX_SIZE, counter) 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():
func get_base_can_macro(counter: int, client: StreamPeer):
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_READ, INDEX_SIZE, counter) 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): func disconnect_fs() -> void:
client_for_leave.disconnect_from_host() _stream.disconnect_from_host()
online = false

View File

@@ -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, 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, 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, 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, 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')) node_select_fs_1.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_1'))
## FS 2 ## 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, 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, 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, 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, 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')) node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_2'))
## FS 3 ## 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, 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, 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')) 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, 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')) 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_status_line', Callable(self, '_on_yau_status'))
Network.connect('yau_receive', Callable(self, '_on_data_received')) Network.connect('yau_receive', Callable(self, '_on_data_received'))
Network.connect('yau_read_isa', Callable(self, '_on_read_isa')) 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_opened', _on_port_changed.bind(Color.AQUAMARINE))
Network.connect('port_fs_closed', _on_port_changed.bind(Color.DARK_GRAY)) #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_1', _on_data_fs_1)
Network.connect('data_from_fs_2', _on_data_fs_2) #Network.connect('data_from_fs_2', _on_data_fs_2)
Network.connect('data_from_fs_3', _on_data_fs_3) #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) self.add_child(timer_modul_um)
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um')) timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
self.connect('write_ems_g_start', _on_write_ems_g) 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(): func add_signs_scene():
@@ -324,10 +336,12 @@ func add_signs_scene():
# Список статусов ячеек ЯУ-07б # Список статусов ячеек ЯУ-07б
func _on_yau_status(addr: String): 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_yau_list = $TabContainer/PRD/status_yau_list.get_children()
var status_label = $TabContainer/PRD/status_yau var status_label = $TabContainer/PRD/status_yau
if addr.is_empty(): if addr.is_empty():
if Network.unit.online:
return
# Сброс состояния, если адрес пуст (нет связи) # Сброс состояния, если адрес пуст (нет связи)
for label in status_yau_list: for label in status_yau_list:
label.text = '' 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: if tmp_device_mode == Constants.META.CI_1_B_UF:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict: 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: if tmp_device_mode == Constants.META.CI_2_B_UF:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict: 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: if tmp_device_mode == Constants.META.CI_3_B_UF:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict: 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 if tmp_device_mode == Constants.META.MODUL_UM_1: ## Синхронизация с Модуляцией УМ лиетры 1
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict: 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: if tmp_device_mode == Constants.META.FGOZ_4:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict: 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: if tmp_device_mode == Constants.META.FGOZ_3:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1] var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict: 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: match CMD:
Constants.CMD.READ_CARRIER: Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE: if GRP == Constants.GROUP.BASE:
freq_fs_1 = fs_1_data.decode_u64(0xC) / 1_000_000 var freq = int(fs_data.decode_u64(0xC) / 1_000_000.0)
node_select_fs_1.set_node_text(2, 2, str(freq_fs_1) + ' МГц') 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: Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF: if GRP == Constants.GROUP.RF:
att_fs_1 = fs_1_data.decode_float(0x18) var att = fs_data.decode_float(0x18)
node_select_fs_1.set_node_text(2, 3, str(att_fs_1) + ' dB') 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: Constants.CMD.READ_GEN_STATUS:
if GRP == Constants.GROUP.GENERATOR: if GRP == Constants.GROUP.GENERATOR:
if fs_1_data.decode_u32(0xC) == 0: if fs_data.decode_u32(0xC) == 0:
node_select_fs_1.set_node_text(2, 5, 'Включен') node_select.set_node_text(2, 5, 'Включен')
node_select_fs_1.get_node2(2, 5).modulate = Color.AQUAMARINE node_select.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) ray_node_path.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 fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
else: else:
node_select_fs_1.set_node_text(2, 5, 'Отключен') node_select_fs_1.set_node_text(2, 5, 'Отключен')
node_select_fs_1.get_node2(2, 5).modulate = Color.CRIMSON node_select.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) ray_node_path.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 fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
Constants.CMD.BASE_GET_CURRENT_TEMP: Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE: 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: Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE: 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): #func _on_data_fs_2(fs_2_data):
var GRP = fs_2_data.decode_u8(0x0) #var GRP = fs_2_data.decode_u8(0x0)
var CMD = fs_2_data.decode_u8(0x1) #var CMD = fs_2_data.decode_u8(0x1)
match CMD: #match CMD:
Constants.CMD.READ_CARRIER: #Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE: #if GRP == Constants.GROUP.BASE:
freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000 #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) + ' МГц') #node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
Constants.CMD.READ_ATT: #Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF: #if GRP == Constants.GROUP.RF:
att_fs_2 = fs_2_data.decode_float(0x18) #att_fs_2 = fs_2_data.decode_float(0x18)
node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB') #node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
Constants.CMD.READ_GEN_STATUS: #Constants.CMD.READ_GEN_STATUS:
if GRP == Constants.GROUP.GENERATOR: #if GRP == Constants.GROUP.GENERATOR:
if fs_2_data.decode_u32(0xC) == 0: #if fs_2_data.decode_u32(0xC) == 0:
node_select_fs_2.set_node_text(2, 5, 'Включен') #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(2, 5).modulate = Color.AQUAMARINE
node_select_fs_2.get_node2(1, 5).get_child(1).button_pressed = true #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) #$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
else: #else:
node_select_fs_2.set_node_text(2, 5, 'Отключен') #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(2, 5).modulate = Color.CRIMSON
node_select_fs_2.get_node2(1, 5).get_child(1).button_pressed = false #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) #$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
Constants.CMD.BASE_GET_CURRENT_TEMP: #Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE: #if GRP == Constants.GROUP.BASE:
node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C') #node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
Constants.CMD.BASE_CAN_MACRO_READ: #Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE: #if GRP == Constants.GROUP.BASE:
node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц') #node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц')
#
#
func _on_data_fs_3(fs_3_data): #func _on_data_fs_3(fs_3_data):
var GRP = fs_3_data.decode_u8(0x0) #var GRP = fs_3_data.decode_u8(0x0)
var CMD = fs_3_data.decode_u8(0x1) #var CMD = fs_3_data.decode_u8(0x1)
match CMD: #match CMD:
Constants.CMD.READ_CARRIER: #Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE: #if GRP == Constants.GROUP.BASE:
freq_fs_3 = fs_3_data.decode_u64(0xC) / 1_000_000 #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) + ' МГц') #node_select_fs_3.set_node_text(2, 2, str(freq_fs_3) + ' МГц')
Constants.CMD.READ_ATT: #Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF: #if GRP == Constants.GROUP.RF:
att_fs_3 = fs_3_data.decode_float(0x18) #att_fs_3 = fs_3_data.decode_float(0x18)
node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB') #node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB')
Constants.CMD.READ_GEN_STATUS: #Constants.CMD.READ_GEN_STATUS:
if GRP == Constants.GROUP.GENERATOR: #if GRP == Constants.GROUP.GENERATOR:
if fs_3_data.decode_u32(0xC) == 0: #if fs_3_data.decode_u32(0xC) == 0:
node_select_fs_3.set_node_text(2, 5, 'Включен') #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(2, 5).modulate = Color.AQUAMARINE
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = true #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) #$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
else: #else:
node_select_fs_3.set_node_text(2, 5, 'Отключен') #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(2, 5).modulate = Color.CRIMSON
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = false #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) #$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
Constants.CMD.BASE_GET_CURRENT_TEMP: #Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE: #if GRP == Constants.GROUP.BASE:
node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C') #node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
Constants.CMD.BASE_CAN_MACRO_READ: #Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE: #if GRP == Constants.GROUP.BASE:
node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц') #node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц')
func _process(_delta: float) -> void: func _process(_delta: float) -> void:
@@ -708,10 +752,10 @@ func on_mode_select(intem_from_sector: int) -> void:
add_signs_scene() add_signs_scene()
Network.on_command_change_device(meta) 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.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_1(pribor_selec)
Network.start_work_fs_2(pribor_selec) #Network.start_work_fs_2(pribor_selec)
if meta[2] == Constants.MODE.PRD_K: #if meta[2] == Constants.MODE.PRD_K:
Network.start_work_fs_3(pribor_selec) #Network.start_work_fs_3(pribor_selec)
$load_status_yau.value = 0 $load_status_yau.value = 0
emit_signal('read_ems_g_start') emit_signal('read_ems_g_start')
$load_status_yau.visible = true $load_status_yau.visible = true
@@ -862,16 +906,18 @@ func set_bits(v, a, m):
## ФС Connect close ## ФС Connect close
func _on_port_changed(port_name: String, color: Color) -> void: func _on_port_changed(client_addr: String, unit_fs_client: Node, status_online:bool) -> 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) if unit_fs_client == Network.unit_fs_1:
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = color $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, client_addr)
elif port_name == Network.ip_fs_2: $TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, port_name) elif unit_fs_client == Network.unit_fs_2:
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = color $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, client_addr)
elif port_name == Network.ip_fs_3: $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, port_name) elif unit_fs_client == Network.unit_fs_3:
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = color $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) # Установка формы сигнала (модуляция константа или msk)
func _on_modul_fs_1(modulation_select_1) -> void: 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): func _on_get_status(toggled_btn: bool, unit_fs_client: Node):
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 var inverted_state = not toggled_btn
Network.set_fs_gen_status(inverted_state) unit_fs_client.set_gen_state(inverted_state)
Network.get_gen_state_1() unit_fs_client.get_gen_state()
func _on_set_ferq_1(freq: String): func _on_set_ferq(freq: String, unit_fs_client: Node):
# Проверка на наличие символов в строке freq # Проверка на наличие символов в строке freq
var regex = RegEx.new() var regex = RegEx.new()
regex.compile("^[0-9]+$") regex.compile("^[0-9]+$")
@@ -904,12 +950,14 @@ func _on_set_ferq_1(freq: String):
print_debug('Некорректная частота') print_debug('Некорректная частота')
return 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): 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) save_settings(float(att), 0)
Network.unit_fs_1.get_att_batch()
func _on_set_base_can_macro(can_freq: String): 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) Network.status_can_macro_1(toggled_btn)
## 2 ФС ### 2 ФС
func _on_get_status_2(toggled_btn): #func _on_get_status_2(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 #var inverted_state = not toggled_btn
Network.set_fs_gen_status_2(inverted_state) #Network.unit_fs_2.set_gen_state(inverted_state)
Network.get_gen_state_2() #Network.unit_fs_2.get_gen_state()
func _on_set_ferq_2(freq: String): #func _on_set_ferq_2(freq: String):
# Проверка на наличие символов в строке freq ## Проверка на наличие символов в строке freq
var regex = RegEx.new() #var regex = RegEx.new()
regex.compile("^[0-9]+$") #regex.compile("^[0-9]+$")
if not regex.search(freq): #if not regex.search(freq):
print_debug('Ошибка: частота должна быть числом без букв') #print_debug('Ошибка: частота должна быть числом без букв')
return #return
# Преобразование строки в число ## Преобразование строки в число
var freq_int = int(freq) * 1_000_000 #var freq_int = int(freq) * 1_000_000
#
# Проверка на диапазон ## Проверка на диапазон
if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000: #if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
print_debug('Некорректная частота') #print_debug('Некорректная частота')
return #return
Network.set_fs_ferq_carrier_2(freq_int) #Network.set_fs_ferq_carrier_2(freq_int)
func _on_set_att_2(att: String): func _on_set_att_2(att: String):
@@ -967,7 +1015,7 @@ func _on_modul_fs_2(modulation_select_2) -> void:
## ФС 3 ## ФС 3
func _on_get_status_3(toggled_btn): 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 var inverted_state = not toggled_btn
Network.set_fs_gen_status_3(inverted_state) Network.set_fs_gen_status_3(inverted_state)
Network.get_gen_state_3() Network.get_gen_state_3()
@@ -1015,8 +1063,8 @@ func _on_prd_select() -> void:
$load_status_yau.value = 0 $load_status_yau.value = 0
emit_signal('read_ems_g_start') emit_signal('read_ems_g_start')
set_tab_and_buttons(0, 'select_prd', 'texture_prd') set_tab_and_buttons(0, 'select_prd', 'texture_prd')
Network.get_gen_state_1() Network.unit_fs_1.get_gen_state()
Network.get_gen_state_2() Network.unit_fs_2.get_gen_state()
func _on_control_button() -> void: 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(): for button in switch_panel.get_children():
if button is Button or TextureButton: if button is Button or TextureButton:
if button.name != 'burgerButton': 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':
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 $load_status_yau.visible = false

View File

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

View File

@@ -2,7 +2,6 @@ extends Node
# ЯУ-07 Блок # ЯУ-07 Блок
var unit = Yau07.YaU07.new('ЯУ-07Б') var unit = Yau07.YaU07.new('ЯУ-07Б')
var unit_fs = Fs.FGOS.new()
var soc_unicast: Socket var soc_unicast: Socket
var soc_brodcast: Socket var soc_brodcast: Socket
var ip_address_yau: String = Constants.ADDRESSES[0][1] var ip_address_yau: String = Constants.ADDRESSES[0][1]
@@ -15,30 +14,13 @@ var state = Constants.STATE.WAIT
var send_array: Array = [] var send_array: Array = []
# ФС Блок # ФС Блок
var client_fs_1: StreamPeer const ClientFs = preload("res://scripts/FS.gd")
var ip_fs_1: String = Constants.ADDRESSES[0][4] var unit_fs_1: Node = ClientFs.ClientFs.new('FS1')
var peerstream_fs_1: PacketPeer var unit_fs_2: Node = ClientFs.ClientFs.new('FS2')
var state_fs_1 = Constants.STATE.IDLE var unit_fs_3: Node = ClientFs.ClientFs.new('FS3')
var command_stack_1: Array
var counter_fs_1: int = 0
## 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 ФС # Яу-07Б
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б
signal yau_status_line(status, addr) ## Вызывается когда меняется состояние связи с ячейкой signal yau_status_line(status, addr) ## Вызывается когда меняется состояние связи с ячейкой
signal yau_receive(data_from_yau) signal yau_receive(data_from_yau)
signal yau_feedback_receive(data_from_yau) signal yau_feedback_receive(data_from_yau)
@@ -81,39 +63,6 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
return false 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: func _ready() -> void:
# Привязка для принятия широковещательного канала # Привязка для принятия широковещательного канала
soc_brodcast = Socket.new() soc_brodcast = Socket.new()
@@ -127,6 +76,9 @@ func _ready() -> void:
print_debug('Ошибка: неудачная привязка адреса: ', Constants.UNICAST_ADDRESS) print_debug('Ошибка: неудачная привязка адреса: ', Constants.UNICAST_ADDRESS)
unit.connect('line_changed', Callable(self, '_on_connect_change')) unit.connect('line_changed', Callable(self, '_on_connect_change'))
add_child(unit_fs_1)
add_child(unit_fs_2)
## Настройка при старте программы
set_config() set_config()
@@ -141,29 +93,12 @@ func set_config():
read_port_isa([Constants.BASE_PORTS.EMS_G+8]) read_port_isa([Constants.BASE_PORTS.EMS_G+8])
write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.FGOZ_3) 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]) 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: func _process(delta: float) -> void:
last_update_time_yau07 += delta last_update_time_yau07 += delta
last_update_time_fs += 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_brodcast)
poll_receive_yau07(soc_unicast) poll_receive_yau07(soc_unicast)
@@ -214,357 +149,19 @@ func write_port_isa(port_isa: int, data_isa: int) -> void:
## Изменения состояния соединения с ячейкой ЯУ-07Б ## Изменения состояния соединения с ячейкой ЯУ-07Б
func _on_connect_change(unit_state_connect) -> void: 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): func on_command_change_device(meta_device):
send_array = [] send_array = []
ip_address_yau = meta_device[0] ip_address_yau = meta_device[0]
ip_port_yau = meta_device[1] ip_port_yau = meta_device[1]
ip_fs_1 = meta_device[3] if unit_fs_1._stream:
ip_fs_2 = meta_device[4] unit_fs_1.disconnect_fs()
ip_fs_3 = meta_device[5] unit_fs_1.connect_to_host(meta_device[3], Constants.PORT_FS)
connect_fs_1()
connect_fs_2() if unit_fs_2._stream:
if Constants.CURRENT_MODE == Constants.MODE.PRD_K: unit_fs_2.disconnect_fs()
connect_fs_3() unit_fs_2.connect_to_host(meta_device[4], Constants.PORT_FS)
#ip_fs_2 = meta_device[4]
#ip_fs_3 = meta_device[5]
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

View File

@@ -349,6 +349,7 @@ func get_rows_count() -> int:
var nodes_count: int = 0 var nodes_count: int = 0
for key in nodes: for key in nodes:
nodes_count += int(NODE_PREFIX in key) nodes_count += int(NODE_PREFIX in key)
@warning_ignore("integer_division")
return nodes_count / columns return nodes_count / columns