diff --git a/pictures/состояние-исправности-0.png b/pictures/состояние-исправности-0.png index 79e6700..be905b0 100644 Binary files a/pictures/состояние-исправности-0.png and b/pictures/состояние-исправности-0.png differ diff --git a/pictures/состояние-исправности-1.png b/pictures/состояние-исправности-1.png index 6ad156f..f942b10 100644 Binary files a/pictures/состояние-исправности-1.png and b/pictures/состояние-исправности-1.png differ diff --git a/pictures/состояние-исправности-2.png b/pictures/состояние-исправности-2.png index 759ce22..ed13336 100644 Binary files a/pictures/состояние-исправности-2.png and b/pictures/состояние-исправности-2.png differ diff --git a/project.godot b/project.godot index 7b62efb..67e4c4c 100644 --- a/project.godot +++ b/project.godot @@ -18,8 +18,8 @@ config/icon="res://icon.svg" [autoload] Constants="*res://scripts/constants.gd" -Fs="*res://scripts/FS.gd" Yau07="*res://scripts/yau07.gd" +Fs="*res://scripts/FS.gd" Network="*res://scripts/network.gd" [debug] diff --git a/scripts/FS.gd b/scripts/FS.gd index a8e32c6..e5ec062 100644 --- a/scripts/FS.gd +++ b/scripts/FS.gd @@ -15,9 +15,10 @@ class FGOS: SET_ATT = 0x1B, ## Команда установки аттенюации READ_GEN_STATUS = 0x05, ## Команда получения статуса генератора SET_GEN_STATUS = 0x06, ## Команда установки статуса генератора - BASE_GET_CURRENT_TEMP = 0x36, ## Команда получения температуры + STATUS_CAN_MACRO = 0x31, ## Команда для чтения/записи статуса CAN BASE_CAN_MACRO_WRITE = 0x30, ## Команда для записи последовательности CAN-команд BASE_CAN_MACRO_READ = 0x33, ## Команда для чтения последовательности CAN-команд + BASE_GET_CURRENT_TEMP = 0x36, ## Команда получения температуры } enum GROUP { @@ -122,24 +123,6 @@ class FGOS: if peer: peer.put_data(data_to_sand) - - #func _parse(rx_data: PackedByteArray): - #if not online: - #online = true - #emit_signal('line_changed', self) - # - #var status_len = rx_data.decode_u16(6) # Длина массива байтового "состояние прибора" -# - #var i: = 0 - #var len_rx_data: = rx_data.size() - #status.resize(status_len) - #while i < status_len: - #var byte_i = i + 8 - #if byte_i < len_rx_data: - #status[i] = rx_data[byte_i] # Массив байтовый "состояние прибора" - #i += 1 - #emit_signal('data_received', self) - func start_session(counter: int, client: StreamPeer): var packet = _form_packet(GROUP.BASE, CmdCode.START_SESSION, INDEX_SIZE, counter) @@ -153,7 +136,15 @@ class FGOS: packet.encode_u32(0xC, button_state) ## MODE GEN STATUS send_packet_to(packet, client) - + + func status_can_macro_exec(button_state: bool, counter: int, client: StreamPeer): + var index_size = 0x1C + var packet = _form_packet(GROUP.BASE, CmdCode.STATUS_CAN_MACRO, index_size, counter) + packet.encode_u16(0x8, 0x0010) + packet.encode_u32(0xC, button_state) ## mode can status + send_packet_to(packet, client) + + func set_carrier(installation_frequency: int, counter: int, client: StreamPeer): var index_size = 0x1C var packet = _form_packet(GROUP.BASE, CmdCode.SET_CARRIER, index_size, counter) @@ -166,7 +157,7 @@ class FGOS: var index_size = 0x1C var packet = _form_packet(GROUP.RF, CmdCode.SET_ATT, index_size, counter) packet.encode_u16(0x8, 0x10) - packet.encode_float(0x14, attenuation) + packet.encode_float(0x18, attenuation) send_packet_to(packet, client) @@ -206,4 +197,3 @@ class FGOS: 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) - diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 79c305d..b04c047 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -50,9 +50,9 @@ func _ready() -> void: node_select_yau_07b.set_node_text(0, 0, 'ПРД-Н') node_select_yau_07b.set_node_text(1, 0, 'Литера 2') node_select_yau_07b.set_node_text(0, 1, 'Запрет СИ 2') - node_select_yau_07b.set_node_text(0, 2, 'Модуляция УМ 2') + node_select_yau_07b.set_node_text(0, 2, 'Модуляция УМ') node_select_yau_07b.set_node_text(0, 3, 'Положение луча') - node_select_yau_07b.set_node_text(0, 4, 'Аттенюатор') + node_select_yau_07b.set_node_text(0, 4, 'Аттенюатор УМ') node_select_yau_07b.set_node_text(0, 6, 'СИ 2 в УФ') var node_select_yau_07b_2 = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control @@ -61,16 +61,16 @@ func _ready() -> void: node_select_yau_07b_2.set_node_text(0, 0, 'ПРД-Н') node_select_yau_07b_2.set_node_text(1, 0, 'Литера 3') node_select_yau_07b_2.set_node_text(0, 1, 'Запрет СИ 3') - node_select_yau_07b_2.set_node_text(0, 2, 'Модуляция УМ 3') + node_select_yau_07b_2.set_node_text(0, 2, 'Модуляция УМ') 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, 4, 'Аттенюатор УМ') node_select_yau_07b_2.set_node_text(0, 5, 'ФГОЗ 3') node_select_yau_07b_2.set_node_text(0, 6, 'СИ 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_columns_min_size([150, 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, 'Состояние') @@ -80,7 +80,7 @@ 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, 4, 'Генератор ФС') node_select_fs_1.set_node_text(0, 5, 'fpga') node_select_fs_1.set_node_text(0, 6, 'СИ 2 от ФС') node_select_fs_1.set_node_text(0, 7, 'Фильтр CAN') @@ -89,17 +89,17 @@ func _ready() -> void: var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control draw_tabl(node_select_fs_2, Constants.ROWS_FS, Constants.ROWS_FS.size()) - node_select_fs_2.set_columns_min_size([120, 120, 150]) + node_select_fs_2.set_columns_min_size([150, 120, 150]) node_select_fs_2.set_node_text(0, 0, 'Модуль ФС') node_select_fs_2.set_node_text(1, 0, 'Литера 3') node_select_fs_2.set_node_text(0, 1, 'Состояние') - node_select_fs_2.set_node_text(0, 2, 'Частота') + node_select_fs_2.set_node_text(0, 2, 'Частота ФС') node_select_fs_2.get_node2(1, 2).placeholder_text = 'в МГц' node_select_fs_2.get_node2(1, 2).editable = true - node_select_fs_2.set_node_text(0, 3, 'Аттенюатор') + 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, 4, 'Генератор ФС') node_select_fs_2.set_node_text(0, 5, 'fpga') node_select_fs_2.set_node_text(0, 6, 'СИ 3 от ФС') node_select_fs_2.set_node_text(0, 7, 'Фильтр CAN') @@ -139,7 +139,7 @@ func _ready() -> void: for key in Constants.ATT_DICT: node_select_yau_07b.get_node2(1, 4).add_item(key) node_select_yau_07b_2.get_node2(1, 4).add_item(key) - + Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 48) Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8]) Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 49) @@ -177,11 +177,16 @@ func _ready() -> void: 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, 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, 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')) + + Network.connect_fs_1() + Network.connect_fs_2() func on_device_selected(selected_index: int) -> void: @@ -267,7 +272,7 @@ func _on_data_fs_1(fs_1_data): node_select_fs_1.set_node_text(2, 2, str(fs_1_data.decode_u64(0xC) / 1_000_000) + ' МГц') Constants.CMD.READ_ATT: if GRP == Constants.GROUP.RF: - node_select_fs_1.set_node_text(2, 3, '-' + str(fs_1_data.decode_float(0x14)) + ' dB') + 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: @@ -603,6 +608,10 @@ func _on_set_base_can_macro(can_freq: String): Network.set_can_macro(int(can_freq)) +func _on_status_can_macro_1(toggled_btn: bool): + Network.status_can_macro_1(toggled_btn) + + ## 2 ФС func _on_port_changed_fs_2(port_name: String, color: Color) -> void: $TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, port_name) @@ -628,3 +637,7 @@ func _on_set_att_2(att: String): 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) diff --git a/scripts/constants.gd b/scripts/constants.gd index 7665ba8..cc81c9b 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -46,7 +46,8 @@ const ROWS_FS: Array = [ [TableNode, Switch, TableNode], [TableNode, TableNode, TableNode], [TableNode, SocketStatus, TableNode], - [TableNode, TableNode, 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/network.gd b/scripts/network.gd index 8f078ac..3480c34 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -113,8 +113,7 @@ func _ready() -> void: unit.connect('line_changed', Callable(self, 'on_line_changed')) unit.connect('command_fail', Callable(self, 'on_command_fail')) - connect_fs_1() - connect_fs_2() + read_port_isa([Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.EMS_G+8]) @@ -285,6 +284,13 @@ func set_can_macro(can_frequency: int): 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 + unit_fs.get_base_can_macro(counter_fs_1, client_fs_1) + counter_fs_1 += 1 + + ## 2 ФС коннект func connect_fs_2(): if client_fs_2: @@ -359,6 +365,8 @@ func set_can_macro_2(can_frequency: int): counter_fs_2 += 1 -func can_macro_exec_2(state_can: bool): - unit_fs.set_state_base_can_macro(state_can, counter_fs_2, client_fs_2) +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 + unit_fs.get_base_can_macro(counter_fs_2, client_fs_2) counter_fs_2 += 1 diff --git a/table/элемент-в.tscn b/table/элемент-в.tscn index 6e77dee..7182489 100644 --- a/table/элемент-в.tscn +++ b/table/элемент-в.tscn @@ -1,9 +1,8 @@ -[gd_scene load_steps=12 format=3 uid="uid://p2suppildvq0"] +[gd_scene load_steps=11 format=3 uid="uid://p2suppildvq0"] [ext_resource type="Texture2D" uid="uid://ce3qpf070wgd2" path="res://pictures/состояние-исправности-0.png" id="1_2n7he"] [ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://pictures/nine-patch-round.png" id="2_4b43i"] [ext_resource type="Texture2D" uid="uid://byweg7pgt8o4h" path="res://pictures/состояние-исправности-1.png" id="2_38t58"] -[ext_resource type="Shader" path="res://Shaders/opt_btn.gdshader" id="2_ecsml"] [ext_resource type="Texture2D" uid="uid://dkef6xwxwdxi8" path="res://pictures/эмс-бланк.png" id="3_4kmgr"] [ext_resource type="Texture2D" uid="uid://bvikuv0lbvou8" path="res://pictures/состояние-исправности-2.png" id="3_i2t3v"] [ext_resource type="Texture2D" uid="uid://b15flrfytxkop" path="res://pictures/эмс-бланк-пост.png" id="4_omove"] @@ -74,9 +73,6 @@ func _on_resized() -> void: " [sub_resource type="ShaderMaterial" id="ShaderMaterial_45ast"] -shader = ExtResource("2_ecsml") -shader_parameter/range = 0.4 -shader_parameter/color = Color(0.764706, 0.764706, 0.764706, 1) [sub_resource type="SpriteFrames" id="SpriteFrames_nofpw"] animations = [{ @@ -133,12 +129,13 @@ horizontal_alignment = 1 vertical_alignment = 1 [node name="txr_state" type="TextureRect" parent="."] +modulate = Color(1, 1, 1, 0.462) material = SubResource("ShaderMaterial_45ast") layout_mode = 0 offset_left = 14.0 -offset_top = 116.0 +offset_top = 114.0 offset_right = 238.0 -offset_bottom = 340.0 +offset_bottom = 338.0 scale = Vector2(0.1, 0.1) size_flags_vertical = 6 texture = ExtResource("1_2n7he") @@ -153,6 +150,7 @@ patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 +metadata/_edit_lock_ = true [node name="SZI_x" type="AnimatedSprite2D" parent="."] visible = false