Compare commits
10 Commits
eb36856831
...
87e57a124e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
87e57a124e | ||
|
|
8a87cc70f6 | ||
|
|
e202a21162 | ||
|
|
75e815e458 | ||
|
|
6182aaf6b0 | ||
|
|
11dd78b904 | ||
|
|
19af5eafdd | ||
|
|
3242b70078 | ||
|
|
1982125fc7 | ||
|
|
f916c742c9 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -9,3 +9,4 @@ bin
|
||||
/saves/ПРД-К1
|
||||
/saves/ПРД-К2
|
||||
/saves/ПРД-Н1
|
||||
/signals/
|
||||
|
||||
1452
PRD92E4.tmp
Normal file
1452
PRD92E4.tmp
Normal file
File diff suppressed because it is too large
Load Diff
817
PRD_MP550.tscn
817
PRD_MP550.tscn
File diff suppressed because it is too large
Load Diff
2068
PRD_MP550.tscn155875871.tmp
Normal file
2068
PRD_MP550.tscn155875871.tmp
Normal file
File diff suppressed because it is too large
Load Diff
2068
PRD_MP550.tscn69539220.tmp
Normal file
2068
PRD_MP550.tscn69539220.tmp
Normal file
File diff suppressed because it is too large
Load Diff
1
Shaders/gradient.gdshader.uid
Normal file
1
Shaders/gradient.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://b5gbbkmh0kuyv
|
||||
1
Shaders/load.gdshader.uid
Normal file
1
Shaders/load.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ds6ywhefj4kgs
|
||||
1
Shaders/loadead.gdshader.uid
Normal file
1
Shaders/loadead.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c52vt2vrkj8g0
|
||||
1
Shaders/opt_btn.gdshader.uid
Normal file
1
Shaders/opt_btn.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://btq40yo6trd2d
|
||||
1
Shaders/ray.gdshader.uid
Normal file
1
Shaders/ray.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dbw5kqlo45mss
|
||||
1
Shaders/ray_2.gdshader.uid
Normal file
1
Shaders/ray_2.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cfd2s64fffn6w
|
||||
1
Shaders/ray_litera_1.gdshader.uid
Normal file
1
Shaders/ray_litera_1.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d4cjy8r4imndv
|
||||
@@ -1,10 +1,10 @@
|
||||
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://s6xe8igevnv2"]
|
||||
|
||||
[ext_resource type="Shader" path="res://Shaders/ray.gdshader" id="1_mtift"]
|
||||
[ext_resource type="Shader" uid="uid://dbw5kqlo45mss" path="res://Shaders/ray.gdshader" id="1_mtift"]
|
||||
|
||||
[resource]
|
||||
shader = ExtResource("1_mtift")
|
||||
shader_parameter/color_signal = null
|
||||
shader_parameter/color_signal = Color(0, 0, 0, 1)
|
||||
shader_parameter/turn = 0.785
|
||||
shader_parameter/inner_radius = 0.32
|
||||
shader_parameter/speed = 0.0
|
||||
|
||||
1
commit.gd.uid
Normal file
1
commit.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://duptjjvqugua5
|
||||
@@ -3,15 +3,17 @@
|
||||
name="Windows Desktop"
|
||||
platform="Windows Desktop"
|
||||
runnable=true
|
||||
advanced_options=false
|
||||
advanced_options=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="bin/testPRD.exe"
|
||||
export_path="bin/PoligonPRD.exe"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
@@ -19,7 +21,7 @@ script_export_mode=2
|
||||
[preset.0.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release="M:/gitea/windows.template_release.exe"
|
||||
custom_template/release="D:/gitea/godot-bin/godot4.4.windows.template_release.x86_64.exe"
|
||||
debug/export_console_wrapper=0
|
||||
binary_format/embed_pck=true
|
||||
texture_format/s3tc_bptc=true
|
||||
@@ -62,3 +64,45 @@ Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorActi
|
||||
ssh_remote_deploy/cleanup_script="Stop-ScheduledTask -TaskName godot_remote_debug -ErrorAction:SilentlyContinue
|
||||
Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue
|
||||
Remove-Item -Recurse -Force '{temp_dir}'"
|
||||
|
||||
[preset.1]
|
||||
|
||||
name="Linux"
|
||||
platform="Linux"
|
||||
runnable=true
|
||||
advanced_options=true
|
||||
dedicated_server=false
|
||||
custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="bin/PoligonPRD.x86_64"
|
||||
patches=PackedStringArray()
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
seed=0
|
||||
encrypt_pck=false
|
||||
encrypt_directory=false
|
||||
script_export_mode=2
|
||||
|
||||
[preset.1.options]
|
||||
|
||||
custom_template/debug=""
|
||||
custom_template/release="/home/user/tmp/godot.linuxbsd.template_release.x86_64"
|
||||
debug/export_console_wrapper=1
|
||||
binary_format/embed_pck=true
|
||||
texture_format/s3tc_bptc=true
|
||||
texture_format/etc2_astc=false
|
||||
binary_format/architecture="x86_64"
|
||||
ssh_remote_deploy/enabled=false
|
||||
ssh_remote_deploy/host="user@host_ip"
|
||||
ssh_remote_deploy/port="22"
|
||||
ssh_remote_deploy/extra_args_ssh=""
|
||||
ssh_remote_deploy/extra_args_scp=""
|
||||
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||
export DISPLAY=:0
|
||||
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||
rm -rf \"{temp_dir}\""
|
||||
|
||||
0
git-hook-gdscript.sh
Normal file → Executable file
0
git-hook-gdscript.sh
Normal file → Executable file
176
monitoring.gd
Normal file
176
monitoring.gd
Normal file
@@ -0,0 +1,176 @@
|
||||
extends Panel
|
||||
const yau_devices: Array[Dictionary] = [
|
||||
{'name': 'ПРД-Н1', 'addr': '10.1.1.11', 'port': 50011},
|
||||
{'name': 'ПРД-Н2', 'addr': '10.1.1.21', 'port': 50021},
|
||||
{'name': 'ПРД-Н3', 'addr': '10.1.1.31', 'port': 50031},
|
||||
{'name': 'ПРД-Н4', 'addr': '10.1.1.41', 'port': 50041},
|
||||
{'name': 'ПРД-В1', 'addr': '10.1.1.12', 'port': 50012},
|
||||
{'name': 'ПРД-В2', 'addr': '10.1.1.22', 'port': 50022},
|
||||
{'name': 'ПРД-В3', 'addr': '10.1.1.32', 'port': 50032},
|
||||
{'name': 'ПРД-В4', 'addr': '10.1.1.42', 'port': 50042},
|
||||
{'name': 'ПРД-К1', 'addr': '10.1.1.13', 'port': 50013},
|
||||
{'name': 'ПРД-К2', 'addr': '10.1.1.23', 'port': 50023},
|
||||
{'name': 'ПРД-К3', 'addr': '10.1.1.33', 'port': 50033},
|
||||
{'name': 'ПРД-К4', 'addr': '10.1.1.43', 'port': 50043}
|
||||
]
|
||||
|
||||
func _ready() -> void:
|
||||
for device in yau_devices:
|
||||
$select_device.add_item(device['name'])
|
||||
|
||||
## Включаем обработку событий мыши
|
||||
$select_device.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
$select_device.gui_input.connect(_on_select_device_gui_input)
|
||||
Network.connect('yau_receive', Callable(self, '_on_parse_packet_yau_07'))
|
||||
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
|
||||
|
||||
|
||||
func _on_select_device_item_selected(index: int) -> void:
|
||||
if index == 0:
|
||||
# Обработка выбора "NONE"
|
||||
$addr.text = "Устройство не выбрано (NONE)"
|
||||
Network.send_array = []
|
||||
Network.ip_address_yau = ''
|
||||
Network.ip_port_yau = 0
|
||||
elif index > 0 and index - 1 < yau_devices.size():
|
||||
var device: Dictionary = yau_devices[index - 1]
|
||||
var changed_addr_yau: String = device['addr']
|
||||
var changed_port_yau: int = device['port']
|
||||
$addr.text = "Адрес: %s" % changed_addr_yau
|
||||
Network.send_array = []
|
||||
Network.ip_address_yau = changed_addr_yau
|
||||
Network.ip_port_yau = changed_port_yau
|
||||
else:
|
||||
print("Неверный индекс: ", index)
|
||||
|
||||
|
||||
func _on_select_device_gui_input(event: InputEvent) -> void:
|
||||
if event is InputEventMouseButton:
|
||||
var mouse_event: InputEventMouseButton = event
|
||||
if mouse_event.pressed:
|
||||
if mouse_event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
# Прокрутка вверх
|
||||
var current_index = $select_device.selected
|
||||
if current_index > 0:
|
||||
$select_device.select(current_index - 1)
|
||||
$select_device.item_selected.emit(current_index - 1)
|
||||
elif mouse_event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
# Прокрутка вниз
|
||||
var current_index = $select_device.selected
|
||||
if current_index < $select_device.item_count - 1:
|
||||
$select_device.select(current_index + 1)
|
||||
$select_device.item_selected.emit(current_index + 1)
|
||||
|
||||
|
||||
func _on_parse_packet_yau_07(packet_form_yau_07: PackedByteArray) -> void:
|
||||
#print_debug('in _on_parse_packet_yau_07')
|
||||
socket_status_ems_g(packet_form_yau_07)
|
||||
parser_power_um(packet_form_yau_07)
|
||||
parser_temperature_um(packet_form_yau_07)
|
||||
dkm(packet_form_yau_07)
|
||||
|
||||
|
||||
var receive_yau_counter: Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
|
||||
func _on_yau_status(addr: String):
|
||||
var count_packets_await: int = 20
|
||||
var status_yau_list = $status_yau_list.get_children()
|
||||
var status_label = $status_yau
|
||||
if addr.is_empty():
|
||||
# Сброс состояния, если адрес пуст (нет связи)
|
||||
for label in status_yau_list:
|
||||
label.text = ''
|
||||
status_label.modulate = Color.CRIMSON
|
||||
status_label.text = 'ЯУ-07Б: нет связи'
|
||||
return
|
||||
status_label.text = '' # Убираем статус, если есть сигнал от ЯУ-07Б
|
||||
|
||||
# Обновляем счетчики
|
||||
for i in Constants.ADDRESSES.size():
|
||||
var address_match = (Constants.ADDRESSES[i][1] == addr)
|
||||
receive_yau_counter[i] = 0 if address_match else (receive_yau_counter[i] + 1) & 0xFFF
|
||||
# Обновляем статусы элементов
|
||||
for i in status_yau_list.size():
|
||||
var label = status_yau_list[i]
|
||||
var address_info = Constants.ADDRESSES[i]
|
||||
|
||||
label.text = address_info[0]
|
||||
label.modulate = Color.AQUAMARINE if receive_yau_counter[i] < count_packets_await else Color.DARK_GRAY # Если счетчик >= count_packets_await, помечаем серым, иначе — аквамарином
|
||||
|
||||
|
||||
|
||||
## Отображение статуса входа/выхода от ЭМС-Г
|
||||
func socket_status_ems_g(packet_form_yau_07: PackedByteArray) -> void:
|
||||
var count_sockets: int = 16
|
||||
var in_blank: int = packet_form_yau_07.decode_u16(Constants.DataIndices.IN_BLANK_PRD)
|
||||
var in_impulse: int = packet_form_yau_07.decode_u16(Constants.DataIndices.IN_IMPULS_PRD)
|
||||
var out_blank: int = packet_form_yau_07.decode_u16(Constants.DataIndices.OUT_BLANK_PRD)
|
||||
var out_impulse: int = packet_form_yau_07.decode_u16(Constants.DataIndices.OUT_IMPULS_PRD)
|
||||
process_sockets_input(in_blank, in_impulse, count_sockets)
|
||||
process_sockets_output(out_blank, out_impulse, count_sockets)
|
||||
|
||||
|
||||
func process_sockets_input(in_blank: int, in_impulse: int, count: int):
|
||||
var group_socket_status: Array = get_tree().get_nodes_in_group("input_socket_status")
|
||||
|
||||
for i in count:
|
||||
var frame_type = Constants.Frame.WORK
|
||||
if (in_blank & (1 << i)) != 0:
|
||||
frame_type = Constants.Frame.CONSTANT
|
||||
elif (in_impulse & (1 << i)) != 0:
|
||||
frame_type = Constants.Frame.VARIABLE
|
||||
set_frame(group_socket_status[i], frame_type)
|
||||
|
||||
|
||||
func process_sockets_output(out_blank: int, out_impulse: int, count: int):
|
||||
for i in count:
|
||||
var group_socket_status: Array = get_tree().get_nodes_in_group("output_socket_status")
|
||||
var frame_type = Constants.Frame.WORK
|
||||
if (out_blank & (1 << i)) != 0:
|
||||
frame_type = Constants.Frame.CONSTANT
|
||||
elif (out_impulse & (1 << i)) != 0:
|
||||
frame_type = Constants.Frame.VARIABLE
|
||||
set_frame(group_socket_status[i], frame_type)
|
||||
|
||||
|
||||
func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
|
||||
|
||||
## Значения температуры и мощнсти от УКП
|
||||
func parser_power_um(data_from_yau_07: PackedByteArray) -> void:
|
||||
var array_power_1 = get_tree().get_nodes_in_group("power")
|
||||
for i_pow in range(6): ## Мощность от УКП_1
|
||||
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i_pow)
|
||||
array_power_1[i_pow].text = '%d' % power_ukp_1
|
||||
|
||||
var array_power_2 = get_tree().get_nodes_in_group("power")
|
||||
for i_pow in range(6): ## Мощность от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.POWER_UKP_2 + 2 * i_pow:
|
||||
var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i_pow)
|
||||
array_power_2[i_pow+6].text = '%d' % power_ukp_2
|
||||
|
||||
#if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * 7:
|
||||
#var power_ukp_3 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * 7)
|
||||
#var temperature_ukp_3 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * 7)
|
||||
#var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_3) * Constants.TEMP + 3
|
||||
#node_select3.set_node_text(0, 1, '%d' % power_ukp_3)
|
||||
#node_select3.set_node_text(1,1, '%d °С' % TMP)
|
||||
|
||||
|
||||
func parser_temperature_um(data_from_yau_07: PackedByteArray) -> void:
|
||||
var array_temperature = get_tree().get_nodes_in_group("temperature")
|
||||
for i_tmp in range(6): ## Температура от УКП_1
|
||||
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i_tmp)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP + 3
|
||||
array_temperature[i_tmp].text = '%d °С' % TMP
|
||||
|
||||
for i_tmp in range(6): ## Температура от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * i_tmp:
|
||||
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * i_tmp)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP + 3
|
||||
array_temperature[i_tmp+6].text = '%d °С' % TMP
|
||||
|
||||
|
||||
func dkm(data_from_yau_07: PackedByteArray)-> void:
|
||||
var local_dkm = data_from_yau_07.decode_u8(Constants.DataIndices.DKM)
|
||||
$DKM_grid/DKM.text = 'DKM: ' + str(local_dkm)
|
||||
1
monitoring.gd.uid
Normal file
1
monitoring.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://du1ddy4r1sch
|
||||
@@ -23,6 +23,7 @@ allow_system_fallback=true
|
||||
force_autohinter=false
|
||||
hinting=1
|
||||
subpixel_positioning=1
|
||||
keep_rounding_remainders=true
|
||||
oversampling=0.0
|
||||
Fallbacks=null
|
||||
fallbacks=[]
|
||||
|
||||
@@ -12,7 +12,7 @@ config_version=5
|
||||
|
||||
config/name="ПРД_для_МП-550"
|
||||
run/main_scene="res://PRD_MP550.tscn"
|
||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||
config/features=PackedStringArray("4.4", "GL Compatibility")
|
||||
boot_splash/bg_color=Color(0.356863, 0.278431, 0.356863, 1)
|
||||
boot_splash/image="res://pictures/masterc.png"
|
||||
config/icon="res://icon.svg"
|
||||
@@ -21,7 +21,6 @@ config/icon="res://icon.svg"
|
||||
|
||||
Constants="*res://scripts/constants.gd"
|
||||
Yau07="*res://scripts/yau07.gd"
|
||||
Fs="*res://scripts/FS.gd"
|
||||
Network="*res://scripts/network.gd"
|
||||
commit="*res://commit.gd"
|
||||
|
||||
@@ -34,10 +33,11 @@ gdscript/warnings/unused_signal=0
|
||||
window/size/viewport_width=1900
|
||||
window/size/viewport_height=1000
|
||||
window/size/extend_to_title=true
|
||||
window/stretch/mode="canvas_items"
|
||||
|
||||
[editor]
|
||||
|
||||
run/main_run_args="-- addr 100"
|
||||
run/main_run_args="--addr 3"
|
||||
|
||||
[rendering]
|
||||
|
||||
|
||||
231
scripts/FS.gd
231
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,78 @@ 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 send_count: int = 0
|
||||
var missed_packets: int = 0
|
||||
var online: bool = false ## Состояние связи с ФС
|
||||
var command_done: bool = true
|
||||
var currecnt_command: Array = [GROUP.BASE, CmdCode.START_SESSION]
|
||||
|
||||
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() and command_done:
|
||||
if _status == _stream.STATUS_CONNECTED:
|
||||
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
|
||||
send_count = 0
|
||||
command_done = true
|
||||
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 +168,8 @@ 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,92 +180,89 @@ 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(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)
|
||||
func send_fs_data() -> bool:
|
||||
if _status != _stream.STATUS_CONNECTED:
|
||||
print("Send_fs_data Error: Stream is not currently connected.")
|
||||
return false
|
||||
var send_packet = command_stack.pop_front()
|
||||
currecnt_command[0] = send_packet.decode_u8(GROUP_OFFSET)
|
||||
currecnt_command[1] = send_packet.decode_u8(CMD_OFFSET)
|
||||
command_done = false
|
||||
var error: int = _stream.put_data(send_packet)
|
||||
if error != OK:
|
||||
print("Error writing to stream: ", error)
|
||||
return false
|
||||
return true
|
||||
|
||||
# Приемник данных от ФС
|
||||
func parse_data(data_from_fs: PackedByteArray) -> void:
|
||||
var GRP = data_from_fs.decode_u8(0x0)
|
||||
var CMD = data_from_fs.decode_u8(0x1)
|
||||
if GRP == currecnt_command[0] and CMD == currecnt_command[1]:
|
||||
command_done = true
|
||||
|
||||
func start_session(counter: int, client: StreamPeer):
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.START_SESSION, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
func start_session():
|
||||
command_stack = []
|
||||
counter = 0
|
||||
send_count = 0
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.START_SESSION, INDEX_SIZE)
|
||||
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)
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size)
|
||||
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):
|
||||
## Constant модуляция
|
||||
func set_configure_state_msk_const():
|
||||
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 packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter)
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size)
|
||||
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)
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_GEN_STATUS, index_size)
|
||||
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)
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.STATUS_CAN_MACRO, index_size)
|
||||
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)
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.SET_CARRIER, index_size)
|
||||
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)
|
||||
var packet = _form_packet(GROUP.RF, CmdCode.SET_ATT, index_size)
|
||||
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)
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_WRITE, index_size)
|
||||
packet.encode_u16(0x08, 0x28)
|
||||
packet.encode_u8(0x1C, 0x01)
|
||||
packet.encode_u8(0x1D, 0x42)
|
||||
@@ -200,35 +270,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():
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.READ_CARRIER, INDEX_SIZE)
|
||||
send_packet_to(packet)
|
||||
|
||||
func get_carrier(counter: int, client: StreamPeer):
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.READ_CARRIER, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
func get_att_batch():
|
||||
var packet = _form_packet(GROUP.RF, CmdCode.READ_ATT, INDEX_SIZE)
|
||||
send_packet_to(packet)
|
||||
|
||||
func get_gen_state():
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.READ_GEN_STATUS, INDEX_SIZE)
|
||||
send_packet_to(packet)
|
||||
|
||||
func get_att_batch(counter: int, client: StreamPeer):
|
||||
var packet = _form_packet(GROUP.RF, CmdCode.READ_ATT, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
|
||||
|
||||
func get_gen_state(counter: int, client: StreamPeer):
|
||||
var packet = _form_packet(GROUP.GENERATOR, CmdCode.READ_GEN_STATUS, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
|
||||
|
||||
func get_base_current_temp(counter: int, client: StreamPeer):
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_GET_CURRENT_TEMP, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
|
||||
|
||||
func get_base_can_macro(counter: int, client: StreamPeer):
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_READ, INDEX_SIZE, counter)
|
||||
send_packet_to(packet, client)
|
||||
func get_base_current_temp():
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_GET_CURRENT_TEMP, INDEX_SIZE)
|
||||
send_packet_to(packet)
|
||||
|
||||
func get_base_can_macro():
|
||||
var packet = _form_packet(GROUP.BASE, CmdCode.BASE_CAN_MACRO_READ, INDEX_SIZE)
|
||||
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()
|
||||
|
||||
1
scripts/FS.gd.uid
Normal file
1
scripts/FS.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://c71cpdbr0mai8
|
||||
449
scripts/PRD.gd
449
scripts/PRD.gd
@@ -23,10 +23,11 @@ var att_fs_2: float
|
||||
var att_fs_3: float
|
||||
var status_pribor = null
|
||||
var save_path = "res://saves/"
|
||||
const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
|
||||
var current_meta: Array = [Constants.META.MODUL_UM_1, Constants.META.MODUL_UM_2, Constants.META.MODUL_UM_3, Constants.META.MODUL_UM_28]
|
||||
var modul_um: Array = [0, 0, 0, 0]
|
||||
var receive_yau_counter: Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
|
||||
const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
|
||||
const TIMER_BLOCK_EMS: float = 2.0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -150,6 +151,11 @@ func _ready() -> void:
|
||||
node_select_yau_07b.get_node2(1, 3).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 3).add_item(key)
|
||||
|
||||
_setup_mouse_scroll(node_select_yau_07b.get_node2(1, 3))
|
||||
_setup_mouse_scroll(node_select_yau_07b.get_node2(1, 4))
|
||||
_setup_mouse_scroll(node_select_yau_07b_2.get_node2(1, 3))
|
||||
_setup_mouse_scroll(node_select_yau_07b_2.get_node2(1, 4))
|
||||
|
||||
node_select_yau_07b_3.get_node2(1, 3).add_item(' 15°')
|
||||
|
||||
## Заполненение списка аттенюатора
|
||||
@@ -199,40 +205,52 @@ func _ready() -> void:
|
||||
node_select_yau_07b_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_3'))
|
||||
|
||||
## FS 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, 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, 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, 2).connect('text_submitted', Callable(self, '_on_set_ferq').bind(Network.unit_fs_1))
|
||||
node_select_fs_1.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att').bind(Network.unit_fs_1))
|
||||
node_select_fs_1.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs').bind(Network.unit_fs_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').bind(Network.unit_fs_1))
|
||||
node_select_fs_1.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_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, 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, 2).connect('text_submitted', Callable(self, '_on_set_ferq').bind(Network.unit_fs_2))
|
||||
node_select_fs_2.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att').bind(Network.unit_fs_2))
|
||||
node_select_fs_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs').bind(Network.unit_fs_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').bind(Network.unit_fs_2))
|
||||
node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_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'))
|
||||
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, 2).connect('text_submitted', Callable(self, '_on_set_ferq').bind(Network.unit_fs_3))
|
||||
node_select_fs_3.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att').bind(Network.unit_fs_3))
|
||||
node_select_fs_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs').bind(Network.unit_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').bind(Network.unit_fs_3))
|
||||
node_select_fs_3.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro').bind(Network.unit_fs_3))
|
||||
node_select_fs_3.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_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.unit_fs_1.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.GOOD))
|
||||
Network.unit_fs_1.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.NONE))
|
||||
Network.unit_fs_1.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.ERROR))
|
||||
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, Constants.STATE_VAL.GOOD))
|
||||
Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.NONE))
|
||||
Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.ERROR))
|
||||
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2))
|
||||
|
||||
Network.unit_fs_3.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.GOOD))
|
||||
Network.unit_fs_3.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.NONE))
|
||||
Network.unit_fs_3.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.ERROR))
|
||||
Network.unit_fs_3.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_3))
|
||||
|
||||
self.add_child(timer_modul_um)
|
||||
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
|
||||
timer_modul_um.wait_time = TIMER_BLOCK_EMS
|
||||
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)
|
||||
_on_burger_button(true)
|
||||
|
||||
|
||||
func add_signs_scene():
|
||||
@@ -324,7 +342,7 @@ 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():
|
||||
@@ -398,15 +416,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 +455,73 @@ 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_1(fs_1_data):
|
||||
var GRP = fs_1_data.decode_u8(0x0)
|
||||
var CMD = fs_1_data.decode_u8(0x1)
|
||||
## Процесс обработки данных от модулей ФС в таблице
|
||||
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:
|
||||
node_select = node_select_fs_3
|
||||
ray_node_path = $TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1
|
||||
fs_control_node_path = $TabContainer/PRD/body_grid/litera_1/fs_control
|
||||
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.set_node_text(2, 5, 'Отключен')
|
||||
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)) + ' МГц')
|
||||
|
||||
|
||||
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)) + ' МГц')
|
||||
node_select.set_node_text(2, 7, str(fs_data.decode_u16(0x20)) + ' МГц')
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
@@ -585,6 +569,7 @@ func draw_tabl(tbl: Node, row: Array, count_row: int):
|
||||
|
||||
|
||||
func _on_data_received(data_from_yau_07):
|
||||
$TabContainer/PRD/Label_dkm.text = 'DKM: ' + str(Network.unit.status.decode_u8(Constants.DataIndices.DKM))
|
||||
## УКП
|
||||
for i in range(6): ## Мощность от УКП_1
|
||||
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
|
||||
@@ -708,10 +693,6 @@ 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)
|
||||
$load_status_yau.value = 0
|
||||
emit_signal('read_ems_g_start')
|
||||
$load_status_yau.visible = true
|
||||
@@ -763,28 +744,11 @@ func _on_modul_um(item_from_ray_1: int, node: Node):
|
||||
else:
|
||||
return
|
||||
|
||||
if modul_um.has(0x2000) or modul_um.has(0x8000):
|
||||
timer_modul_um.wait_time = 2.3
|
||||
timer_modul_um.start()
|
||||
|
||||
|
||||
## Таймер для модуляции УМ
|
||||
func _on_timer_modul_um():
|
||||
if modul_um.has(0x2000) or modul_um.has(0x8000):
|
||||
for i in range(3):
|
||||
if modul_um[i] == 0x8000:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, current_meta[i])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i])
|
||||
elif modul_um[i] == 0x2000:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, current_meta[i])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i])
|
||||
|
||||
if current_meta[i] == Constants.META.MODUL_UM_1:
|
||||
modul_um[3] = modul_um[i]
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, Constants.META.MODUL_UM_28)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i])
|
||||
else:
|
||||
timer_modul_um.stop()
|
||||
const DATA_FOR_UNBLOCK_EMS: int = 6666
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G, DATA_FOR_UNBLOCK_EMS)
|
||||
|
||||
|
||||
## Включение/отключение сигнала ФГОЗ
|
||||
@@ -862,34 +826,42 @@ 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)
|
||||
func _on_port_changed(client_addr: String, unit_fs_client: Node, status) -> void:
|
||||
var loging = 'Соединение ...' if status == Constants.STATE_VAL.NONE else 'Подключено' if status == Constants.STATE_VAL.GOOD else 'Ошибка'
|
||||
var color = Color.AQUAMARINE if status == Constants.STATE_VAL.GOOD else Color.DARK_GRAY if status == Constants.STATE_VAL.NONE else Color.CRIMSON
|
||||
|
||||
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.set_node_text(2, 1, loging)
|
||||
$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)
|
||||
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.set_node_text(2, 1, loging)
|
||||
$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)
|
||||
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.set_node_text(2, 1, loging)
|
||||
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = color
|
||||
|
||||
|
||||
# Установка формы сигнала (модуляция константа или msk)
|
||||
func _on_modul_fs_1(modulation_select_1) -> void:
|
||||
func _on_modul_fs(modulation_select_1: int, unit_fs_client: Node) -> void:
|
||||
if modulation_select_1 == 0:
|
||||
Network.set_configure_gen_const_1()
|
||||
unit_fs_client.set_configure_state_msk_const()
|
||||
elif modulation_select_1 == 1:
|
||||
Network.set_configure_gen_msk_1()
|
||||
unit_fs_client.set_configure_state_msk_modul_1()
|
||||
|
||||
|
||||
# Установка и получение статуса генератора фс
|
||||
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()
|
||||
unit_fs_client.get_base_current_temp()
|
||||
|
||||
|
||||
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,110 +876,28 @@ 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))
|
||||
save_settings(float(att), 0)
|
||||
func _on_set_att(att: String, unit_fs_client: Node):
|
||||
unit_fs_client.set_att_batch(float(att))
|
||||
if unit_fs_client == Network.unit_fs_1:
|
||||
save_settings(float(att), 0)
|
||||
elif unit_fs_client == Network.unit_fs_2:
|
||||
save_settings(float(att), 1)
|
||||
elif unit_fs_client == Network.unit_fs_3:
|
||||
save_settings(float(att), 2)
|
||||
unit_fs_client.get_att_batch()
|
||||
|
||||
|
||||
func _on_set_base_can_macro(can_freq: String):
|
||||
Network.set_can_macro(int(can_freq))
|
||||
func _on_set_base_can_macro(can_freq: String, unit_fs_client: Node):
|
||||
unit_fs_client.set_base_can_macro(int(can_freq))
|
||||
unit_fs_client.get_base_can_macro()
|
||||
|
||||
|
||||
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()
|
||||
|
||||
|
||||
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):
|
||||
Network.set_fs_attenuation_2(float(att))
|
||||
save_settings(float(att), 1)
|
||||
|
||||
|
||||
func _on_set_base_can_macro_2(can_freq: String):
|
||||
Network.set_can_macro_2(int(can_freq))
|
||||
|
||||
|
||||
func _on_status_can_macro_2(toggled_btn: bool):
|
||||
Network.status_can_macro_2(toggled_btn)
|
||||
|
||||
|
||||
func _on_modul_fs_2(modulation_select_2) -> void:
|
||||
if modulation_select_2 == 0:
|
||||
Network.set_configure_gen_const_2()
|
||||
elif modulation_select_2 == 1:
|
||||
Network.set_configure_gen_msk_2()
|
||||
|
||||
|
||||
## ФС 3
|
||||
func _on_get_status_3(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_3(inverted_state)
|
||||
Network.get_gen_state_3()
|
||||
|
||||
|
||||
func _on_set_ferq_3(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_3(freq_int)
|
||||
|
||||
|
||||
func _on_set_att_3(att: String):
|
||||
Network.set_fs_attenuation_3(float(att))
|
||||
save_settings(float(att), 2)
|
||||
|
||||
|
||||
func _on_set_base_can_macro_3(can_freq: String):
|
||||
Network.set_can_macro_3(int(can_freq))
|
||||
|
||||
|
||||
func _on_status_can_macro_3(toggled_btn: bool):
|
||||
Network.status_can_macro_3(toggled_btn)
|
||||
|
||||
|
||||
func _on_modul_fs_3(modulation_select_3) -> void:
|
||||
if modulation_select_3 == 0:
|
||||
Network.set_configure_gen_const_3()
|
||||
elif modulation_select_3 == 1:
|
||||
Network.set_configure_gen_msk_3()
|
||||
func _on_status_can_macro(toggled_btn: bool, unit_fs_client: Node):
|
||||
unit_fs_client.status_can_macro_exec(toggled_btn)
|
||||
|
||||
|
||||
## Switch panel
|
||||
@@ -1015,8 +905,9 @@ 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()
|
||||
Network.unit_fs_3.get_gen_state()
|
||||
|
||||
|
||||
func _on_control_button() -> void:
|
||||
@@ -1030,8 +921,10 @@ func _on_emsg_select() -> void:
|
||||
set_tab_and_buttons(2, 'select_ems_g', 'texture_ems_g')
|
||||
|
||||
|
||||
func _on_mfs_select() -> void:
|
||||
set_tab_and_buttons(3, 'select_fs', 'texture_fs')
|
||||
func _on_monitoring_select() -> void:
|
||||
set_tab_and_buttons(3, 'select_monitoring', 'texture_monitoring')
|
||||
$load_status_yau.visible = false
|
||||
# Need Disconnect to yau-07
|
||||
|
||||
|
||||
func _on_burger_button(toggled_on: bool) -> void:
|
||||
@@ -1076,7 +969,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
|
||||
@@ -1102,3 +995,51 @@ func save_settings(to_att_change: float, mode: int):
|
||||
file.close()
|
||||
|
||||
Constants.read_file()
|
||||
|
||||
|
||||
func on_ems_block(toggled_on: bool) -> void:
|
||||
if toggled_on:
|
||||
timer_modul_um.start()
|
||||
else:
|
||||
timer_modul_um.stop()
|
||||
|
||||
|
||||
var hovered_option_button: OptionButton = null
|
||||
|
||||
func _setup_mouse_scroll(option_button: OptionButton):
|
||||
option_button.mouse_entered.connect(_on_option_button_mouse_entered.bind(option_button))
|
||||
option_button.mouse_exited.connect(_on_option_button_mouse_exited.bind(option_button))
|
||||
|
||||
func _on_option_button_mouse_entered(option_button: OptionButton):
|
||||
hovered_option_button = option_button
|
||||
option_button.mouse_filter = Control.MOUSE_FILTER_STOP
|
||||
|
||||
func _on_option_button_mouse_exited(option_button: OptionButton):
|
||||
if hovered_option_button == option_button:
|
||||
hovered_option_button = null
|
||||
option_button.mouse_filter = Control.MOUSE_FILTER_PASS
|
||||
|
||||
# Обработка прокрутки колеса мыши
|
||||
func _input(event):
|
||||
if event is InputEventMouseButton and hovered_option_button != null:
|
||||
if event.pressed:
|
||||
_handle_mouse_scroll(event, hovered_option_button)
|
||||
|
||||
func _handle_mouse_scroll(event: InputEventMouseButton, option_button: OptionButton):
|
||||
var current_index = option_button.selected
|
||||
var item_count = option_button.get_item_count()
|
||||
var new_index = current_index
|
||||
|
||||
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||
new_index = wrapi(current_index - 1, 0, item_count)
|
||||
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||
new_index = wrapi(current_index + 1, 0, item_count)
|
||||
else:
|
||||
return
|
||||
|
||||
# Устанавливаем новый индекс
|
||||
option_button.selected = new_index
|
||||
# Вручную испускаем сигнал
|
||||
option_button.emit_signal("item_selected", new_index)
|
||||
|
||||
get_viewport().set_input_as_handled()
|
||||
|
||||
1
scripts/PRD.gd.uid
Normal file
1
scripts/PRD.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://ba6evmqccy62x
|
||||
@@ -1,6 +1,6 @@
|
||||
extends Node
|
||||
var UNICAST_PORT: int = 50100
|
||||
var UNICAST_ADDRESS: String = '10.1.1.100'
|
||||
var UNICAST_PORT: int = 50003
|
||||
var UNICAST_ADDRESS: String = '10.1.1.3'
|
||||
const BROADCAST_PORT: int = 50000
|
||||
const DEFAULT_ADDRESS: String = '10.1.1.11'
|
||||
const DEFAULT_PORT: String = '50011'
|
||||
@@ -54,18 +54,18 @@ const ROWS_FS: Array = [
|
||||
[TableNode, TableNode, TableNode],
|
||||
[TableNode, Switch, TableNode],]
|
||||
const ADDRESSES: Array = [
|
||||
['ПРД-Н1', '10.1.1.11', 50011, MODE.PRD_H, '10.1.2.18', '10.1.2.19', ''],
|
||||
['ПРД-Н2', '10.1.1.21', 50021, MODE.PRD_H, '10.1.2.34', '10.1.2.35', ''],
|
||||
['ПРД-Н3', '10.1.1.31', 50031, MODE.PRD_H, '10.1.2.50', '10.1.2.51', ''],
|
||||
['ПРД-Н4', '10.1.1.41', 50041, MODE.PRD_H, '10.1.2.66', '10.1.2.67', ''],
|
||||
['ПРД-В1', '10.1.1.12', 50012, MODE.PRD_B, '10.1.2.20', '10.1.2.21', ''],
|
||||
['ПРД-В2', '10.1.1.22', 50022, MODE.PRD_B, '10.1.2.36', '10.1.2.37', ''],
|
||||
['ПРД-В3', '10.1.1.32', 50032, MODE.PRD_B, '10.1.2.52', '10.1.2.53', ''],
|
||||
['ПРД-В4', '10.1.1.42', 50042, MODE.PRD_B, '10.1.2.68', '10.1.2.69', ''],
|
||||
['ПРД-К1', '10.1.1.13', 50013, MODE.PRD_K, '10.1.2.22', '10.1.2.23', '10.1.2.17'],
|
||||
['ПРД-К2', '10.1.1.23', 50023, MODE.PRD_K, '10.1.2.38', '10.1.2.39', '10.1.2.33'],
|
||||
['ПРД-К3', '10.1.1.33', 50033, MODE.PRD_K, '10.1.2.54', '10.1.2.55', '10.1.2.49'],
|
||||
['ПРД-К4', '10.1.1.43', 50043, MODE.PRD_K, '10.1.2.70', '10.1.2.71', '10.1.2.65']]
|
||||
['ПРД-Н1', '10.1.1.11', 50011, MODE.PRD_H, '10.1.2.12', '10.1.2.13', ''],
|
||||
['ПРД-Н2', '10.1.1.21', 50021, MODE.PRD_H, '10.1.2.22', '10.1.2.23', ''],
|
||||
['ПРД-Н3', '10.1.1.31', 50031, MODE.PRD_H, '10.1.2.32', '10.1.2.33', ''],
|
||||
['ПРД-Н4', '10.1.1.41', 50041, MODE.PRD_H, '10.1.2.42', '10.1.2.43', ''],
|
||||
['ПРД-В1', '10.1.1.12', 50012, MODE.PRD_B, '10.1.2.14', '10.1.2.15', ''],
|
||||
['ПРД-В2', '10.1.1.22', 50022, MODE.PRD_B, '10.1.2.24', '10.1.2.25', ''],
|
||||
['ПРД-В3', '10.1.1.32', 50032, MODE.PRD_B, '10.1.2.34', '10.1.2.35', ''],
|
||||
['ПРД-В4', '10.1.1.42', 50042, MODE.PRD_B, '10.1.2.44', '10.1.2.45', ''],
|
||||
['ПРД-К1', '10.1.1.13', 50013, MODE.PRD_K, '10.1.2.16', '10.1.2.17', '10.1.2.11'],
|
||||
['ПРД-К2', '10.1.1.23', 50023, MODE.PRD_K, '10.1.2.26', '10.1.2.27', '10.1.2.21'],
|
||||
['ПРД-К3', '10.1.1.33', 50033, MODE.PRD_K, '10.1.2.36', '10.1.2.37', '10.1.2.31'],
|
||||
['ПРД-К4', '10.1.1.43', 50043, MODE.PRD_K, '10.1.2.46', '10.1.2.47', '10.1.2.41']]
|
||||
const INPUT_EMS_G: Array = [
|
||||
'01 :34',
|
||||
'02 :35',
|
||||
@@ -427,10 +427,15 @@ var FS_ATT: Dictionary = {
|
||||
func _ready() -> void:
|
||||
# Считывание аргументов с консоли (путь сохранения)
|
||||
var args = OS.get_cmdline_user_args()
|
||||
for i in range(args.size()):
|
||||
if args[i] == "addr" and i + 1 < args.size():
|
||||
UNICAST_PORT = 50000 + int(args[i + 1])
|
||||
UNICAST_ADDRESS = '10.1.1.%s' % args[i + 1]
|
||||
var i = 0
|
||||
while i < args.size():
|
||||
if args[i] == "--addr" or args[i] == "-a":
|
||||
if i + 1 < args.size():
|
||||
var addr_suffix: int = int(args[i + 1])
|
||||
UNICAST_PORT = 50000 + addr_suffix
|
||||
UNICAST_ADDRESS = '10.1.1.%s' % addr_suffix
|
||||
i += 1 # Пропускаем следующий аргумент
|
||||
i += 1
|
||||
read_file()
|
||||
|
||||
|
||||
|
||||
1
scripts/constants.gd.uid
Normal file
1
scripts/constants.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://7jms4dbunfm3
|
||||
@@ -28,7 +28,7 @@ var flag_continue_control: bool = false
|
||||
var prep_set_ug: int = 0
|
||||
|
||||
|
||||
class Logger extends Node:
|
||||
class Loger extends Node:
|
||||
var log_level: String = "INFO"
|
||||
var log_array: Node
|
||||
|
||||
@@ -58,9 +58,9 @@ class Logger extends Node:
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Network.connect('data_from_fs_1', _on_data_fs.bind('ФС-1'))
|
||||
Network.connect('data_from_fs_2', _on_data_fs.bind('ФС-2'))
|
||||
Network.connect('data_from_fs_3', _on_data_fs.bind('ФС-3'))
|
||||
Network.unit_fs_1.connect("data_fs", Callable(self, "_on_data_fs").bind('ФС-1'))
|
||||
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind('ФС-2'))
|
||||
Network.unit_fs_3.connect("data_fs", Callable(self, "_on_data_fs").bind('ФС-3'))
|
||||
|
||||
self.add_child(timer)
|
||||
self.add_child(timer_03)
|
||||
@@ -286,58 +286,23 @@ func _draw_control_panel_prd(pribor):
|
||||
$socket_ym_lb/blok_ym_litera_1.visible = true
|
||||
|
||||
|
||||
func fs_1_setup(freq: int, att: float):
|
||||
func fs_setup(unit_fs: Node, freq: int, att: float):
|
||||
if not flag_continue_control:
|
||||
return
|
||||
command_fs_off(unit_fs)
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status(true) ## отключен на true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_1()
|
||||
Network.status_can_macro_1(false)
|
||||
Network.set_fs_ferq_carrier(freq * 1_000_000)
|
||||
Network.set_fs_attenuation(att) # Для литеры 2, 4, 6
|
||||
Network.set_can_macro(freq)
|
||||
Network.status_can_macro_1(true)
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status(false) ## отключен на true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_1()
|
||||
unit_fs.status_can_macro_exec(false)
|
||||
unit_fs.set_carrier(freq * 1_000_000)
|
||||
unit_fs.set_att_batch(att) # Для литеры 2, 4, 6
|
||||
unit_fs.set_base_can_macro(freq)
|
||||
unit_fs.status_can_macro_exec(true)
|
||||
unit_fs.set_gen_state(false) ## отключен на true
|
||||
unit_fs.get_gen_state()
|
||||
|
||||
|
||||
func fs_2_setup(freq: int, att: float):
|
||||
if not flag_continue_control:
|
||||
return
|
||||
await get_tree().create_timer(0.8).timeout
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_2()
|
||||
Network.status_can_macro_2(false)
|
||||
Network.set_fs_ferq_carrier_2(freq * 1_000_000)
|
||||
Network.set_fs_attenuation_2(float(att)) # Для литеры 3, 5, 7
|
||||
Network.set_can_macro_2(freq)
|
||||
Network.status_can_macro_2(true)
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status_2(false) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_2()
|
||||
|
||||
|
||||
func fs_3_setup(freq: int, att: float):
|
||||
if not flag_continue_control:
|
||||
return
|
||||
await get_tree().create_timer(1.8).timeout
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_3()
|
||||
Network.status_can_macro_3(false)
|
||||
Network.set_fs_ferq_carrier_3(freq * 1_000_000)
|
||||
Network.set_fs_attenuation_3(float(att)) # Для литеры 1
|
||||
Network.set_can_macro_3(freq)
|
||||
Network.status_can_macro_3(true)
|
||||
await get_tree().create_timer(0.2).timeout
|
||||
Network.set_fs_gen_status_3(false) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_3()
|
||||
func command_fs_off(unit_fs: Node) -> void:
|
||||
unit_fs.set_gen_state(true)
|
||||
unit_fs.get_gen_state()
|
||||
|
||||
|
||||
func yau_07b_setup(angle_and_att: int):
|
||||
@@ -345,16 +310,8 @@ func yau_07b_setup(angle_and_att: int):
|
||||
return
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0x6, angle_and_att)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0x8, angle_and_att)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_2)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) ## Отключить модуляцию (литера 2)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) ## Отключить модуляцию (литера 3)
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0xA, 0)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000) ## Включить (Контроль) модуляцию (литера 1)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_28)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000)
|
||||
|
||||
|
||||
func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
|
||||
@@ -429,7 +386,7 @@ func _on_yau_received(status_yau):
|
||||
count_packet += 1
|
||||
|
||||
|
||||
func _on_yau_feedback_receive(_status_yau):
|
||||
func _on_yau_feedback_receive(status_yau):
|
||||
if logger and flag_continue_control:
|
||||
## Флаг для проверки настройки угла и аттенюации на двух литерах
|
||||
if Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+6) and Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+8):
|
||||
@@ -445,21 +402,19 @@ func _on_yau_feedback_receive(_status_yau):
|
||||
flag_ug = false
|
||||
$soc_y5/ug.state = Constants.STATE_VAL.NONE
|
||||
## Флаг для проверки модуяции на высоком
|
||||
if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2):
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_2:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000 and (not flag_modul_on_1):
|
||||
flag_modul_on_1 = true
|
||||
logger.info('✅ Модуляция УМ (2, 4, 6) включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_1):
|
||||
flag_modul_on_1 = false
|
||||
logger.info('🛈 Модуляция УМ (2, 4, 6) отключена!')
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_3:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000 and (not flag_modul_on_2):
|
||||
flag_modul_on_2 = true
|
||||
logger.info('✅ Модуляция УМ (3, 5, 7) включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_2):
|
||||
flag_modul_on_2 = false
|
||||
logger.info('🛈 Модуляция УМ (3, 5, 7) отключена!')
|
||||
if (status_yau.decode_u16(13) >> 1) & 1 and (not flag_modul_on_1):
|
||||
flag_modul_on_1 = true
|
||||
logger.info('✅ Модуляция УМ (2, 4, 6) включена!')
|
||||
elif (status_yau.decode_u16(13) >> 1) & 1 == 0 and (flag_modul_on_1):
|
||||
flag_modul_on_1 = false
|
||||
logger.info('🛈 Модуляция УМ (2, 4, 6) отключена!')
|
||||
|
||||
if (status_yau.decode_u16(13) >> 2) & 1 and (not flag_modul_on_2):
|
||||
flag_modul_on_2 = true
|
||||
logger.info('✅ Модуляция УМ (3, 5, 7) включена!')
|
||||
elif (status_yau.decode_u16(13) >> 2) & 1 == 0 and (flag_modul_on_2):
|
||||
flag_modul_on_2 = false
|
||||
logger.info('🛈 Модуляция УМ (3, 5, 7) отключена!')
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2):
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_1:
|
||||
@@ -475,7 +430,7 @@ func _on_start_super_control():
|
||||
$lbl_control.text = 'Контроль запущен'
|
||||
$lbl_control.modulate = Color.LIGHT_GRAY
|
||||
$log_array/await.visible = true
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
logger = Loger.new(get_node('log_array'))
|
||||
flag_continue_control = true
|
||||
|
||||
if (past_pribor != Constants.CURRENT_MODE):
|
||||
@@ -533,43 +488,68 @@ func _on_start_super_control():
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR
|
||||
logger.error("❌ ЯУ-07Б: Нет связи")
|
||||
|
||||
if flag_continue_control:
|
||||
flag_fs_1_ready = false
|
||||
flag_fs_2_ready = false
|
||||
flag_fs_3_ready = false
|
||||
if Network.unit_fs.online:
|
||||
var fs_freq: Array
|
||||
var fs_att_1: float
|
||||
var fs_att_2: float
|
||||
var fs_att_3: float
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
|
||||
fs_freq.append(Constants.FS_FREQ.f2)
|
||||
fs_att_1 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][0]
|
||||
fs_freq.append(Constants.FS_FREQ.f3)
|
||||
fs_att_2 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][1]
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
fs_freq.append(Constants.FS_FREQ.f4)
|
||||
fs_att_1 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][0]
|
||||
fs_freq.append(Constants.FS_FREQ.f5)
|
||||
fs_att_2 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][1]
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
fs_freq.append(Constants.FS_FREQ.f6)
|
||||
fs_att_1 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][0]
|
||||
fs_freq.append(Constants.FS_FREQ.f7)
|
||||
fs_att_2 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][1]
|
||||
fs_freq.append(Constants.FS_FREQ.f1)
|
||||
fs_att_3 = Constants.FS_ATT[Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]][2]
|
||||
fs_3_setup(fs_freq[2], fs_att_3)
|
||||
logger.info('🛈 Настройка модулей ФС %s Гц, [%s / %s / %s] АТТ' % [str(fs_freq), str(fs_att_1), str(fs_att_2), str(fs_att_3)])
|
||||
fs_1_setup(fs_freq[0], fs_att_1) # Гц
|
||||
fs_2_setup(fs_freq[1], fs_att_2) # Гц
|
||||
else:
|
||||
logger.info('❌ Настройка модулей ФС')
|
||||
_on_contol_err()
|
||||
if not flag_continue_control:
|
||||
return
|
||||
# Сброс флагов готовности
|
||||
flag_fs_1_ready = false
|
||||
flag_fs_2_ready = false
|
||||
flag_fs_3_ready = false
|
||||
|
||||
timer.set_one_shot(true)
|
||||
timer.set_wait_time(10)
|
||||
timer.start()
|
||||
var selected_id = self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()
|
||||
var device_key = Constants.ADDRESSES[selected_id][0]
|
||||
|
||||
if not await _setup_fs_module(Network.unit_fs_1, Constants.CURRENT_MODE, device_key, 0):
|
||||
return
|
||||
|
||||
if not await _setup_fs_module(Network.unit_fs_2, Constants.CURRENT_MODE, device_key, 1):
|
||||
return
|
||||
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
if not await _setup_fs_module(Network.unit_fs_3, Constants.CURRENT_MODE, device_key, 2, Constants.FS_FREQ.f1):
|
||||
return
|
||||
|
||||
# Запуск таймера
|
||||
timer.set_one_shot(true)
|
||||
timer.set_wait_time(10)
|
||||
timer.start()
|
||||
|
||||
|
||||
func _setup_fs_module(unit, mode, device_key, att_index, custom_freq = null) -> bool:
|
||||
if not unit.online:
|
||||
logger.info('❌ Модуль %s: нет связи' % unit.name)
|
||||
_on_contol_err()
|
||||
return false
|
||||
|
||||
var freq: int
|
||||
var att: float
|
||||
|
||||
match mode:
|
||||
Constants.MODE.PRD_H:
|
||||
freq = Constants.FS_FREQ.f2 if att_index == 0 else Constants.FS_FREQ.f3
|
||||
att = Constants.FS_ATT[device_key][att_index]
|
||||
|
||||
Constants.MODE.PRD_B:
|
||||
freq = Constants.FS_FREQ.f4 if att_index == 0 else Constants.FS_FREQ.f5
|
||||
att = Constants.FS_ATT[device_key][att_index]
|
||||
|
||||
Constants.MODE.PRD_K:
|
||||
freq = Constants.FS_FREQ.f6 if att_index == 0 else Constants.FS_FREQ.f7
|
||||
att = Constants.FS_ATT[device_key][att_index]
|
||||
if custom_freq != null:
|
||||
freq = custom_freq
|
||||
|
||||
logger.info('🛈 Настройка модуля %s: %s Гц, [%s] АТТ' % [unit.name, str(freq), str(att)])
|
||||
|
||||
if att > 20:
|
||||
logger.info('❌ Аттенюация выше 20 dB')
|
||||
_on_contol_err()
|
||||
return false
|
||||
|
||||
if att_index > 0:
|
||||
await get_tree().create_timer(1.5).timeout
|
||||
|
||||
fs_setup(unit, freq, att)
|
||||
return true
|
||||
|
||||
|
||||
func _status_cell(status):
|
||||
@@ -640,6 +620,7 @@ func set_bits(v, a, m):
|
||||
|
||||
|
||||
func _on_fs_status(META:int):
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
var control_button: Node = self.get_parent().get_parent().get_child(0).get_child(1).get_child(1)
|
||||
var texture_control_button: Node = self.get_parent().get_parent().get_child(0).get_child(1).get_child(8)
|
||||
if control_button.button_pressed or texture_control_button.button_pressed:
|
||||
@@ -652,7 +633,6 @@ func _on_fs_status(META:int):
|
||||
elif META == Constants.META.CI_1_OT_FS:
|
||||
logger.info('✅ СИ от ФС-3: Включен')
|
||||
|
||||
|
||||
if not flag_fs_1_ready:
|
||||
return
|
||||
|
||||
@@ -686,18 +666,9 @@ func _on_fs_status(META:int):
|
||||
|
||||
if (dkm >> 1) & 0x1 == 1 and (dkm >> 2) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
timer.stop()
|
||||
else:
|
||||
#flag_dkm = true
|
||||
#timer.stop()
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
_on_contol_err()
|
||||
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
if 1 == 1:#if (dkm >> 3) & 0x1 == 1:
|
||||
if (dkm >> 3) & 0x1 == 1:
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Включено'])
|
||||
$soc_DKM/DKM_2.state = Constants.STATE_VAL.GOOD
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
@@ -705,7 +676,7 @@ func _on_fs_status(META:int):
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи'])
|
||||
$soc_DKM/DKM_2.state = Constants.STATE_VAL.ERROR
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
if 1 == 1:#(dkm >> 4) & 0x1 == 1:
|
||||
if (dkm >> 4) & 0x1 == 1:
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
$soc_DKM/DKM_3.state = Constants.STATE_VAL.GOOD
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
@@ -716,15 +687,6 @@ func _on_fs_status(META:int):
|
||||
|
||||
if (dkm >> 3) & 0x1 == 1 and (dkm >> 4) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
timer.stop()
|
||||
else:
|
||||
#flag_dkm = true
|
||||
#timer.stop()
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
_on_contol_err()
|
||||
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
if (dkm >> 0) & 0x1 == 1:
|
||||
@@ -754,30 +716,13 @@ func _on_fs_status(META:int):
|
||||
|
||||
if (dkm >> 5) & 0x1 and (dkm >> 6) & 0x1 and (dkm >> 0) & 0x1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
timer.stop()
|
||||
else:
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
Network.get_gen_state_3()
|
||||
_on_contol_err()
|
||||
logger.info('🛈 ДКМ: %s ' % dkm)
|
||||
|
||||
|
||||
func _on_modul_um():
|
||||
if not flag_continue_control:
|
||||
return
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_2)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x8000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x8000)
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x8000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_28)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x2000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G, 6666)
|
||||
flag_dkm = false
|
||||
flag_start = true
|
||||
|
||||
@@ -793,22 +738,10 @@ func _on_start_timer_03():
|
||||
|
||||
func _on_timer_03():
|
||||
flag_control_add = false
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_2)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
command_fs_off(Network.unit_fs_1)
|
||||
command_fs_off(Network.unit_fs_2)
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_28)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
Network.get_gen_state_3()
|
||||
|
||||
command_fs_off(Network.unit_fs_3)
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
logger.info('🛈 Количество принятых пакетов от ЯУ-07Б: %s пкт.' % count_packet)
|
||||
logger.info('🛈 Максимальные значения мощностей от УКП-1: %s ' % str(array_pow_1))
|
||||
@@ -818,8 +751,13 @@ func _on_timer_03():
|
||||
|
||||
|
||||
func _on_contol_err():
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
logger.warning('❌❌❌')
|
||||
flag_continue_control = false
|
||||
command_fs_off(Network.unit_fs_1)
|
||||
command_fs_off(Network.unit_fs_2)
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
command_fs_off(Network.unit_fs_3)
|
||||
_status_prd()
|
||||
|
||||
|
||||
@@ -833,7 +771,7 @@ func _on_timer():
|
||||
if not flag_fs_2_ready:
|
||||
$Kasseta_FS/ref_A2.state = Constants.STATE_VAL.ERROR
|
||||
logger.warning('❌ Модуль ФС-2: нет связи')
|
||||
if not flag_fs_3_ready:
|
||||
if not flag_fs_3_ready and Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
$Kasseta_FS/FS_PRD_K.state = Constants.STATE_VAL.ERROR
|
||||
logger.warning('❌ Модуль ФС-3: нет связи')
|
||||
if not flag_fs_1_ready or not flag_fs_2_ready:
|
||||
@@ -849,7 +787,6 @@ func _on_timer():
|
||||
$soc_y5/ug.state = Constants.STATE_VAL.ERROR
|
||||
logger.warning('❌ Разьем УГ: нет связи')
|
||||
_on_contol_err()
|
||||
_on_timer_03()
|
||||
|
||||
|
||||
func _status_prd():
|
||||
@@ -867,7 +804,7 @@ func _status_prd():
|
||||
status += 1 if (node_cell_ind[18].state == Constants.STATE_VAL.GOOD) else 0
|
||||
|
||||
var pribor_ispraven: bool = false
|
||||
var min_dopusk: int = 10
|
||||
var min_dopusk: int = 40
|
||||
var status_need = count_cell-7 if Constants.CURRENT_MODE != Constants.MODE.PRD_K else count_cell+1
|
||||
if (status == status_need):
|
||||
pribor_ispraven = true
|
||||
|
||||
1
scripts/control_panel.gd.uid
Normal file
1
scripts/control_panel.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cfqdq0o4203w6
|
||||
@@ -39,6 +39,9 @@ func _on_read_ems_g():
|
||||
|
||||
|
||||
func _on_sync():
|
||||
if not get_parent().get_parent().get_child(0).get_child(1).get_child(2).is_pressed() or not $load_boadr.is_visible_in_tree():
|
||||
return
|
||||
|
||||
for index in 16:
|
||||
for row in 16:
|
||||
var chk_btn = node_select1.get_node2(index+2, row+3).get_child(1, false)
|
||||
|
||||
1
scripts/ems_g.gd.uid
Normal file
1
scripts/ems_g.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://vt613axjqlht
|
||||
@@ -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)
|
||||
@@ -56,7 +38,7 @@ signal port_error(error_str: String)
|
||||
class Socket extends PacketPeerUDP:
|
||||
func send_to(addr: String, port: int, data: PackedByteArray):
|
||||
self.set_dest_address(addr, port)
|
||||
self.put_packet(data)
|
||||
var _rc = self.put_packet(data)
|
||||
|
||||
|
||||
func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
@@ -65,6 +47,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
broadcast_packet = sock.get_packet()
|
||||
var addr_receive = sock.get_packet_ip()
|
||||
var port_receive = sock.get_packet_port()
|
||||
print('addr_receive: ', addr_receive)
|
||||
if (ip_address_yau == addr_receive) and (ip_port_yau == port_receive):
|
||||
last_update_time_yau07 = 0.0
|
||||
unit.parse(broadcast_packet)
|
||||
@@ -81,39 +64,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 +77,10 @@ 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)
|
||||
add_child(unit_fs_3)
|
||||
## Настройка при старте программы
|
||||
set_config()
|
||||
|
||||
|
||||
@@ -141,36 +95,20 @@ 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)
|
||||
|
||||
state_machine_yau07()
|
||||
|
||||
match unit.process(delta):
|
||||
Error.OK: soc_unicast.send_to(ip_address_yau, ip_port_yau, unit.tx_data.slice(0, unit.tx_len))
|
||||
var rc = unit.process(delta)
|
||||
if rc == Error.OK:
|
||||
soc_unicast.send_to(ip_address_yau, ip_port_yau, unit.tx_data.slice(0, unit.tx_len))
|
||||
#Error.FAILED: print_debug('Ошибка отправки данных')
|
||||
|
||||
|
||||
@@ -185,7 +123,7 @@ func state_machine_yau07():
|
||||
Constants.STATE.READ_ISA:
|
||||
if fl_done:
|
||||
var ports_read = send_array.pop_front()
|
||||
unit.send_isa(unit.CmdCode.READ_ISA, ports_read[1])
|
||||
var _rc = unit.send_isa(unit.CmdCode.READ_ISA, ports_read[1])
|
||||
state = Constants.STATE.DONE
|
||||
## Режим записи в ИСА
|
||||
Constants.STATE.WRITE_ISA:
|
||||
@@ -193,7 +131,7 @@ func state_machine_yau07():
|
||||
var ports_write: Array = send_array.pop_front()
|
||||
if ports_write[0] == 'wr':
|
||||
var key = ports_write[1].keys()
|
||||
unit.send_isa(unit.CmdCode.WRITE_ISA, [key[0], ports_write[1][key[0]]])
|
||||
var _rc = unit.send_isa(unit.CmdCode.WRITE_ISA, [key[0], ports_write[1][key[0]]])
|
||||
state = Constants.STATE.WAIT
|
||||
Constants.STATE.DONE:
|
||||
if fl_done:
|
||||
@@ -214,357 +152,81 @@ 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):
|
||||
func on_command_change_device(meta_device: Array):
|
||||
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)
|
||||
|
||||
if meta_device[5] != '':
|
||||
if unit_fs_3._stream:
|
||||
unit_fs_3.disconnect_fs()
|
||||
unit_fs_3.connect_to_host(meta_device[5], Constants.PORT_FS)
|
||||
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
setup_fs(unit_fs_1, meta_device)
|
||||
setup_fs(unit_fs_2, meta_device)
|
||||
if meta_device[5] != '':
|
||||
setup_fs(unit_fs_3, meta_device)
|
||||
|
||||
|
||||
|
||||
func setup_fs(unit_fs: Node, meta_device: Array) -> void:
|
||||
var mode_prd = meta_device[2]
|
||||
var device: String
|
||||
var freq: int
|
||||
var att: float
|
||||
|
||||
match mode_prd:
|
||||
Constants.MODE.PRD_H:
|
||||
device = _find_device_address(meta_device[0], 0, 4)
|
||||
freq = Constants.FS_FREQ.f2 if unit_fs == Network.unit_fs_1 else Constants.FS_FREQ.f3
|
||||
att = _get_att_value(device, unit_fs == Network.unit_fs_1)
|
||||
Constants.MODE.PRD_B:
|
||||
device = _find_device_address(meta_device[0], 4, 8)
|
||||
freq = Constants.FS_FREQ.f4 if unit_fs == Network.unit_fs_1 else Constants.FS_FREQ.f5
|
||||
att = _get_att_value(device, unit_fs == Network.unit_fs_1)
|
||||
Constants.MODE.PRD_K:
|
||||
device = _find_device_address(meta_device[0], 8, 12)
|
||||
freq = Constants.FS_FREQ.f6 if unit_fs == Network.unit_fs_1 else Constants.FS_FREQ.f7
|
||||
att = _get_att_value(device, unit_fs == Network.unit_fs_1)
|
||||
|
||||
if not unit_fs.online:
|
||||
return
|
||||
|
||||
_setup_fs_device(unit_fs, freq, att)
|
||||
|
||||
|
||||
func _find_device_address(address: String, start_idx: int, end_idx: int) -> String:
|
||||
for i_dev in range(start_idx, end_idx):
|
||||
if address == Constants.ADDRESSES[i_dev][1]:
|
||||
return Constants.ADDRESSES[i_dev][0]
|
||||
return ""
|
||||
|
||||
|
||||
func _get_att_value(device: String, is_unit_fs1: bool) -> float:
|
||||
return Constants.FS_ATT[device][0] if is_unit_fs1 else Constants.FS_ATT[device][1]
|
||||
|
||||
|
||||
# Асинхронная настройка модуля
|
||||
func _setup_fs_device(unit_fs: Node, freq: int, att: float) -> void:
|
||||
unit_fs.set_gen_state(false)
|
||||
unit_fs.get_gen_state()
|
||||
unit_fs.set_gen_state(true)
|
||||
unit_fs.set_carrier(freq * 1_000_000)
|
||||
unit_fs.set_att_batch(att)
|
||||
unit_fs.get_carrier()
|
||||
unit_fs.get_att_batch()
|
||||
unit_fs.get_base_current_temp()
|
||||
unit_fs.get_base_can_macro()
|
||||
unit_fs.status_can_macro_exec(true)
|
||||
unit_fs.get_gen_state()
|
||||
|
||||
1
scripts/network.gd.uid
Normal file
1
scripts/network.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dfqlaahd5qrmg
|
||||
1
scripts/nine-patch-button.gd.uid
Normal file
1
scripts/nine-patch-button.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://d1ouumqv510su
|
||||
1
scripts/switch.gd.uid
Normal file
1
scripts/switch.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://bgkbufd7o7ayy
|
||||
1
scripts/yau07.gd.uid
Normal file
1
scripts/yau07.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://w3mde4pxhufu
|
||||
1
scripts/кассета.gd.uid
Normal file
1
scripts/кассета.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://djwdj3fmhrxxg
|
||||
1
scripts/прибор.gd.uid
Normal file
1
scripts/прибор.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dp33khafq6hgu
|
||||
BIN
signals/k1.pcm
Normal file
BIN
signals/k1.pcm
Normal file
Binary file not shown.
1
table/switch.gdshader.uid
Normal file
1
table/switch.gdshader.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://cg7mlorjenpdy
|
||||
@@ -349,6 +349,7 @@ func get_rows_count() -> int:
|
||||
var nodes_count: int = 0
|
||||
for key in nodes:
|
||||
nodes_count += int(NODE_PREFIX in key)
|
||||
@warning_ignore("integer_division")
|
||||
return nodes_count / columns
|
||||
|
||||
|
||||
|
||||
1
table/table.gd.uid
Normal file
1
table/table.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://0lobo8mgb0yv
|
||||
BIN
Документация/saves/fs_setting
Normal file
BIN
Документация/saves/fs_setting
Normal file
Binary file not shown.
1
Документация/saves/ПРД-В1
Normal file
1
Документация/saves/ПРД-В1
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"294":65535,"296":0,"298":32768},"2":{"290":2,"292":0,"294":65535,"296":0,"298":32768},"3":{"290":3,"292":0,"294":65535,"296":0,"298":32768},"4":{"290":4,"292":0,"294":65535,"296":0,"298":32768},"5":{"290":5,"292":0,"294":65535,"296":0,"298":32768},"6":{"290":6,"292":0,"294":65535,"296":0,"298":32768},"7":{"290":7,"292":0,"294":65535,"296":0,"298":32768},"8":{"290":8,"292":0,"294":65535,"296":0,"298":32768},"9":{"290":9,"292":0,"294":65535,"296":0,"298":32768},"10":{"290":10,"292":0,"294":65535,"296":0,"298":32768},"11":{"290":11,"292":0,"294":65535,"296":0,"298":32768},"12":{"290":12,"292":0,"294":65535,"296":0,"298":32768},"13":{"290":13,"292":0,"294":65535,"296":0,"298":32768},"14":{"290":14,"292":0,"294":65535,"296":0,"298":32768},"15":{"290":15,"292":0,"294":65535,"296":0,"298":32768},"16":{"290":16,"292":0,"294":65535,"296":0,"298":32768},"47":{"290":47,"292":0,"294":65535,"296":0,"298":32768},"48":{"290":48,"292":2048,"294":65535,"296":0,"298":32768},"49":{"290":49,"292":4096,"294":65535,"296":0,"298":32768},"50":{"290":50,"292":0,"294":65535,"296":0,"298":32768},"51":{"290":51,"292":2048,"294":65535,"296":24575,"298":32768},"52":{"290":52,"292":4096,"294":65535,"296":24575,"298":32768},"53":{"290":53,"292":0,"294":65535,"296":0,"298":32768},"54":{"290":54,"292":0,"294":65535,"296":0,"298":32768},"55":{"290":55,"292":0,"294":65535,"296":0,"298":32768},"56":{"290":56,"292":0,"294":65535,"296":0,"298":32768},"57":{"290":57,"292":0,"294":65535,"296":0,"298":32768},"58":{"290":58,"292":0,"294":65535,"296":0,"298":32768},"59":{"290":59,"292":0,"294":65535,"296":0,"298":32768},"60":{"290":60,"292":0,"294":65535,"296":0,"298":32768},"61":{"290":61,"292":0,"294":65535,"296":0,"298":32768},"62":{"290":62,"292":0,"294":65535,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-В2
Normal file
1
Документация/saves/ПРД-В2
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"294":65535,"296":0,"298":32768},"2":{"290":2,"292":0,"294":65535,"296":0,"298":32768},"3":{"290":3,"292":0,"294":65535,"296":0,"298":32768},"4":{"290":4,"292":0,"294":65535,"296":0,"298":32768},"5":{"290":5,"292":0,"294":65535,"296":0,"298":32768},"6":{"290":6,"292":0,"294":65535,"296":0,"298":32768},"7":{"290":7,"292":0,"294":65535,"296":0,"298":32768},"8":{"290":8,"292":0,"294":65535,"296":0,"298":32768},"9":{"290":9,"292":0,"294":65535,"296":0,"298":32768},"10":{"290":10,"292":0,"294":65535,"296":0,"298":32768},"11":{"290":11,"292":0,"294":65535,"296":0,"298":32768},"12":{"290":12,"292":0,"294":65535,"296":0,"298":32768},"13":{"290":13,"292":0,"294":65535,"296":0,"298":32768},"14":{"290":14,"292":0,"294":65535,"296":0,"298":32768},"15":{"290":15,"292":0,"294":65535,"296":0,"298":32768},"16":{"290":16,"292":0,"294":65535,"296":0,"298":32768},"47":{"290":47,"292":0,"294":65535,"296":0,"298":32768},"48":{"290":48,"292":2048,"294":65535,"296":0,"298":32768},"49":{"290":49,"292":4096,"294":65535,"296":0,"298":32768},"50":{"290":50,"292":0,"294":65535,"296":0,"298":32768},"51":{"290":51,"292":2048,"294":65535,"296":24575,"298":32768},"52":{"290":52,"292":4096,"294":65535,"296":24575,"298":32768},"53":{"290":53,"292":0,"294":65535,"296":0,"298":32768},"54":{"290":54,"292":0,"294":65535,"296":0,"298":32768},"55":{"290":55,"292":0,"294":65535,"296":0,"298":32768},"56":{"290":56,"292":0,"294":65535,"296":0,"298":32768},"57":{"290":57,"292":0,"294":65535,"296":0,"298":32768},"58":{"290":58,"292":0,"294":65535,"296":0,"298":32768},"59":{"290":59,"292":0,"294":65535,"296":0,"298":32768},"60":{"290":60,"292":0,"294":65535,"296":0,"298":32768},"61":{"290":61,"292":0,"294":65535,"296":0,"298":32768},"62":{"290":62,"292":0,"294":65535,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-В3
Normal file
1
Документация/saves/ПРД-В3
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"294":65535,"296":0,"298":32768},"2":{"290":2,"292":0,"294":65535,"296":0,"298":32768},"3":{"290":3,"292":0,"294":65535,"296":0,"298":32768},"4":{"290":4,"292":0,"294":65535,"296":0,"298":32768},"5":{"290":5,"292":0,"294":65535,"296":0,"298":32768},"6":{"290":6,"292":0,"294":65535,"296":0,"298":32768},"7":{"290":7,"292":0,"294":65535,"296":0,"298":32768},"8":{"290":8,"292":0,"294":65535,"296":0,"298":32768},"9":{"290":9,"292":0,"294":65535,"296":0,"298":32768},"10":{"290":10,"292":0,"294":65535,"296":0,"298":32768},"11":{"290":11,"292":0,"294":65535,"296":0,"298":32768},"12":{"290":12,"292":0,"294":65535,"296":0,"298":32768},"13":{"290":13,"292":0,"294":65535,"296":0,"298":32768},"14":{"290":14,"292":0,"294":65535,"296":0,"298":32768},"15":{"290":15,"292":0,"294":65535,"296":0,"298":32768},"16":{"290":16,"292":0,"294":65535,"296":0,"298":32768},"47":{"290":47,"292":0,"294":65535,"296":0,"298":32768},"48":{"290":48,"292":2048,"294":65535,"296":0,"298":32768},"49":{"290":49,"292":4096,"294":65535,"296":0,"298":32768},"50":{"290":50,"292":0,"294":65535,"296":0,"298":32768},"51":{"290":51,"292":2048,"294":65535,"296":24575,"298":32768},"52":{"290":52,"292":4096,"294":65535,"296":24575,"298":32768},"53":{"290":53,"292":0,"294":65535,"296":0,"298":32768},"54":{"290":54,"292":0,"294":65535,"296":0,"298":32768},"55":{"290":55,"292":0,"294":65535,"296":0,"298":32768},"56":{"290":56,"292":0,"294":65535,"296":0,"298":32768},"57":{"290":57,"292":0,"294":65535,"296":0,"298":32768},"58":{"290":58,"292":0,"294":65535,"296":0,"298":32768},"59":{"290":59,"292":0,"294":65535,"296":0,"298":32768},"60":{"290":60,"292":0,"294":65535,"296":0,"298":32768},"61":{"290":61,"292":0,"294":65535,"296":0,"298":32768},"62":{"290":62,"292":0,"294":65535,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-В4
Normal file
1
Документация/saves/ПРД-В4
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"294":65535,"296":0,"298":32768},"2":{"290":2,"292":0,"294":65535,"296":0,"298":32768},"3":{"290":3,"292":0,"294":65535,"296":0,"298":32768},"4":{"290":4,"292":0,"294":65535,"296":0,"298":32768},"5":{"290":5,"292":0,"294":65535,"296":0,"298":32768},"6":{"290":6,"292":0,"294":65535,"296":0,"298":32768},"7":{"290":7,"292":0,"294":65535,"296":0,"298":32768},"8":{"290":8,"292":0,"294":65535,"296":0,"298":32768},"9":{"290":9,"292":0,"294":65535,"296":0,"298":32768},"10":{"290":10,"292":0,"294":65535,"296":0,"298":32768},"11":{"290":11,"292":0,"294":65535,"296":0,"298":32768},"12":{"290":12,"292":0,"294":65535,"296":0,"298":32768},"13":{"290":13,"292":0,"294":65535,"296":0,"298":32768},"14":{"290":14,"292":0,"294":65535,"296":0,"298":32768},"15":{"290":15,"292":0,"294":65535,"296":0,"298":32768},"16":{"290":16,"292":0,"294":65535,"296":0,"298":32768},"47":{"290":47,"292":0,"294":65535,"296":0,"298":32768},"48":{"290":48,"292":2048,"294":65535,"296":0,"298":32768},"49":{"290":49,"292":4096,"294":65535,"296":0,"298":32768},"50":{"290":50,"292":0,"294":65535,"296":0,"298":32768},"51":{"290":51,"292":2048,"294":65535,"296":24575,"298":32768},"52":{"290":52,"292":4096,"294":65535,"296":24575,"298":32768},"53":{"290":53,"292":0,"294":65535,"296":0,"298":32768},"54":{"290":54,"292":0,"294":65535,"296":0,"298":32768},"55":{"290":55,"292":0,"294":65535,"296":0,"298":32768},"56":{"290":56,"292":0,"294":65535,"296":0,"298":32768},"57":{"290":57,"292":0,"294":65535,"296":0,"298":32768},"58":{"290":58,"292":0,"294":65535,"296":0,"298":32768},"59":{"290":59,"292":0,"294":65535,"296":0,"298":32768},"60":{"290":60,"292":0,"294":65535,"296":0,"298":32768},"61":{"290":61,"292":0,"294":65535,"296":0,"298":32768},"62":{"290":62,"292":0,"294":65535,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-К1
Normal file
1
Документация/saves/ПРД-К1
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"296":0,"298":32768},"2":{"290":2,"292":0,"296":0,"298":32768},"3":{"290":3,"292":0,"296":0,"298":32768},"4":{"290":4,"292":0,"296":0,"298":32768},"5":{"290":5,"292":0,"296":0,"298":32768},"6":{"290":6,"292":0,"296":0,"298":32768},"7":{"290":7,"292":0,"296":0,"298":0},"8":{"290":8,"292":0,"296":0,"298":32768},"9":{"290":9,"292":0,"296":0,"298":32768},"10":{"290":10,"292":0,"296":0,"298":32768},"11":{"290":11,"292":0,"296":0,"298":32768},"12":{"290":12,"292":0,"296":0,"298":0},"13":{"290":13,"292":0,"296":0,"298":32768},"14":{"290":14,"292":0,"296":0,"298":0},"15":{"290":15,"292":0,"296":0,"298":32768},"16":{"290":16,"292":0,"296":0,"298":32768},"47":{"290":47,"292":256,"296":0,"298":32768},"48":{"290":48,"292":8192,"296":0,"298":32768},"49":{"290":49,"292":16384,"296":0,"298":32768},"50":{"290":50,"292":256,"296":0,"298":32768},"51":{"290":51,"292":8192,"296":0,"298":32768},"52":{"290":52,"292":16384,"296":0,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":256,"296":0,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-К2
Normal file
1
Документация/saves/ПРД-К2
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"296":0,"298":32768},"2":{"290":2,"292":0,"296":0,"298":32768},"3":{"290":3,"292":0,"296":0,"298":32768},"4":{"290":4,"292":0,"296":0,"298":32768},"5":{"290":5,"292":0,"296":0,"298":32768},"6":{"290":6,"292":0,"296":0,"298":32768},"7":{"290":7,"292":0,"296":0,"298":0},"8":{"290":8,"292":0,"296":0,"298":32768},"9":{"290":9,"292":0,"296":0,"298":32768},"10":{"290":10,"292":0,"296":0,"298":32768},"11":{"290":11,"292":0,"296":0,"298":32768},"12":{"290":12,"292":0,"296":0,"298":0},"13":{"290":13,"292":0,"296":0,"298":32768},"14":{"290":14,"292":0,"296":0,"298":0},"15":{"290":15,"292":0,"296":0,"298":32768},"16":{"290":16,"292":0,"296":0,"298":32768},"47":{"290":47,"292":256,"296":0,"298":32768},"48":{"290":48,"292":8192,"296":0,"298":32768},"49":{"290":49,"292":16384,"296":0,"298":32768},"50":{"290":50,"292":256,"296":0,"298":32768},"51":{"290":51,"292":8192,"296":0,"298":32768},"52":{"290":52,"292":16384,"296":0,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":256,"296":0,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-К3
Normal file
1
Документация/saves/ПРД-К3
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"296":0,"298":32768},"2":{"290":2,"292":0,"296":0,"298":32768},"3":{"290":3,"292":0,"296":0,"298":32768},"4":{"290":4,"292":0,"296":0,"298":32768},"5":{"290":5,"292":0,"296":0,"298":32768},"6":{"290":6,"292":0,"296":0,"298":32768},"7":{"290":7,"292":0,"296":0,"298":0},"8":{"290":8,"292":0,"296":0,"298":32768},"9":{"290":9,"292":0,"296":0,"298":32768},"10":{"290":10,"292":0,"296":0,"298":32768},"11":{"290":11,"292":0,"296":0,"298":32768},"12":{"290":12,"292":0,"296":0,"298":0},"13":{"290":13,"292":0,"296":0,"298":32768},"14":{"290":14,"292":0,"296":0,"298":0},"15":{"290":15,"292":0,"296":0,"298":32768},"16":{"290":16,"292":0,"296":0,"298":32768},"47":{"290":47,"292":256,"296":0,"298":32768},"48":{"290":48,"292":8192,"296":0,"298":32768},"49":{"290":49,"292":16384,"296":0,"298":32768},"50":{"290":50,"292":256,"296":0,"298":32768},"51":{"290":51,"292":8192,"296":0,"298":32768},"52":{"290":52,"292":16384,"296":0,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":256,"296":0,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-К4
Normal file
1
Документация/saves/ПРД-К4
Normal file
@@ -0,0 +1 @@
|
||||
{"1":{"290":1,"292":0,"296":0,"298":32768},"2":{"290":2,"292":0,"296":0,"298":32768},"3":{"290":3,"292":0,"296":0,"298":32768},"4":{"290":4,"292":0,"296":0,"298":32768},"5":{"290":5,"292":0,"296":0,"298":32768},"6":{"290":6,"292":0,"296":0,"298":32768},"7":{"290":7,"292":0,"296":0,"298":0},"8":{"290":8,"292":0,"296":0,"298":32768},"9":{"290":9,"292":0,"296":0,"298":32768},"10":{"290":10,"292":0,"296":0,"298":32768},"11":{"290":11,"292":0,"296":0,"298":32768},"12":{"290":12,"292":0,"296":0,"298":0},"13":{"290":13,"292":0,"296":0,"298":32768},"14":{"290":14,"292":0,"296":0,"298":0},"15":{"290":15,"292":0,"296":0,"298":32768},"16":{"290":16,"292":0,"296":0,"298":32768},"47":{"290":47,"292":256,"296":0,"298":32768},"48":{"290":48,"292":8192,"296":0,"298":32768},"49":{"290":49,"292":16384,"296":0,"298":32768},"50":{"290":50,"292":256,"296":0,"298":32768},"51":{"290":51,"292":8192,"296":0,"298":32768},"52":{"290":52,"292":16384,"296":0,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":256,"296":0,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
1
Документация/saves/ПРД-Н1
Normal file
1
Документация/saves/ПРД-Н1
Normal file
File diff suppressed because one or more lines are too long
1
Документация/saves/ПРД-Н2
Normal file
1
Документация/saves/ПРД-Н2
Normal file
File diff suppressed because one or more lines are too long
1
Документация/saves/ПРД-Н3
Normal file
1
Документация/saves/ПРД-Н3
Normal file
File diff suppressed because one or more lines are too long
1
Документация/saves/ПРД-Н4
Normal file
1
Документация/saves/ПРД-Н4
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user