From 164b3c2e775818141dd1bd6a75e8f14967d03db5 Mon Sep 17 00:00:00 2001 From: Maxim Date: Tue, 4 Feb 2025 01:56:22 +0300 Subject: [PATCH] commit test --- PRD_MP550.tscn | 49 ++++++++++++++++---- export_presets.cfg | 64 +++++++++++++++++++++++++++ scripts/PRD.gd | 103 ++++++++++++++++++++++++++++++++++--------- scripts/constants.gd | 14 +++++- scripts/modul_fs.gd | 3 +- scripts/network.gd | 4 +- table/node.tscn | 1 - 7 files changed, 200 insertions(+), 38 deletions(-) create mode 100644 export_presets.cfg diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index fcbc955..8bb1329 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=51 format=3 uid="uid://cvor2jm4xk3ha"] +[gd_scene load_steps=52 format=3 uid="uid://cvor2jm4xk3ha"] [ext_resource type="Script" path="res://scripts/PRD.gd" id="1_v273n"] [ext_resource type="Texture2D" uid="uid://cdxdluvyb5uei" path="res://table/on.png" id="2_dv7xx"] @@ -95,6 +95,8 @@ bg_color = Color(0.356863, 0.278431, 0.356863, 1) [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_7u7p7"] +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_1as41"] + [sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_723du"] size = Vector2(1600, 1200) @@ -219,6 +221,7 @@ toggle_mode = true text = "Модуль ФС" [node name="save_config" type="Button" parent="Background/side_panel"] +layout_mode = 0 offset_top = 832.0 offset_right = 216.0 offset_bottom = 868.0 @@ -229,6 +232,7 @@ theme_override_styles/pressed = SubResource("StyleBoxFlat_p247y") text = "Сохранить" [node name="load_config" type="Button" parent="Background/side_panel"] +layout_mode = 0 offset_top = 872.0 offset_right = 216.0 offset_bottom = 908.0 @@ -295,19 +299,31 @@ metadata/_edit_lock_ = true [node name="body_grid" type="GridContainer" parent="TabContainer/PRD"] layout_mode = 0 -offset_left = 488.0 -offset_top = -14.0 -offset_right = 1664.0 -offset_bottom = 690.0 +offset_left = 376.0 +offset_top = 14.0 +offset_right = 1552.0 +offset_bottom = 718.0 [node name="litera_2_4_6" type="GridContainer" parent="TabContainer/PRD/body_grid"] clip_contents = true custom_minimum_size = Vector2(700, 300) layout_mode = 2 size_flags_horizontal = 3 -columns = 4 +columns = 5 + +[node name="fs_control" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_2_4_6"] +custom_minimum_size = Vector2(350, 0) +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="space" type="Panel" parent="TabContainer/PRD/body_grid/litera_2_4_6"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_1as41") [node name="module_fs" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_2_4_6"] +visible = false custom_minimum_size = Vector2(250, 250) layout_mode = 2 @@ -366,6 +382,11 @@ layout_mode = 2 script = ExtResource("2_vmbyo") metadata/_edit_lock_ = true +[node name="space2" type="Panel" parent="TabContainer/PRD/body_grid/litera_2_4_6"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_1as41") + [node name="table_ukp_1" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_2_4_6"] layout_mode = 2 script = ExtResource("2_vmbyo") @@ -373,7 +394,7 @@ metadata/_edit_lock_ = true [node name="PSK" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_2_4_6"] material = ExtResource("3_3syd3") -position = Vector2(664, 11) +position = Vector2(906, 11) scale = Vector2(0.247968, 0.234167) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) @@ -400,7 +421,7 @@ metadata/_edit_lock_ = true [node name="litera_3_5_7" type="GridContainer" parent="TabContainer/PRD/body_grid"] custom_minimum_size = Vector2(500, 350) layout_mode = 2 -columns = 3 +columns = 5 [node name="module_fs" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_3_5_7"] custom_minimum_size = Vector2(250, 250) @@ -455,6 +476,11 @@ offset_top = 33.0 offset_right = 84.0 offset_bottom = 56.0 +[node name="space" type="Panel" parent="TabContainer/PRD/body_grid/litera_3_5_7"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_1as41") + [node name="yau_07b" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_3_5_7"] visible = false custom_minimum_size = Vector2(250, 200) @@ -503,6 +529,11 @@ layout_mode = 2 script = ExtResource("2_vmbyo") metadata/_edit_lock_ = true +[node name="space2" type="Panel" parent="TabContainer/PRD/body_grid/litera_3_5_7"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_1as41") + [node name="table_ukp_2" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_3_5_7"] layout_mode = 2 script = ExtResource("2_vmbyo") @@ -510,7 +541,7 @@ metadata/_edit_lock_ = true [node name="PSK2" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_3_5_7"] material = ExtResource("3_3syd3") -position = Vector2(665, 10) +position = Vector2(905, 10) scale = Vector2(0.247968, 0.234167) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) diff --git a/export_presets.cfg b/export_presets.cfg new file mode 100644 index 0000000..5d06ac2 --- /dev/null +++ b/export_presets.cfg @@ -0,0 +1,64 @@ +[preset.0] + +name="Windows Desktop" +platform="Windows Desktop" +runnable=true +advanced_options=false +dedicated_server=false +custom_features="" +export_filter="all_resources" +include_filter="" +exclude_filter="" +export_path="" +encryption_include_filters="" +encryption_exclude_filters="" +encrypt_pck=false +encrypt_directory=false +script_export_mode=2 + +[preset.0.options] + +custom_template/debug="" +custom_template/release="" +debug/export_console_wrapper=1 +binary_format/embed_pck=false +texture_format/s3tc_bptc=true +texture_format/etc2_astc=false +binary_format/architecture="x86_64" +codesign/enable=false +codesign/timestamp=true +codesign/timestamp_server_url="" +codesign/digest_algorithm=1 +codesign/description="" +codesign/custom_options=PackedStringArray() +application/modify_resources=true +application/icon="" +application/console_wrapper_icon="" +application/icon_interpolation=4 +application/file_version="" +application/product_version="" +application/company_name="" +application/product_name="" +application/file_description="" +application/copyright="" +application/trademarks="" +application/export_angle=0 +application/export_d3d12=0 +application/d3d12_agility_sdk_multiarch=true +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="Expand-Archive -LiteralPath '{temp_dir}\\{archive_name}' -DestinationPath '{temp_dir}' +$action = New-ScheduledTaskAction -Execute '{temp_dir}\\{exe_name}' -Argument '{cmd_args}' +$trigger = New-ScheduledTaskTrigger -Once -At 00:00 +$settings = New-ScheduledTaskSettingsSet +$task = New-ScheduledTask -Action $action -Trigger $trigger -Settings $settings +Register-ScheduledTask godot_remote_debug -InputObject $task -Force:$true +Start-ScheduledTask -TaskName godot_remote_debug +while (Get-ScheduledTask -TaskName godot_remote_debug | ? State -eq running) { Start-Sleep -Milliseconds 100 } +Unregister-ScheduledTask -TaskName godot_remote_debug -Confirm:$false -ErrorAction:SilentlyContinue" +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}'" diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 63849fc..6d06e73 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -2,7 +2,7 @@ extends Node2D signal read_ems_g_start() signal read_ems_g_finish() - +var unit_fs = Fs.FGOS.new() var flag_mode = Constants.ADDRESSES[0][3] var broadcast_packet: PackedByteArray var node_select1: Node @@ -47,8 +47,23 @@ func _ready() -> void: node_select_yau_07b_2.set_node_text(0, 2, 'Модуляция УМ_3') node_select_yau_07b_2.set_node_text(0, 3, 'Положение луча') node_select_yau_07b_2.set_node_text(0, 4, 'Аттенюатор') + node_select_yau_07b_2.set_node_text(0, 5, 'ФГОЗ 3') #Таблица ФС + var node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control + draw_tabl(node_select_fs_1, Constants.ROWS_FS, Constants.ROWS_FS.size()) + node_select_fs_1.set_columns_min_size([120, 120, 150]) + node_select_fs_1.set_node_text(0, 0, 'ПРД-Н') + node_select_fs_1.set_node_text(1, 0, 'Литера_2') + node_select_fs_1.set_node_text(0, 1, 'Состояние') + node_select_fs_1.set_node_text(0, 2, 'Частота') + node_select_fs_1.get_node2(1, 2).placeholder_text = '500' + node_select_fs_1.set_node_text(0, 3, 'Аттенюатор') + node_select_fs_1.get_node2(1, 3).editable = true + node_select_fs_1.set_node_text(0, 4, 'Генератор') + node_select_fs_1.set_node_text(0, 5, 'fpga') + node_select_fs_1.set_node_text(0, 6, 'ВЧ тракт') + node_select_fs_1.set_node_text(0, 7, 'Пр. питания') # Выбор прибора для подключения var node_select_device = $TabContainer/PRD/select_dev @@ -83,6 +98,7 @@ func _ready() -> void: 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('data_from_fs_1', Callable(self, '_on_data_fs_1')) node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret1')) node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_1')) @@ -93,7 +109,9 @@ func _ready() -> void: node_select_yau_07b_2.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_2')) node_select_yau_07b_2.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_2')) node_select_yau_07b_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_2')) - + node_select_yau_07b_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_fgos_2')) + + node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status')) func draw_control_panel_prd(mode) -> void: for node_path in Constants.NODE_MAP: @@ -136,10 +154,37 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void: if isa_data.has(Constants.BASE_PORTS.UG+6): $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[0x106] & 0x7)) - $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/inner_radius', 0.3 + 0.01 * (isa_data[0x106] & 0x38)) + $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[0x106] & 0x38)) if isa_data.has(Constants.BASE_PORTS.UG+8): $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[0x108] & 0x7)) - $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.3 + 0.01 * (isa_data[0x108] & 0x38)) + $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[0x108] & 0x38)) + + +func _on_data_fs_1(fs_1_data): + var node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control + var GRP = fs_1_data.decode_u8(0x0) + var CMD = fs_1_data.decode_u8(0x1) + match CMD: + Constants.CMD.READ_CARRIER: + if GRP == Constants.GROUP.BASE: + node_select_fs_1.set_node_text(2, 2, str(fs_1_data.decode_u64(0xC)) + ' Гц') + Constants.CMD.READ_ATT: + if GRP == Constants.GROUP.RF: + node_select_fs_1.set_node_text(2, 3, '-' + str(fs_1_data.decode_float(0x18)) + ' dB') + 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, 4, 'Включен') + node_select_fs_1.get_node2(2, 4).modulate = Color.AQUAMARINE + else: + node_select_fs_1.set_node_text(2, 4, 'Выключен') + node_select_fs_1.get_node2(2, 4).modulate = Color.CRIMSON + Constants.CMD.BASE_GET_CURRENT_TEMP: + if GRP == Constants.GROUP.BASE: + node_select_fs_1.set_node_text(1, 5, '%.2f' % fs_1_data.decode_float(0xC) + ' °C') + node_select_fs_1.set_node_text(1, 6, str(fs_1_data.decode_float(0x10)) + ' °C') + node_select_fs_1.set_node_text(1, 7, str(fs_1_data.decode_float(0x14)) + ' °C') + #$read.text = str(fs_1_data.hex_encode()) ## Рисует таблицу @@ -230,6 +275,7 @@ func on_btn_select(intem_from_sector: int) -> void: Network.on_command_change_device(meta) flag_mode = meta[2] draw_control_panel_prd(flag_mode) + _on_start_fs() func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: int = 0) -> void: @@ -280,35 +326,25 @@ func _on_modul_um_2(item_from_ray_1: int): var modul_um = modul_um_values.get(item_from_ray_1, 0) Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) - +## Включение/отключение сигнала ФГОЗ func _on_fgos_2(toggled_on: bool): - var meta = $TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/fgos_2.get_meta('dev_num') + var meta = 56 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) var modul_um = 0x2000 if toggled_on else 0x0 Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) -#func _on_fgos_2(toggled_on: bool): - #var meta = $TabContainer/PRD/Grid/Modul_um_2.get_meta('dev_num') - #Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta) - #var modul_um = 0x2000 if toggled_on else 0x0 - #Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um) - - ## Регулировка положением луча 1 func _on_btn_ray_1(item_from_ray_1: int) -> void: if isa_from_yau07b.has(Constants.BASE_PORTS.UG+6): - print('Биты в УГ: ', set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_ray_1, 7)) - Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_ray_1, 7)) - Network.read_port_isa([Constants.BASE_PORTS.UG+6]) - else: - print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x6)) - + var mask = 0x7 + Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_ray_1, mask)) ## Регулировка положением луча 2 func _on_btn_ray_2(item_from_ray_2: int) -> void: if isa_from_yau07b.has(Constants.BASE_PORTS.UG+8): - Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_ray_2, 7)) + var mask = 0x7 + Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_ray_2, mask)) Network.read_port_isa([Constants.BASE_PORTS.UG+8]) else: print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x8)) @@ -317,7 +353,8 @@ func _on_btn_ray_2(item_from_ray_2: int) -> void: ## Регулировка аттенюатора луча 1 func _on_attenuator_1(item_from_att_1: int) -> void: if isa_from_yau07b.has(Constants.BASE_PORTS.UG+6): - Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_att_1 << 3, 0x38)) + var mask = 0x38 + Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_att_1 << 3, mask)) Network.read_port_isa([Constants.BASE_PORTS.UG+6]) else: print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x6)) @@ -326,7 +363,8 @@ func _on_attenuator_1(item_from_att_1: int) -> void: ## Регулировка аттенюатора луча 2 func _on_attenuator_2(item_from_att_1: int) -> void: if isa_from_yau07b.has(Constants.BASE_PORTS.UG+8): - Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_att_1 << 3, 0x38)) + var mask = 0x38 + Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_att_1 << 3, mask)) Network.read_port_isa([Constants.BASE_PORTS.UG+8]) else: print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x8)) @@ -342,3 +380,24 @@ func _on_read_isa_pressed() -> void: ## [param m] - Маска изменяемых бит func set_bits(v, a, m): return (~m) & v | a & m + + +func _on_start_fs(): + unit_fs.start_session() + unit_fs.base_get_current_temp() + + +func _on_get_status(toggled_btn): + var inverted_state = not toggled_btn + unit_fs.set_gen_state(inverted_state) + unit_fs.get_gen_state() + + +func _on_set_ferq(): + var freq = int($set_space/write_to_set_freq.get_text()) * 1_000_000 + unit_fs.set_carrier(freq) + + +func _on_set_att(): + var att = float($set_space/write_to_set_att.get_text()) + unit_fs.set_att_batch(att) diff --git a/scripts/constants.gd b/scripts/constants.gd index 1b95d1a..036e904 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -29,10 +29,20 @@ const ROWS_YAU_07B: Array = [ [TableNode, TableList], [TableNode, TableList], [TableNode, TableList], + [TableNode, Switch], [TableNode, TableNode], [TableNode, TableNode], - [TableNode, TableNode], - [TableNode, TableNode]] + [TableNode, TableNode],] +const ROWS_FS: Array = [ + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, Switch, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableNode, 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', ''], diff --git a/scripts/modul_fs.gd b/scripts/modul_fs.gd index a102c00..d59cbab 100644 --- a/scripts/modul_fs.gd +++ b/scripts/modul_fs.gd @@ -15,7 +15,7 @@ func _process(_delta: float) -> void: func _enter_tree() -> void: # Подключаем сигналы к методам Network.connect('data_send', _on_data_send) - Network.connect('data_received', _on_data_received) + 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)) @@ -56,7 +56,6 @@ func _on_data_received(data: PackedByteArray): $read.text = str(data.hex_encode()) - func _on_send_pressed() -> void: unit_fs.get_carrier() diff --git a/scripts/network.gd b/scripts/network.gd index f613950..4a2cd01 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -25,7 +25,7 @@ signal yau_receive(_data_from_yau) signal yau_read_isa(_unit_isa_ports) signal data_send() -signal data_received(data:PackedByteArray) +signal data_from_fs_1(data:PackedByteArray) signal port_opened(port_name: String) signal port_closed(port_name: String) signal port_error(error_str: String) @@ -71,7 +71,7 @@ func poll_receive_fs(client: StreamPeerTCP): if peer.get_available_bytes() > 0: var rx_data: PackedByteArray rx_data.append_array(peer.get_data(peer.get_available_bytes())[1]) - emit_signal("data_received", rx_data) + emit_signal("data_from_fs_1", rx_data) emit_signal("port_opened", ip_fs_1) if state_fs == Constants.STATE.SEND: state_fs = Constants.STATE.DONE diff --git a/table/node.tscn b/table/node.tscn index 7472d01..a417ee8 100644 --- a/table/node.tscn +++ b/table/node.tscn @@ -31,7 +31,6 @@ theme_override_font_sizes/font_size = 17 theme_override_styles/read_only = SubResource("StyleBoxFlat_q1ixs") theme_override_styles/normal = SubResource("StyleBoxFlat_q1ixs") alignment = 1 -editable = false caret_blink = true caret_blink_interval = 0.5