From 54ff1757b2c0f4026fee656312c2ae15cdb61e3c Mon Sep 17 00:00:00 2001 From: Maxim Date: Wed, 12 Feb 2025 02:47:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=BA=D0=B0=20?= =?UTF-8?q?=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D1=8F=D1=86=D0=B8=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PRD_MP550.tscn | 42 ++++++++++++++++++++++++------- scripts/FS.gd | 26 +++++++++++++++++++ scripts/PRD.gd | 54 ++++++++++++++++++++++++++++++---------- scripts/constants.gd | 16 ++++++------ scripts/control_panel.gd | 2 +- scripts/network.gd | 23 +++++++++++++++++ 6 files changed, 132 insertions(+), 31 deletions(-) diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 7dd581e..8b80fd4 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=55 format=3 uid="uid://cvor2jm4xk3ha"] +[gd_scene load_steps=57 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"] @@ -18,18 +18,18 @@ [ext_resource type="Script" path="res://scripts/modul_fs.gd" id="15_b4pr1"] [ext_resource type="Shader" path="res://Shaders/loadead.gdshader" id="16_4osrw"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eib3t"] -bg_color = Color(0.223529, 0.168627, 0.223529, 1) -border_width_bottom = 6 -border_color = Color(0.228592, 0.173062, 0.22863, 1) -border_blend = true - [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_o0too"] bg_color = Color(0.223529, 0.168627, 0.223529, 1) border_width_bottom = 6 border_color = Color(0.339047, 0.26316, 0.339004, 1) border_blend = true +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_eib3t"] +bg_color = Color(0.223529, 0.168627, 0.223529, 1) +border_width_bottom = 6 +border_color = Color(0.228592, 0.173062, 0.22863, 1) +border_blend = true + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_gooip"] bg_color = Color(0.143, 0.103, 0.143, 0.799) @@ -58,8 +58,6 @@ bg_color = Color(0.141176, 0.101961, 0.141176, 0.8) [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ls6vm"] [sub_resource type="Theme" id="Theme_k5ur4"] -Button/styles/focus = SubResource("StyleBoxFlat_eib3t") -Button/styles/hover = SubResource("StyleBoxFlat_o0too") Button/styles/normal = SubResource("StyleBoxFlat_o0too") Button/styles/pressed = SubResource("StyleBoxFlat_eib3t") CheckButton/icons/checked = ExtResource("2_dv7xx") @@ -132,6 +130,11 @@ shader_parameter/color_signal = Color(0.588242, 0.466356, 0, 1) shader_parameter/turn = 0.785 shader_parameter/inner_radius = 0.32 +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_45v75"] +bg_color = Color(0.6, 0.858824, 0.6, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_6s7bq"] + [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tn8m6"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_ooo4i"] @@ -457,6 +460,25 @@ offset_bottom = 11.0 script = ExtResource("2_vmbyo") node_gap = Vector2(100, 50) +[node name="FS_mod" type="Button" parent="TabContainer/PRD"] +layout_mode = 2 +offset_left = 233.0 +offset_top = 240.0 +offset_right = 334.0 +offset_bottom = 273.0 +theme_override_styles/pressed = SubResource("StyleBoxFlat_45v75") +theme_override_styles/normal = SubResource("StyleBoxFlat_6s7bq") +text = "MSK" + +[node name="FS_mod_const" type="Button" parent="TabContainer/PRD"] +offset_left = 120.0 +offset_top = 241.0 +offset_right = 221.0 +offset_bottom = 274.0 +theme_override_styles/pressed = SubResource("StyleBoxFlat_45v75") +theme_override_styles/normal = SubResource("StyleBoxFlat_6s7bq") +text = "Const" + [node name="ControlPanel" type="Panel" parent="TabContainer"] visible = false layout_mode = 2 @@ -1030,6 +1052,8 @@ text = "Сохранить все настройки" [connection signal="pressed" from="Background/side_panel/save_config" to="." method="_on_save_config"] [connection signal="pressed" from="Background/side_panel/load_config" to="." method="_on_load_config"] [connection signal="pressed" from="read_isa" to="." method="_on_read_isa_pressed"] +[connection signal="pressed" from="TabContainer/PRD/FS_mod" to="." method="_on_fs_mod_pressed"] +[connection signal="pressed" from="TabContainer/PRD/FS_mod_const" to="." method="_on_fs_mod_const"] [connection signal="pressed" from="TabContainer/Modul_fs/set_space/set_ferq" to="TabContainer/Modul_fs" method="_on_set_ferq"] [connection signal="pressed" from="TabContainer/Modul_fs/set_space/set_att2" to="TabContainer/Modul_fs" method="_on_set_att"] [connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/con" to="TabContainer/Modul_fs" method="_on_start"] diff --git a/scripts/FS.gd b/scripts/FS.gd index e5ec062..19b5269 100644 --- a/scripts/FS.gd +++ b/scripts/FS.gd @@ -13,6 +13,7 @@ class FGOS: SET_CARRIER = 0x1E, ## Команда установки несущей частоты READ_ATT = 0x1A, ## Команда чтения аттенюации SET_ATT = 0x1B, ## Команда установки аттенюации + SET_CONFIGURE = 0x01, ## Команда для записи регистров а AXI READ_GEN_STATUS = 0x05, ## Команда получения статуса генератора SET_GEN_STATUS = 0x06, ## Команда установки статуса генератора STATUS_CAN_MACRO = 0x31, ## Команда для чтения/записи статуса CAN @@ -128,7 +129,32 @@ class FGOS: var packet = _form_packet(GROUP.BASE, CmdCode.START_SESSION, INDEX_SIZE, counter) send_packet_to(packet, client) +## MSK + func set_configure_state_msk_modul_1(counter: int, client: StreamPeer): + var index_size = 0x20 + var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_CONFIGURE, index_size, counter) + packet.encode_u8(0x3, 0x09) + packet.encode_u16(0x8, 0x0014) + send_packet_to(packet, client) + + + func set_configure_state_msk_modul_2(counter: int, client: StreamPeer): + 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) + packet.encode_u8(0x3, 0x09) + packet.encode_u16(0x8, 0x0014) + packet.encode_u8(0x1C, 0x0f) + send_packet_to(packet, client) + + func set_gen_state(button_state: bool, counter: int, client: StreamPeer): var index_size = 0x1C var packet = _form_packet(GROUP.GENERATOR, CmdCode.SET_GEN_STATUS, index_size, counter) diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 4976467..0caa62e 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -80,8 +80,10 @@ func _ready() -> void: node_select_fs_1.set_node_text(0, 3, 'Аттенюатор') node_select_fs_1.get_node2(1, 3).placeholder_text = 'в dB' 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, 4, 'Модуляция') + node_select_fs_1.get_node2(1, 4).add_item('Const') + node_select_fs_1.get_node2(1, 4).add_item('MSK') + node_select_fs_1.set_node_text(0, 5, 'Генератор ФС') node_select_fs_1.set_node_text(0, 6, 'СИ 2 от ФС') node_select_fs_1.set_node_text(0, 7, 'Фильтр CAN') node_select_fs_1.get_node2(1, 7).placeholder_text = 'в МГц' @@ -100,8 +102,10 @@ func _ready() -> void: node_select_fs_2.set_node_text(0, 3, 'Аттенюатор ФС') node_select_fs_2.get_node2(1, 3).placeholder_text = 'в dB' node_select_fs_2.get_node2(1, 3).editable = true - node_select_fs_2.set_node_text(0, 4, 'Генератор ФС') - node_select_fs_2.set_node_text(0, 5, 'fpga') + node_select_fs_2.set_node_text(0, 4, 'Модуляция') + node_select_fs_2.get_node2(1, 4).add_item('Const') + node_select_fs_2.get_node2(1, 4).add_item('MSK') + node_select_fs_2.set_node_text(0, 5, 'Генератор ФС') node_select_fs_2.set_node_text(0, 6, 'СИ 3 от ФС') node_select_fs_2.set_node_text(0, 7, 'Фильтр CAN') node_select_fs_2.get_node2(1, 7).placeholder_text = 'в МГц' @@ -164,18 +168,20 @@ func _ready() -> void: 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')) ## FS 1 - node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_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')) ## FS 2 - node_select_fs_2.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_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')) - + func on_device_selected(selected_index: int) -> void: var get_select_device = $TabContainer/PRD/select_dev.get_node2(1, 0) @@ -264,14 +270,14 @@ func _on_data_fs_1(fs_1_data): 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 + node_select_fs_1.set_node_text(2, 5, 'Включен') + node_select_fs_1.get_node2(2, 5).modulate = Color.AQUAMARINE else: - node_select_fs_1.set_node_text(2, 4, 'Отключен') - node_select_fs_1.get_node2(2, 4).modulate = Color.CRIMSON + node_select_fs_1.set_node_text(2, 5, 'Отключен') + node_select_fs_1.get_node2(2, 5).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(2, 0, '%.2f' % fs_1_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)) + ' МГц') @@ -298,7 +304,7 @@ func _on_data_fs_2(fs_2_data): node_select_fs_2.get_node2(2, 4).modulate = Color.CRIMSON Constants.CMD.BASE_GET_CURRENT_TEMP: if GRP == Constants.GROUP.BASE: - node_select_fs_2.set_node_text(1, 5, '%.2f' % fs_2_data.decode_float(0xC) + ' °C') + node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C') Constants.CMD.BASE_CAN_MACRO_READ: if GRP == Constants.GROUP.BASE: node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц') @@ -579,6 +585,13 @@ func _on_start_fs_1(): Network.start_work_fs() +func _on_modul_fs_1(modulation_select_1) -> void: + if modulation_select_1 == 0: + Network.set_configure_gen_const_1() + elif modulation_select_1 == 1: + Network.set_configure_gen_msk_1() + + func _on_get_status_1(toggled_btn): var inverted_state = not toggled_btn Network.get_fs_gen_status(inverted_state) @@ -629,3 +642,18 @@ func _on_set_base_can_macro_2(can_freq: String): 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() + + +func _on_fs_mod_pressed() -> void: + Network.set_configure_gen_msk() + + +func _on_fs_mod_const() -> void: + Network.set_configure_gen_const() diff --git a/scripts/constants.gd b/scripts/constants.gd index b1573f7..c58da46 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -40,14 +40,14 @@ const ROWS_YAU_07B_2: Array = [ [TableNode, SocketStatus]] const ROWS_FS: Array = [ [Header, Header, Header], - [TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode], - [TableNode, Switch, TableNode], - [TableNode, TableNode, TableNode], - [TableNode, SocketStatus, TableNode], - [TableNode, TableNode, TableNode], - [TableNode, Switch, TableNode],] + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableNode, TableNode], + [TableNode, TableList, TableNode], + [TableNode, Switch, TableNode], + [TableNode, SocketStatus, TableNode], + [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', ''], diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 083bd37..3e2bf96 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -58,7 +58,7 @@ func _status_cell(status): #dkm if Constants.CURRENT_MODE == Constants.MODE.PRD_H: - $soc_DKM/DKM_2.state = (dkm >> 1) & 0x1 + $soc_DKM/DKM_2.state = 1 if (dkm >> 1) & 0x1 else 3 $soc_DKM/DKM_3.state = (dkm >> 2) & 0x1 elif Constants.CURRENT_MODE == Constants.MODE.PRD_B: $soc_DKM/DKM_2.state = (dkm >> 3) & 0x1 diff --git a/scripts/network.gd b/scripts/network.gd index 4bf29f5..438bf03 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -304,6 +304,18 @@ func status_can_macro_1(state_can: bool): 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: @@ -382,3 +394,14 @@ func status_can_macro_2(state_can: bool): counter_fs_2 += 1 unit_fs.get_base_can_macro(counter_fs_2, client_fs_2) counter_fs_2 += 1 + +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 + + +func set_configure_gen_const_2(): + unit_fs.set_configure_state_msk_const_1(counter_fs_2, client_fs_2) + counter_fs_2 += 1