Доработка. Исправления при сопряжении с ПО МП-550. Добавлена возможность удаления помехи по команде от МП-550.

This commit is contained in:
MaD_CaT
2023-11-16 14:26:19 +03:00
parent 4b3ed240d0
commit 6d29445153
6 changed files with 55 additions and 21 deletions

9
fs.gd
View File

@@ -110,6 +110,12 @@ class Fs:
pow = ''
width = ''
interfer = null
if isg == 0:
btn.set_texture_normal(btn_txr3)
elif isg == 1:
btn.set_texture_normal(btn_txr0)
elif isg == 2:
btn.set_texture_normal(btn_txr1)
func init_lbls(tab, x0, y0):
@@ -177,7 +183,6 @@ func on_item_selected(item_num):
g_active_fs.isg = item_num
if g_active_fs.isg == 0:
fs_off(g_active_fs)
g_active_fs.btn.set_texture_normal(btn_txr3)
elif g_active_fs.isg == 1:
g_active_fs.btn.set_texture_normal(btn_txr0)
elif g_active_fs.isg == 2:
@@ -244,7 +249,6 @@ func set_fs(interfer: Interfers.Interfer):
g_fs_dict[fs_num].interfer = interfer
if (interfer.active_fs != g_fs_dict[fs_num]) and (interfer.active_fs != null):
fs_off(interfer.active_fs)
interfer.active_fs.btn.set_texture_normal(btn_txr0)
interfer.active_fs = g_fs_dict[fs_num]
g_fs_dict[fs_num].pow = float(interfer.options['powp'])
g_fs_dict[fs_num].freq = float(freq)
@@ -292,3 +296,4 @@ func on_receive_msg8(data):
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass

View File

@@ -46,7 +46,6 @@ const SVK = ['Подготовка', 'Выполнено', 'Ошибка', 'За
# Номера колонок
const COLUMN_OPT = [[COLUMN_SVK, SVK]]
const COLUMN_OPT_BTN = [COLUMN_SVK]
const ID_ARRAY_LEN = 100 # Размер пула номеров целей
# Помеха
class Interfer:
@@ -184,3 +183,29 @@ func get_msg7_data():
func on_row_pressed(i_row: int, table):
pass
func off_interfer(json_data):
if not interfers.has(json_data['ispp']): return
var row_id = interfers[json_data['ispp']].row_id
if interfers[json_data['ispp']] != null:
if interfers[json_data['ispp']].active_fs != null:
fs.fs_off(interfers[json_data['ispp']].active_fs)
if g_table.get_rows_count() > row_id:
interfers.erase(json_data['ispp'])
g_table.remove_row(row_id)
for i in g_table.get_rows_count():
var interfer = g_table.get_node_user_data(0, i)
interfer.row_id = i
func check_interfers_state():
for interfer in interfers.values():
if interfer.active_fs != null:
fs.fs_off(interfer.active_fs)
interfer.active_fs = null
for interfer in interfers.values():
var cmd_state: int = fs.set_fs(interfer)
if interfer.svk == 3:
interfer.svk = cmd_state
var cell = g_table.get_node2(COLUMN_SVK, interfer.row_id)
cell.select(cmd_state)

View File

@@ -23,6 +23,7 @@ func _ready():
func on_timeout():
sock.put_packet(Threats.get_threats_data())
Interfers.check_interfers_state()
func on_receive(data):
@@ -36,9 +37,11 @@ func on_receive(data):
if json_data['ts'] == 6:
if not json_data.has('ispp'): return
if not ((json_data['ispp'] is int) or (json_data['ispp'] is float)): return
if not json_data.has('krp'): return
if not json_data.has('ss'): return
if not ((json_data['ss'] is int) or (json_data['ss'] is float)): return
if not json_data.has('krp'): return
if json_data['krp'] == 'off':
Interfers.off_interfer(json_data)
if not json_data.has('powp'): return
if not json_data.has('kni'): return
if not json_data.has('params'): return

View File

@@ -1,14 +1,14 @@
[gd_scene load_steps=7 format=3 uid="uid://87gtvqd7bbje"]
[ext_resource type="Script" path="res://main.gd" id="1_do14e"]
[ext_resource type="Script" path="res://table/table.gd" id="2_vhqjb"]
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_aeg5a"]
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_vmaqo"]
[ext_resource type="Texture2D" uid="uid://blpkoi7s8qugp" path="res://document-save-0.png" id="5_ysafc"]
[ext_resource type="Texture2D" uid="uid://wh7p3t4frxf" path="res://disconnect.png" id="6_8jprr"]
[ext_resource type="Script" path="res://main.gd" id="1_jt2ds"]
[ext_resource type="Script" path="res://table/table.gd" id="2_61iss"]
[ext_resource type="Texture2D" uid="uid://cex4jiu1pcj3x" path="res://edit-add-0.png" id="3_0aqi0"]
[ext_resource type="Texture2D" uid="uid://cx746np1wexnd" path="res://edit-add-1.png" id="4_s8cxp"]
[ext_resource type="Texture2D" uid="uid://blpkoi7s8qugp" path="res://document-save-0.png" id="5_8l4uh"]
[ext_resource type="Texture2D" uid="uid://wh7p3t4frxf" path="res://disconnect.png" id="6_hj3vd"]
[node name="main" type="Node2D"]
script = ExtResource("1_do14e")
script = ExtResource("1_jt2ds")
[node name="tabs" type="TabContainer" parent="."]
offset_right = 1594.0
@@ -28,7 +28,7 @@ offset_right = 1.0
offset_bottom = 10.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("2_vhqjb")
script = ExtResource("2_61iss")
node_type_file = "res://ячейка-1.tscn"
[node name="btn_add" type="TextureButton" parent="tabs/threats"]
@@ -37,8 +37,8 @@ offset_left = 1533.0
offset_top = -2.0
offset_right = 1581.0
offset_bottom = 46.0
texture_normal = ExtResource("3_aeg5a")
texture_pressed = ExtResource("4_vmaqo")
texture_normal = ExtResource("3_0aqi0")
texture_pressed = ExtResource("4_s8cxp")
[node name="btn_save" type="TextureButton" parent="tabs/threats"]
layout_mode = 0
@@ -46,7 +46,7 @@ offset_left = 1442.0
offset_top = -1.0
offset_right = 1490.0
offset_bottom = 47.0
texture_normal = ExtResource("5_ysafc")
texture_normal = ExtResource("5_8l4uh")
[node name="btn_del" type="TextureButton" parent="tabs/threats"]
layout_mode = 0
@@ -55,7 +55,7 @@ offset_top = 1.0
offset_right = 1547.0
offset_bottom = 67.0
scale = Vector2(0.62, 0.62)
texture_normal = ExtResource("6_8jprr")
texture_normal = ExtResource("6_hj3vd")
[node name="pomehi" type="Panel" parent="tabs"]
visible = false
@@ -66,7 +66,7 @@ layout_mode = 0
offset_top = 30.0
offset_right = 1587.0
offset_bottom = 886.0
script = ExtResource("2_vhqjb")
script = ExtResource("2_61iss")
node_type_file = "res://ячейка-1.tscn"
[node name="fs_rect" type="ReferenceRect" parent="tabs/pomehi"]

View File

@@ -6,6 +6,7 @@ var msg_counter : int = 0 # Счётчик отправленных п
var g_table: GridContainer
const TableCellType1 = preload('res://ячейка-1.tscn')
const TableCellType2 = preload('res://кнопка-3.tscn')
const TableCellType3 = preload('res://кнопка-4.tscn')

View File

@@ -1,7 +1,7 @@
[gd_scene load_steps=3 format=3 uid="uid://ccxre8mwhndjk"]
[ext_resource type="Texture2D" uid="uid://dag8n0gknjwak" path="res://индикатор-1-0.png" id="1_stfie"]
[ext_resource type="Texture2D" uid="uid://b3ext3w4ftgg2" path="res://индикатор-1-1.png" id="2_xepyc"]
[ext_resource type="Texture2D" uid="uid://dag8n0gknjwak" path="res://индикатор-1-0.png" id="1_vc7pt"]
[ext_resource type="Texture2D" uid="uid://b3ext3w4ftgg2" path="res://индикатор-1-1.png" id="2_tp80w"]
[node name="indicator_1" type="TextureButton"]
modulate = Color(1, 0.596078, 0.4, 1)
@@ -9,5 +9,5 @@ offset_right = 35.0
offset_bottom = 29.0
toggle_mode = true
button_mask = 0
texture_normal = ExtResource("1_stfie")
texture_pressed = ExtResource("2_xepyc")
texture_normal = ExtResource("1_vc7pt")
texture_pressed = ExtResource("2_tp80w")