diff --git a/Control.tscn b/Control.tscn deleted file mode 100644 index e69de29..0000000 diff --git a/project.godot b/project.godot index 41a4f91..6f2b4b4 100644 --- a/project.godot +++ b/project.godot @@ -21,9 +21,9 @@ config/icon="res://data/icon.png" [autoload] -Tools="*res://scenes/tools.gd" -REPSettings="*res://scenes/repsettings.gd" -REPNetwork="*res://scenes/repnetwork.gd" +Tools="*res://scripts/tools.gd" +REPSettings="*res://scripts/repsettings.gd" +REPNetwork="*res://scripts/repnetwork.gd" yau07="*res://scenes/yau07.gd" Log="*res://addons/godot-logger/scripts/logger.gd" Table="*res://table/table.gd" @@ -77,6 +77,7 @@ common/enable_object_picking=false [rendering] +renderer/rendering_method="gl_compatibility" gl_compatibility/item_buffer_size=8192 shader_compiler/shader_cache/strip_debug=true textures/default_filters/anisotropic_filtering_level=0 diff --git a/scenes/Sector.tscn b/scenes/Sector.tscn deleted file mode 100644 index 6e7d6b9..0000000 --- a/scenes/Sector.tscn +++ /dev/null @@ -1,22 +0,0 @@ -[gd_scene load_steps=4 format=3 uid="uid://c73ahpv8uiuc7"] - -[ext_resource type="Shader" path="res://shaders/sector.gdshader" id="1_aikdh"] - -[sub_resource type="ShaderMaterial" id="ShaderMaterial_xo5or"] -resource_local_to_scene = true -shader = ExtResource("1_aikdh") -shader_parameter/color = Color(1, 1, 1, 0.168627) -shader_parameter/clip_color = Color(1, 0.5, 0.5, 1) -shader_parameter/width = 45.0 -shader_parameter/band = 0.02 -shader_parameter/radius = 0.08 -shader_parameter/dir = 0.0 -shader_parameter/inner_clip = 0.045 - -[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_2lkm8"] - -[node name="строб" type="Sprite2D"] -material = SubResource("ShaderMaterial_xo5or") -position = Vector2(610, 600) -scale = Vector2(1108, 1108) -texture = SubResource("PlaceholderTexture2D_2lkm8") diff --git a/scenes/repnetwork.gd b/scenes/repnetwork.gd deleted file mode 100644 index ab1ecb7..0000000 --- a/scenes/repnetwork.gd +++ /dev/null @@ -1,36 +0,0 @@ -extends Node - - -var sock: PacketPeerUDP -var units: Dictionary - - -func _ready() -> void: - var addr = REPSettings.addr['уареп-пульт'][1] - var port = REPSettings.addr['уареп-пульт'][2] - sock = PacketPeerUDP.new() - sock.bind(port, addr) - for key in REPSettings.addr: - var prof = REPSettings.addr[key] - if prof[0] == 'yau07': - addr = REPSettings.addr[key][1] - port = REPSettings.addr[key][2] - var unit = yau07.YaU07.new([addr, port]) - var addr_port: String = '%s:%d' % [addr, port] - units[addr_port] = unit - Log.info('ЯУ-07: %s' % unit) - - -func _process(delta: float) -> void: - for unit in units.values() as Array[yau07.YaU07]: - unit.process(delta, sock) - - while sock.get_available_packet_count() > 0: - var data = sock.get_packet() - var addr = sock.get_packet_ip() - var port = sock.get_packet_port() - var addr_port: String = '%s:%d' % [addr, port] - if addr_port in units: - var unit: yau07.YaU07 = units[addr_port] - unit.parse(data) - return diff --git a/scenes/repsettings.gd b/scenes/repsettings.gd deleted file mode 100644 index fe1d208..0000000 --- a/scenes/repsettings.gd +++ /dev/null @@ -1,18 +0,0 @@ -extends Node - -@export var addr: Dictionary = { \ - 'уареп-пульт': ['udp', '10.1.1.160', 50160, 'IP-адрес ЯУ-07 прибора УФ'], - 'уареп-эмс': ['udp', '10.1.1.27', 50027, 'IP-адрес ЯУ-07 прибора УФ'], - 'уареп-яу07-2в': ['yau07', '10.1.1.34', 50034, 'IP-адрес ЯУ-07 прибора ПРД-В'], - 'уареп-яу07-2н': ['yau07', '10.1.1.33', 50033, 'IP-адрес ЯУ-07 прибора ПРД-Н'], - 'уареп-яу07-2к': ['yau07', '10.1.1.35', 50035, 'IP-адрес ЯУ-07 прибора ПРД-К'], - 'уареп-яу07-4в': ['yau07', '10.1.1.66', 50066, 'IP-адрес ЯУ-07 прибора ПРД-В'], - 'уареп-яу07-4н': ['yau07', '10.1.1.65', 50065, 'IP-адрес ЯУ-07 прибора ПРД-Н'], - 'уареп-яу07-4к': ['yau07', '10.1.1.67', 50067, 'IP-адрес ЯУ-07 прибора ПРД-К'], - 'уареп-яу07-1в': ['yau07', '10.1.1.18', 50018, 'IP-адрес ЯУ-07 прибора ПРД-В'], - 'уареп-яу07-1н': ['yau07', '10.1.1.17', 50017, 'IP-адрес ЯУ-07 прибора ПРД-Н'], - 'уареп-яу07-1к': ['yau07', '10.1.1.19', 50019, 'IP-адрес ЯУ-07 прибора ПРД-К'], - 'уареп-яу07-3в': ['yau07', '10.1.1.50', 50050, 'IP-адрес ЯУ-07 прибора ПРД-В'], - 'уареп-яу07-3н': ['yau07', '10.1.1.49', 50049, 'IP-адрес ЯУ-07 прибора ПРД-Н'], - 'уареп-яу07-3к': ['yau07', '10.1.1.51', 50051, 'IP-адрес ЯУ-07 прибора ПРД-Н'], - 'уареп-щ3': ['uart', '/dev/stty0', 115200, 1, 1, false, 10, 'Прибор Щ3 (скорость, стартовых, стоповых, чётность, таймаут)'] } diff --git a/scenes/threats.gd b/scenes/threats.gd index b0c3873..25f1bb9 100644 --- a/scenes/threats.gd +++ b/scenes/threats.gd @@ -12,7 +12,7 @@ class Threat: var aoa: float # Курсовой угол на источник сигнала, градусы. var freq: float # Частота несущей или центральная частота, МГц var width: float # Ширина занимаемого диапазона частот, МГц - var pow: float # Уровень принимаемого сигнала, дБм + var pow_rx: float # Уровень принимаемого сигнала, дБм var tick: int # Уровень принимаемого сигнала, дБм var freqm: String # Режим смены частоты var tmod: String # Тип модуляции diff --git a/scenes/tools.gd b/scenes/tools.gd deleted file mode 100644 index bf9720a..0000000 --- a/scenes/tools.gd +++ /dev/null @@ -1,60 +0,0 @@ -extends Node - - -func map_dec_to_rad(pos0: Vector2, pos: Vector2) -> Vector2: - """ Преобразует декартовые координаты в полярные """ - var x1: float = pos.x - pos0.x - var y1: float = pos.y - pos0.y - var ang: float = (atan2(y1, x1) * 180.0) / PI - ang += 360.0 * float(ang < 0.0) - var radius: float = hypot(x1, y1) - return Vector2(ang, radius) - - -func hypot(x: float, y: float) -> float: - return sqrt(x * x + y * y) - - -func is_overlap(x1, x2, y1, y2): - """ Проверяет пересечение диапазона x1, x2 с диапазоном y1, y2 """ - return max(x1, y1) <= min(x2, y2) - - -func ibytes_to_word(buf: PackedByteArray, i: int) -> int: - return buf[i] + (buf[i + 1] * 256) - - -func map_range(val: float, a0: float, a1: float, b0: float, b1: float) -> float: - """ Переводит значение val из диапазона a0...a1 в диапазон b0...b1 """ - return (((val - a0) * (b1 - b0)) / (a1 - a0)) + b0 - - -func type_is_num(val) -> bool: - """ Возвращает true, если val число, false - если иначе """ - return (typeof(val) == TYPE_INT) or (typeof(val) == typeof(0.0)) - - -func sort_ascending_0(a, b) -> bool: - return a[0] < b[0] - - -func is_point_in_polygon(pos: Vector2, p: PackedVector2Array) -> bool: - var j: int = len(p) - 1 - var odd_nodes: int = 0 - for i in range(len(p)): - if ((p[i].y < pos.y and p[j].y >= pos.y or p[j].y < pos.y and p[i].y >= pos.y) and (p[i].x <= pos.x or p[j].x <= pos.x)): - odd_nodes ^= int((p[i].x + (pos.y - p[i].y) / (p[j].y - p[i].y) * (p[j].x - p[i].x) < pos.x)) - j = i - return odd_nodes > 0 - - -func set_wordi(buf: Array, index, val): - """ - Устанавливает слово в байтовом массиве - :param buf: Байтовый массив - :param index: Индекс младшего байта слова в массиве - :param val: Значение слова для записи в батовый массив - :return: None """ - buf[index] = val & 0xff - buf[index + 1] = (val >> 8) & 0xff - diff --git a/scenes/yau07.gd b/scenes/yau07.gd index 4ca571b..2e7306c 100644 --- a/scenes/yau07.gd +++ b/scenes/yau07.gd @@ -30,7 +30,6 @@ class YaU07: var cmd_state = CmdState.UNCK # Состояние выполнения команды var cmd_result: = 1 # Результат выполнения команды. Устанавливается в ЯУ-07 var cmd_data: = PackedByteArray() # Данные команды. Устанавливается в ЯУ-07 - var cmd_code = null # Код команды var cmd_retry = 0 var tick = 0.0 var cmd_tick_tx = 0.0 @@ -174,13 +173,11 @@ class YaU07: i += 1 if rx_data_len == (status_len + 6): - cmd_code = null return true # Нет поля "ответ на команду", разбор пакета завершить var cmd_code_pos = status_len + 8 # Положение в приёмном буфере "код команды" if rx_data_len <= cmd_code_pos: return false - cmd_code = rx_data[cmd_code_pos] # "код команды" var cmd_status_pos = status_len + 9 # Положение в приёмном буфере "состояния выполнения команды" if rx_data_len <= cmd_status_pos: @@ -189,11 +186,11 @@ class YaU07: if cmd_result != 1: # Команда не выполнена return false + var cmd_code: CmdCode = rx_data[cmd_code_pos] # "код команды" if (cmd_code == CmdCode.READ_ISA) or (cmd_code == CmdCode.WRITE_ISA): parse_isa(rx_data, status_len) if (cmd_state == CmdState.WAIT) and (cmd_num_rx == cmd_num_tx): cmd_state = CmdState.DONE emit_signal('command_done', self) - return true diff --git a/scenes/работа.tscn b/scenes/работа.tscn index 3b353e5..02292ff 100644 --- a/scenes/работа.tscn +++ b/scenes/работа.tscn @@ -1,9 +1,10 @@ -[gd_scene load_steps=6 format=3 uid="uid://b276iygic5itk"] +[gd_scene load_steps=7 format=3 uid="uid://b276iygic5itk"] [ext_resource type="Script" path="res://scenes/работа.gd" id="1_qjoce"] [ext_resource type="PackedScene" uid="uid://b5kjdyxuwsot5" path="res://scenes/canvas.tscn" id="2_bl0yt"] [ext_resource type="PackedScene" uid="uid://bq7haw1ypiv48" path="res://scenes/frame.tscn" id="3_l1omj"] [ext_resource type="PackedScene" uid="uid://da7w3vkhadfwe" path="res://scenes/button_flat.tscn" id="4_5es2r"] +[ext_resource type="Script" path="res://table/table.gd" id="4_mqhcf"] [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_5ugj8"] @@ -24,7 +25,7 @@ metadata/_edit_lock_ = true [node name="canvas" parent="." instance=ExtResource("2_bl0yt")] metadata/_edit_lock_ = true -[node name="рамка-список-целей" parent="." instance=ExtResource("3_l1omj")] +[node name="frm_threats" parent="." instance=ExtResource("3_l1omj")] layout_mode = 0 offset_left = 1121.0 offset_top = 6.0 @@ -32,7 +33,13 @@ offset_right = 1594.0 offset_bottom = 642.0 text = "Список целей" -[node name="рамка-параметры-цели" parent="рамка-список-целей" instance=ExtResource("3_l1omj")] +[node name="tbl_threats" type="GridContainer" parent="frm_threats"] +layout_mode = 0 +offset_right = 40.0 +offset_bottom = 40.0 +script = ExtResource("4_mqhcf") + +[node name="рамка-параметры-цели" parent="frm_threats" instance=ExtResource("3_l1omj")] layout_mode = 0 offset_left = 5.0 offset_top = 313.0 @@ -40,7 +47,7 @@ offset_right = 467.0 offset_bottom = 632.0 text = "Параметры цели" -[node name="tbl_celi" type="GridContainer" parent="рамка-список-целей/рамка-параметры-цели"] +[node name="tbl_celi" type="GridContainer" parent="frm_threats/рамка-параметры-цели"] layout_mode = 1 anchors_preset = -1 anchor_left = 0.012 @@ -53,7 +60,7 @@ offset_right = -0.0100098 offset_bottom = -0.214996 columns = 2 -[node name="hdr_col0" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="hdr_col0" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -62,7 +69,7 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_5ugj8") text = "Параметр" horizontal_alignment = 1 -[node name="hdr_col1" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="hdr_col1" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -71,14 +78,14 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_5ugj8") text = "Значение" horizontal_alignment = 1 -[node name="node_02_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_02_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Тип модуляции" -[node name="node_02_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_02_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -86,14 +93,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "qam256" horizontal_alignment = 1 -[node name="node_03_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_03_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Ширина диапазона, МГц" -[node name="node_03_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_03_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -101,14 +108,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "2.5" horizontal_alignment = 1 -[node name="node_04_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_04_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Мощность, дБ" -[node name="node_04_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_04_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -116,14 +123,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "43" horizontal_alignment = 1 -[node name="node_05_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_05_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Время обновления" -[node name="node_05_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_05_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -131,14 +138,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "20:23:04" horizontal_alignment = 1 -[node name="node_06_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_06_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Режим перестройки" -[node name="node_06_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_06_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -146,14 +153,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "ЛЧМ" horizontal_alignment = 1 -[node name="node_07_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_07_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Скорость данных, бит/с" -[node name="node_07_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_07_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -161,14 +168,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "1.8М" horizontal_alignment = 1 -[node name="node_08_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_08_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Протокол" -[node name="node_08_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_08_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -176,14 +183,14 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "solo7" horizontal_alignment = 1 -[node name="node_09_00" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_09_00" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "Высота, м" -[node name="node_09_01" type="Label" parent="рамка-список-целей/рамка-параметры-цели/tbl_celi"] +[node name="node_09_01" type="Label" parent="frm_threats/рамка-параметры-цели/tbl_celi"] custom_minimum_size = Vector2(100, 0) layout_mode = 2 size_flags_horizontal = 3 @@ -191,7 +198,7 @@ theme_override_colors/font_color = Color(0.729412, 0.729412, 0.729412, 1) text = "128" horizontal_alignment = 1 -[node name="btn_add_thr" type="Button" parent="рамка-список-целей"] +[node name="btn_add_thr" type="Button" parent="frm_threats"] layout_mode = 0 offset_left = 6.0 offset_top = 4.0 @@ -201,7 +208,7 @@ scale = Vector2(1, 0.6) tooltip_text = "Добавить имитационную цель" text = "+" -[node name="btn_del_thr" type="Button" parent="рамка-список-целей"] +[node name="btn_del_thr" type="Button" parent="frm_threats"] layout_mode = 0 offset_left = 28.0 offset_top = 4.0 @@ -640,5 +647,5 @@ metadata/rfi_name = "" [connection signal="drag_begin" from="." to="." method="_on_drag_begin"] [connection signal="drag_continue" from="." to="." method="_on_drag_continue"] [connection signal="full_screen" from="." to="." method="_on_full_screen" flags=3] -[connection signal="button_down" from="рамка-список-целей/btn_add_thr" to="." method="_on_btn_down" binds= ["add_imit_threat"]] -[connection signal="button_down" from="рамка-список-целей/btn_del_thr" to="." method="_on_btn_down" binds= ["del_imit_threat"]] +[connection signal="button_down" from="frm_threats/btn_add_thr" to="." method="_on_btn_down" binds= ["add_imit_threat"]] +[connection signal="button_down" from="frm_threats/btn_del_thr" to="." method="_on_btn_down" binds= ["del_imit_threat"]] diff --git a/table/table.gd b/table/table.gd index 8805e5c..ec13200 100644 --- a/table/table.gd +++ b/table/table.gd @@ -194,7 +194,7 @@ func _init() -> void: assert(selector_size_proc.is_valid()) -func defaultselector_color_proc(i_row: int): +func defaultselector_color_proc(_i_row: int): return selector_color