diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index c052377..8f37ac7 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -779,10 +779,10 @@ metadata/_edit_lock_ = true [node name="ems_block" type="CheckButton" parent="TabContainer/PRD"] layout_mode = 0 -offset_left = 272.0 -offset_top = 568.0 -offset_right = 635.0 -offset_bottom = 594.0 +offset_left = 51.0 +offset_top = -53.0 +offset_right = 262.0 +offset_bottom = -27.0 tooltip_text = "Упрелвение блокировкой ЭМС для модуляции УМ" mouse_default_cursor_shape = 2 theme_override_styles/focus = SubResource("StyleBoxEmpty_4bi66") @@ -790,9 +790,17 @@ theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_f7trn") theme_override_styles/hover = SubResource("StyleBoxEmpty_wydcf") theme_override_styles/pressed = SubResource("StyleBoxEmpty_6bubr") theme_override_styles/normal = SubResource("StyleBoxEmpty_o3x62") -text = "Управление блокировкой выходов ЭМС " +text = "АнБлок выходов ЭМС" metadata/_edit_lock_ = true +[node name="Label_dkm" type="Label" parent="TabContainer/PRD"] +layout_mode = 0 +offset_left = -40.0 +offset_top = -53.0 +offset_right = 368.0 +offset_bottom = -11.0 +text = "DKM:" + [node name="ControlPanel" type="Panel" parent="TabContainer"] visible = false layout_mode = 2 diff --git a/project.godot b/project.godot index b54629f..ddf2c9f 100644 --- a/project.godot +++ b/project.godot @@ -33,10 +33,11 @@ gdscript/warnings/unused_signal=0 window/size/viewport_width=1900 window/size/viewport_height=1000 window/size/extend_to_title=true +window/stretch/mode="canvas_items" [editor] -run/main_run_args="-- addr 3" +run/main_run_args="-- addr 2s" [rendering] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index fe50aff..d90119b 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -214,21 +214,17 @@ func _ready() -> void: node_select_fs_2.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro').bind(Network.unit_fs_2)) node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_2)) ## FS 3 - node_select_fs_3.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_3')) - node_select_fs_3.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_3')) - node_select_fs_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs_3')) + node_select_fs_3.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq').bind(Network.unit_fs_3)) + node_select_fs_3.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att').bind(Network.unit_fs_3)) + node_select_fs_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_modul_fs').bind(Network.unit_fs_3)) $TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_3)) - node_select_fs_3.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro_3')) - node_select_fs_3.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_3')) + node_select_fs_3.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro').bind(Network.unit_fs_3)) + node_select_fs_3.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro').bind(Network.unit_fs_3)) 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('port_fs_opened', _on_port_changed.bind(Color.AQUAMARINE)) - #Network.connect('port_fs_closed', _on_port_changed.bind(Color.DARK_GRAY)) - #Network.connect('data_from_fs_1', _on_data_fs_1) - #Network.connect('data_from_fs_2', _on_data_fs_2) - #Network.connect('data_from_fs_3', _on_data_fs_3) + Network.unit_fs_1.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.GOOD)) Network.unit_fs_1.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.NONE)) Network.unit_fs_1.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, Constants.STATE_VAL.ERROR)) @@ -238,6 +234,11 @@ func _ready() -> void: Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.NONE)) Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, Constants.STATE_VAL.ERROR)) Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2)) + + Network.unit_fs_3.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.GOOD)) + Network.unit_fs_3.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.NONE)) + Network.unit_fs_3.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_3, Constants.STATE_VAL.ERROR)) + Network.unit_fs_3.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_3)) self.add_child(timer_modul_um) timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um')) @@ -475,7 +476,9 @@ func _on_data_fs(fs_data: PackedByteArray, unit_fs_client: Node): ray_node_path = $TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2 fs_control_node_path = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control 3: - pass + node_select = node_select_fs_3 + ray_node_path = $TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1 + fs_control_node_path = $TabContainer/PRD/body_grid/litera_1/fs_control match CMD: Constants.CMD.READ_CARRIER: if GRP == Constants.GROUP.BASE: @@ -561,6 +564,7 @@ func draw_tabl(tbl: Node, row: Array, count_row: int): func _on_data_received(data_from_yau_07): + $TabContainer/PRD/Label_dkm.text = 'DKM: ' + str(Network.unit.status.decode_u8(Constants.DataIndices.DKM)) ## УКП for i in range(6): ## Мощность от УКП_1 var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i) diff --git a/scripts/constants.gd b/scripts/constants.gd index 252a86a..86a0388 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -1,6 +1,6 @@ extends Node -var UNICAST_PORT: int = 50100 -var UNICAST_ADDRESS: String = '10.1.1.100' +var UNICAST_PORT: int = 50002 +var UNICAST_ADDRESS: String = '10.1.1.2' const BROADCAST_PORT: int = 50000 const DEFAULT_ADDRESS: String = '10.1.1.11' const DEFAULT_PORT: String = '50011' @@ -62,10 +62,10 @@ const ADDRESSES: Array = [ ['ПРД-В2', '10.1.1.22', 50022, MODE.PRD_B, '10.1.2.24', '10.1.2.25', ''], ['ПРД-В3', '10.1.1.32', 50032, MODE.PRD_B, '10.1.2.34', '10.1.2.35', ''], ['ПРД-В4', '10.1.1.42', 50042, MODE.PRD_B, '10.1.2.44', '10.1.2.45', ''], - ['ПРД-К1', '10.1.1.13', 50013, MODE.PRD_K, '10.1.2.26', '10.1.2.17', '10.1.2.11'], - ['ПРД-К2', '10.1.1.23', 50023, MODE.PRD_K, '10.1.2.36', '10.1.2.27', '10.1.2.21'], - ['ПРД-К3', '10.1.1.33', 50033, MODE.PRD_K, '10.1.2.56', '10.1.2.37', '10.1.2.31'], - ['ПРД-К4', '10.1.1.43', 50043, MODE.PRD_K, '10.1.2.76', '10.1.2.47', '10.1.2.41']] + ['ПРД-К1', '10.1.1.13', 50013, MODE.PRD_K, '10.1.2.16', '10.1.2.17', '10.1.2.11'], + ['ПРД-К2', '10.1.1.23', 50023, MODE.PRD_K, '10.1.2.26', '10.1.2.27', '10.1.2.21'], + ['ПРД-К3', '10.1.1.33', 50033, MODE.PRD_K, '10.1.2.36', '10.1.2.37', '10.1.2.31'], + ['ПРД-К4', '10.1.1.43', 50043, MODE.PRD_K, '10.1.2.46', '10.1.2.47', '10.1.2.41']] const INPUT_EMS_G: Array = [ '01 :34', '02 :35', diff --git a/scripts/network.gd b/scripts/network.gd index 0777f89..599c0e7 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -78,6 +78,7 @@ func _ready() -> void: unit.connect('line_changed', Callable(self, '_on_connect_change')) add_child(unit_fs_1) add_child(unit_fs_2) + add_child(unit_fs_3) ## Настройка при старте программы set_config() @@ -163,11 +164,18 @@ func on_command_change_device(meta_device: Array): if unit_fs_2._stream: unit_fs_2.disconnect_fs() unit_fs_2.connect_to_host(meta_device[4], Constants.PORT_FS) - + + if meta_device[5] != '': + if unit_fs_3._stream: + unit_fs_3.disconnect_fs() + unit_fs_3.connect_to_host(meta_device[5], Constants.PORT_FS) + await get_tree().create_timer(0.1).timeout setup_fs(unit_fs_1, meta_device) setup_fs(unit_fs_2, meta_device) - #ip_fs_3 = meta_device[5] + if meta_device[5] != '': + setup_fs(unit_fs_3, meta_device) + func setup_fs(unit_fs: Node, meta_device: Array) -> void: diff --git a/signals/k1.pcm b/signals/k1.pcm new file mode 100644 index 0000000..03c4063 Binary files /dev/null and b/signals/k1.pcm differ