From 96bef82f470efdd94c22b11b4a26b5cd032f1e6e Mon Sep 17 00:00:00 2001 From: Maxim Date: Fri, 28 Feb 2025 10:05:13 +0300 Subject: [PATCH] add git-hook-gdscript.sh --- PRD_MP550.tscn | 376 +++++++++++++++++++++------------------ git-hook-gdsript.sh | 12 ++ project.godot | 5 +- scripts/PRD.gd | 52 +++++- scripts/constants.gd | 25 +++ scripts/control_panel.gd | 138 ++++++++------ scripts/modul_fs.gd | 88 ++++++--- scripts/network.gd | 3 + table/header.tscn | 2 +- table/блок-а.tscn | 9 +- 10 files changed, 453 insertions(+), 257 deletions(-) create mode 100644 git-hook-gdsript.sh diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index fc8f590..fc5041a 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -15,7 +15,7 @@ [ext_resource type="Shader" path="res://Shaders/load.gdshader" id="10_lf1xh"] [ext_resource type="PackedScene" uid="uid://bdb0bhfu7366l" path="res://kasseta-fs-kd.tscn" id="10_tdh2s"] [ext_resource type="PackedScene" uid="uid://p2suppildvq0" path="res://table/элемент-в.tscn" id="11_fg7ul"] -[ext_resource type="PackedScene" uid="uid://bkxblfoj7ejv0" path="res://table/блок-а.tscn" id="11_k47r2"] +[ext_resource type="PackedScene" uid="uid://bn2n3lgc4ts1r" path="res://table/блок-а.tscn" id="11_k47r2"] [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"] @@ -226,7 +226,7 @@ metadata/_edit_lock_ = true [node name="side_panel" type="ColorRect" parent="Background"] layout_mode = 0 offset_right = 216.0 -offset_bottom = 988.0 +offset_bottom = 1279.0 color = Color(0.6, 0.5, 0.6, 0.9) metadata/_edit_lock_ = true @@ -310,6 +310,7 @@ autowrap_mode = 3 metadata/_edit_lock_ = true [node name="read_isa" type="Button" parent="."] +visible = false offset_left = 85.0 offset_top = 7.0 offset_right = 210.0 @@ -333,12 +334,11 @@ theme_override_styles/tab_selected = SubResource("StyleBoxTexture_k08q3") theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6") theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6") tab_alignment = 2 -current_tab = 1 +current_tab = 0 tab_focus_mode = 0 metadata/_edit_lock_ = true [node name="PRD" type="Panel" parent="TabContainer"] -visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7") metadata/_tab_index = 0 @@ -346,10 +346,10 @@ metadata/_edit_lock_ = true [node name="body_grid" type="GridContainer" parent="TabContainer/PRD"] layout_mode = 0 -offset_left = 360.0 +offset_left = 272.0 offset_top = 12.0 -offset_right = 1632.0 -offset_bottom = 734.0 +offset_right = 1680.0 +offset_bottom = 920.0 [node name="litera_2_4_6" type="GridContainer" parent="TabContainer/PRD/body_grid"] clip_contents = true @@ -387,12 +387,11 @@ metadata/_edit_lock_ = true [node name="PSK" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_2_4_6"] modulate = Color(1, 1, 0.941176, 0.733333) material = ExtResource("3_3syd3") -position = Vector2(970, 20) +position = Vector2(1002, 20) scale = Vector2(0.23, 0.217) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") -metadata/_edit_lock_ = true [node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/body_grid/litera_2_4_6/PSK"] modulate = Color(1, 1, 0.941176, 0.784314) @@ -413,7 +412,7 @@ texture = SubResource("GradientTexture2D_0pk2o") metadata/_edit_lock_ = true [node name="litera_3_5_7" type="GridContainer" parent="TabContainer/PRD/body_grid"] -custom_minimum_size = Vector2(500, 350) +custom_minimum_size = Vector2(500, 300) layout_mode = 2 columns = 5 @@ -446,12 +445,11 @@ metadata/_edit_lock_ = true [node name="PSK2" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_3_5_7"] modulate = Color(1, 1, 0.941176, 0.733333) material = ExtResource("3_3syd3") -position = Vector2(970, 14) +position = Vector2(1002, 14) scale = Vector2(0.23, 0.217) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") -metadata/_edit_lock_ = true [node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/body_grid/litera_3_5_7/PSK2"] modulate = Color(1, 1, 0.941176, 0.784314) @@ -472,6 +470,68 @@ scale = Vector2(21.8765, 21.6782) texture = SubResource("GradientTexture2D_0pk2o") metadata/_edit_lock_ = true +[node name="litera_1" type="GridContainer" parent="TabContainer/PRD/body_grid"] +clip_contents = true +custom_minimum_size = Vector2(700, 300) +layout_mode = 2 +size_flags_horizontal = 3 +columns = 5 + +[node name="fs_control" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_1"] +custom_minimum_size = Vector2(300, 0) +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="space" type="Panel" parent="TabContainer/PRD/body_grid/litera_1"] +custom_minimum_size = Vector2(50, 0) +layout_mode = 2 +theme_override_styles/panel = SubResource("StyleBoxTexture_1as41") + +[node name="yau07b_control" type="GridContainer" parent="TabContainer/PRD/body_grid/litera_1"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="space2" type="Panel" parent="TabContainer/PRD/body_grid/litera_1"] +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_1"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="PSK" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_1"] +visible = false +modulate = Color(1, 1, 0.941176, 0.733333) +material = ExtResource("3_3syd3") +position = Vector2(970, 20) +scale = Vector2(0.23, 0.217) +texture = SubResource("PlaceholderTexture2D_723du") +offset = Vector2(800, 600) +script = SubResource("GDScript_0sobq") +metadata/_edit_lock_ = true + +[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/body_grid/litera_1/PSK"] +modulate = Color(1, 1, 0.941176, 0.784314) +material = SubResource("ShaderMaterial_o7txs") +offset_left = 554.954 +offset_top = -30.0 +offset_right = 1290.95 +offset_bottom = 1134.0 +texture = ExtResource("5_i3nvb") +expand_mode = 1 +metadata/_edit_lock_ = true + +[node name="ray_1" type="Sprite2D" parent="TabContainer/PRD/body_grid/litera_1/PSK"] +material = SubResource("ShaderMaterial_dgiai") +position = Vector2(549.221, 543.623) +scale = Vector2(21.8765, 21.6782) +texture = SubResource("GradientTexture2D_0pk2o") +metadata/_edit_lock_ = true + [node name="select_dev" type="GridContainer" parent="TabContainer/PRD"] layout_mode = 2 offset_left = 16.0 @@ -482,6 +542,7 @@ script = ExtResource("2_vmbyo") node_gap = Vector2(100, 50) [node name="ControlPanel" type="Panel" parent="TabContainer"] +visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6") script = ExtResource("9_akagi") @@ -491,21 +552,22 @@ metadata/_edit_lock_ = true [node name="lbl_control" type="Label" parent="TabContainer/ControlPanel"] modulate = Color(1, 0, 0, 1) layout_mode = 0 -offset_left = 103.0 -offset_top = -56.0 -offset_right = 723.0 -offset_bottom = -25.0 +offset_left = 151.0 +offset_top = 16.0 +offset_right = 771.0 +offset_bottom = 47.0 theme_override_font_sizes/font_size = 22 text = "Прибор не исправен" horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_lock_ = true -[node name="socket_ym_lb2" type="NinePatchRect" parent="TabContainer/ControlPanel"] -offset_left = 15.0 -offset_top = -24.0 -offset_right = 240.0 -offset_bottom = 759.0 +[node name="socket_ym_lb" type="NinePatchRect" parent="TabContainer/ControlPanel"] +layout_mode = 0 +offset_left = 63.0 +offset_top = 48.0 +offset_right = 288.0 +offset_bottom = 831.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 @@ -513,45 +575,55 @@ patch_margin_right = 16 patch_margin_bottom = 16 metadata/_edit_lock_ = true -[node name="blok_ym_1" parent="TabContainer/ControlPanel/socket_ym_lb2" instance=ExtResource("11_k47r2")] +[node name="blok_ym_1" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] layout_mode = 2 offset_left = 20.0 offset_top = 40.0 offset_right = 201.0 offset_bottom = 149.0 +max_value0 = 150.0 +max_value1 = 2000.0 +value_name0 = "Т°" +value_name1 = "Pwr" +name_min_size0 = Vector2i(30, 0) +fname = "УМ 1" -[node name="blok_ym_2" parent="TabContainer/ControlPanel/socket_ym_lb2" instance=ExtResource("11_k47r2")] +[node name="blok_ym_2" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] layout_mode = 2 offset_left = 20.0 offset_top = 160.0 offset_right = 201.0 offset_bottom = 269.0 -[node name="blok_ym_3" parent="TabContainer/ControlPanel/socket_ym_lb2" instance=ExtResource("11_k47r2")] +[node name="blok_ym_3" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 280.0 offset_right = 201.0 offset_bottom = 389.0 -[node name="blok_ym_4" parent="TabContainer/ControlPanel/socket_ym_lb2" instance=ExtResource("11_k47r2")] +[node name="blok_ym_4" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 408.0 offset_right = 201.0 offset_bottom = 517.0 -[node name="blok_ym_5" parent="TabContainer/ControlPanel/socket_ym_lb2" instance=ExtResource("11_k47r2")] +[node name="blok_ym_5" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 528.0 offset_right = 201.0 offset_bottom = 637.0 -[node name="blok_ym_6" parent="TabContainer/ControlPanel/socket_ym_lb2" instance=ExtResource("11_k47r2")] +[node name="blok_ym_6" parent="TabContainer/ControlPanel/socket_ym_lb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 656.0 offset_right = 201.0 offset_bottom = 765.0 -[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/socket_ym_lb2"] +[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/socket_ym_lb"] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 offset_left = 7.0 @@ -563,10 +635,11 @@ horizontal_alignment = 1 vertical_alignment = 1 [node name="socket_ym_pb" type="NinePatchRect" parent="TabContainer/ControlPanel"] -offset_left = 591.0 -offset_top = -24.0 -offset_right = 816.0 -offset_bottom = 759.0 +layout_mode = 0 +offset_left = 639.0 +offset_top = 48.0 +offset_right = 864.0 +offset_bottom = 831.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 @@ -589,24 +662,28 @@ offset_right = 201.0 offset_bottom = 269.0 [node name="blok_ym_3" parent="TabContainer/ControlPanel/socket_ym_pb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 280.0 offset_right = 201.0 offset_bottom = 389.0 [node name="blok_ym_4" parent="TabContainer/ControlPanel/socket_ym_pb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 408.0 offset_right = 201.0 offset_bottom = 517.0 [node name="blok_ym_5" parent="TabContainer/ControlPanel/socket_ym_pb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 528.0 offset_right = 201.0 offset_bottom = 637.0 [node name="blok_ym_6" parent="TabContainer/ControlPanel/socket_ym_pb" instance=ExtResource("11_k47r2")] +layout_mode = 0 offset_left = 20.0 offset_top = 656.0 offset_right = 201.0 @@ -625,10 +702,10 @@ vertical_alignment = 1 [node name="soc_y5" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 255.0 -offset_top = -24.0 -offset_right = 572.0 -offset_bottom = 166.0 +offset_left = 303.0 +offset_top = 48.0 +offset_right = 620.0 +offset_bottom = 238.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 @@ -697,10 +774,10 @@ vertical_alignment = 1 [node name="Kasseta_FS" parent="TabContainer/ControlPanel" instance=ExtResource("10_tdh2s")] layout_mode = 0 -offset_left = 254.0 -offset_top = 167.0 -offset_right = 572.0 -offset_bottom = 386.0 +offset_left = 302.0 +offset_top = 239.0 +offset_right = 620.0 +offset_bottom = 458.0 script = null metadata/_edit_lock_ = true @@ -771,10 +848,10 @@ rname = "A1" [node name="soc_P1" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 317.0 -offset_top = 389.0 -offset_right = 505.0 -offset_bottom = 584.0 +offset_left = 365.0 +offset_top = 677.0 +offset_right = 553.0 +offset_bottom = 872.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 @@ -786,107 +863,125 @@ metadata/_edit_lock_ = true self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 offset_left = 7.0 -offset_top = 8.0 +offset_top = 3.0 offset_right = 181.0 -offset_bottom = 33.0 +offset_bottom = 28.0 text = "Кассета П-1" horizontal_alignment = 1 vertical_alignment = 1 +metadata/_edit_lock_ = true [node name="MAA_1" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = -64.0 -offset_top = 37.0 -offset_right = -14.0 -offset_bottom = 187.0 +offset_left = -58.0 +offset_top = 21.0 +offset_right = -8.0 +offset_bottom = 181.0 +self_size = Vector2i(50, 160) fname = "МАА2000" rname = "А22" +metadata/_edit_lock_ = true [node name="MAA_2" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] -offset_left = 203.0 -offset_top = 36.0 -offset_right = 253.0 -offset_bottom = 186.0 +offset_left = 196.0 +offset_top = 21.0 +offset_right = 246.0 +offset_bottom = 181.0 +self_size = Vector2i(50, 160) fname = "МАА2000" rname = "А23" +metadata/_edit_lock_ = true [node name="IP9_50_2" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] offset_left = 129.0 -offset_top = 37.0 +offset_top = 29.0 offset_right = 179.0 offset_bottom = 187.0 +self_size = Vector2i(50, 158) fname = "ИП9-50" rname = "А19" +metadata/_edit_lock_ = true [node name="IP9_50_1" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] offset_left = 73.0 -offset_top = 37.0 +offset_top = 29.0 offset_right = 123.0 offset_bottom = 187.0 +self_size = Vector2i(50, 158) fname = "ИП9-50" rname = "А20" +metadata/_edit_lock_ = true [node name="IP12_50" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] offset_left = 16.0 -offset_top = 36.0 +offset_top = 29.0 offset_right = 66.0 offset_bottom = 186.0 +self_size = Vector2i(50, 157) fname = "ИП12-50" rname = "А21" +metadata/_edit_lock_ = true [node name="soc_DKM" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 317.0 -offset_top = 584.0 -offset_right = 505.0 -offset_bottom = 778.0 +offset_left = 440.0 +offset_top = 466.0 +offset_right = 620.0 +offset_bottom = 666.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 +metadata/_edit_lock_ = true [node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/soc_DKM"] self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 -offset_left = 7.0 -offset_top = 8.0 -offset_right = 181.0 -offset_bottom = 33.0 +offset_left = 5.0 +offset_top = 6.0 +offset_right = 174.0 +offset_bottom = 29.0 text = "ДКМ" horizontal_alignment = 1 vertical_alignment = 1 metadata/_edit_lock_ = true [node name="DKM_3" parent="TabContainer/ControlPanel/soc_DKM" instance=ExtResource("11_fg7ul")] -offset_left = 129.0 -offset_top = 37.0 -offset_right = 179.0 -offset_bottom = 187.0 +offset_left = 121.0 +offset_top = 32.0 +offset_right = 171.0 +offset_bottom = 195.0 +self_size = Vector2i(50, 163) fname = "ДКМ3" rname = " " +metadata/_edit_lock_ = true [node name="DKM_2" parent="TabContainer/ControlPanel/soc_DKM" instance=ExtResource("11_fg7ul")] -offset_left = 73.0 -offset_top = 37.0 -offset_right = 123.0 -offset_bottom = 187.0 +offset_left = 66.0 +offset_top = 32.0 +offset_right = 116.0 +offset_bottom = 195.0 +self_size = Vector2i(50, 163) fname = "ДКМ2" rname = " " +metadata/_edit_lock_ = true [node name="DKM_1" parent="TabContainer/ControlPanel/soc_DKM" instance=ExtResource("11_fg7ul")] -offset_left = 16.0 -offset_top = 36.0 -offset_right = 66.0 -offset_bottom = 186.0 +offset_left = 10.0 +offset_top = 32.0 +offset_right = 60.0 +offset_bottom = 195.0 +self_size = Vector2i(50, 163) fname = "ДКМ-1" rname = " " +metadata/_edit_lock_ = true [node name="soc_P2" type="NinePatchRect" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 333.0 -offset_top = 777.0 -offset_right = 487.0 -offset_bottom = 979.0 +offset_left = 301.0 +offset_top = 465.0 +offset_right = 429.0 +offset_bottom = 667.0 texture = ExtResource("9_0r2qk") patch_margin_left = 16 patch_margin_top = 16 @@ -899,46 +994,44 @@ self_modulate = Color(1, 1, 1, 0.62) layout_mode = 0 offset_left = 8.0 offset_top = 8.0 -offset_right = 142.0 +offset_right = 120.0 offset_bottom = 33.0 text = "Кассета П-2" horizontal_alignment = 1 vertical_alignment = 1 +metadata/_edit_lock_ = true [node name="IP12_50" parent="TabContainer/ControlPanel/soc_P2" instance=ExtResource("11_fg7ul")] -offset_left = 81.0 +offset_left = 67.0 offset_top = 36.0 -offset_right = 131.0 +offset_right = 117.0 offset_bottom = 196.0 self_size = Vector2i(50, 160) fname = "ИП12-50" rname = "A25" +metadata/_edit_lock_ = true [node name="IP9_50" parent="TabContainer/ControlPanel/soc_P2" instance=ExtResource("11_fg7ul")] -offset_left = 24.0 +offset_left = 11.0 offset_top = 36.0 -offset_right = 74.0 +offset_right = 61.0 offset_bottom = 196.0 self_size = Vector2i(50, 160) fname = "ИП9-50" rname = "A22" - -[node name="DKM" type="Label" parent="TabContainer/ControlPanel"] -layout_mode = 0 -offset_left = 589.0 -offset_top = 212.0 -offset_right = 695.0 -offset_bottom = 235.0 metadata/_edit_lock_ = true [node name="log_array" type="TextEdit" parent="TabContainer/ControlPanel"] layout_mode = 0 -offset_left = 846.0 -offset_top = -21.0 -offset_right = 1630.0 -offset_bottom = 525.0 +offset_left = 950.0 +offset_top = 51.0 +offset_right = 1774.0 +offset_bottom = 922.0 +theme_override_colors/font_color = Color(1, 1, 0.815686, 1) +theme_override_font_sizes/font_size = 17 theme_override_styles/normal = SubResource("StyleBoxFlat_13x31") placeholder_text = "Ожидание контроля ..." +wrap_mode = 1 [node name="await" type="ColorRect" parent="TabContainer/ControlPanel/log_array"] material = SubResource("ShaderMaterial_07wue") @@ -1008,60 +1101,13 @@ script = ExtResource("15_b4pr1") metadata/_tab_index = 3 metadata/_edit_lock_ = true -[node name="set_space" type="GridContainer" parent="TabContainer/Modul_fs"] -layout_mode = 0 -offset_left = 211.0 -offset_top = 378.0 -offset_right = 854.0 -offset_bottom = 418.0 -columns = 2 - -[node name="set_ferq" type="Button" parent="TabContainer/Modul_fs/set_space"] -custom_minimum_size = Vector2(100, 0) -layout_mode = 2 -text = " Set н/ч" - -[node name="write_to_set_freq" type="LineEdit" parent="TabContainer/Modul_fs/set_space"] -custom_minimum_size = Vector2(300, 0) -layout_mode = 2 -text = "500" -placeholder_text = "Частота" - -[node name="measurement" type="Label" parent="TabContainer/Modul_fs/set_space/write_to_set_freq"] -layout_mode = 0 -offset_left = 313.0 -offset_top = 2.0 -offset_right = 365.0 -offset_bottom = 30.0 -text = "МГц" - -[node name="set_att2" type="Button" parent="TabContainer/Modul_fs/set_space"] -custom_minimum_size = Vector2(100, 0) -layout_mode = 2 -text = " Set att" - -[node name="write_to_set_att" type="LineEdit" parent="TabContainer/Modul_fs/set_space"] -custom_minimum_size = Vector2(300, 0) -layout_mode = 2 -text = "38.75" -placeholder_text = "-38.75 to 0" - -[node name="measurement" type="Label" parent="TabContainer/Modul_fs/set_space/write_to_set_att"] -layout_mode = 0 -offset_left = 313.0 -offset_top = 2.0 -offset_right = 351.0 -offset_bottom = 30.0 -text = "dB" - [node name="manage_panel" type="GridContainer" parent="TabContainer/Modul_fs"] layout_mode = 0 offset_left = 200.0 offset_top = 186.0 -offset_right = 805.0 +offset_right = 773.0 offset_bottom = 308.0 -columns = 5 -metadata/_edit_lock_ = true +columns = 3 [node name="con" type="Button" parent="TabContainer/Modul_fs/manage_panel"] layout_mode = 2 @@ -1073,25 +1119,9 @@ offset_top = 32.0 offset_right = 118.0 offset_bottom = 55.0 -[node name="get_freq" type="Button" parent="TabContainer/Modul_fs/manage_panel"] +[node name="addres_fs" type="LineEdit" parent="TabContainer/Modul_fs/manage_panel"] +custom_minimum_size = Vector2(150, 0) layout_mode = 2 -text = " Получить н/ч " - -[node name="freq_ind" type="Label" parent="TabContainer/Modul_fs/manage_panel/get_freq"] -layout_mode = 0 -offset_top = 32.0 -offset_right = 106.0 -offset_bottom = 55.0 - -[node name="get_att" type="Button" parent="TabContainer/Modul_fs/manage_panel"] -layout_mode = 2 -text = " Получить att " - -[node name="att_ind" type="Label" parent="TabContainer/Modul_fs/manage_panel/get_att"] -layout_mode = 0 -offset_top = 32.0 -offset_right = 105.0 -offset_bottom = 55.0 [node name="get_gen_status" type="Button" parent="TabContainer/Modul_fs/manage_panel"] layout_mode = 2 @@ -1106,18 +1136,17 @@ offset_bottom = 56.0 [node name="read" type="LineEdit" parent="TabContainer/Modul_fs"] layout_mode = 0 -offset_left = 216.0 -offset_top = 818.0 -offset_right = 971.0 -offset_bottom = 849.0 -metadata/_edit_lock_ = true +offset_left = 199.0 +offset_top = 322.0 +offset_right = 954.0 +offset_bottom = 353.0 [node name="fs_connect" type="Label" parent="TabContainer/Modul_fs"] layout_mode = 0 offset_left = 206.0 -offset_top = 88.0 +offset_top = 144.0 offset_right = 377.0 -offset_bottom = 111.0 +offset_bottom = 167.0 text = "Связь с модулем ФС" [node name="temp_1" type="Label" parent="TabContainer/Modul_fs"] @@ -1159,9 +1188,6 @@ 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/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"] -[connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/get_freq" to="TabContainer/Modul_fs" method="_on_send_pressed"] -[connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/get_att" to="TabContainer/Modul_fs" method="_on_get_att"] +[connection signal="text_submitted" from="TabContainer/Modul_fs/manage_panel/addres_fs" to="TabContainer/Modul_fs" method="_on_addres_fs"] [connection signal="toggled" from="TabContainer/Modul_fs/manage_panel/get_gen_status" to="TabContainer/Modul_fs" method="_on_get_status"] diff --git a/git-hook-gdsript.sh b/git-hook-gdsript.sh new file mode 100644 index 0000000..a016513 --- /dev/null +++ b/git-hook-gdsript.sh @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +# +# Описание +# +# Генерирует модуль на языке GDScript с информацией для контроля +# версий в системе git. Использовать для проектов GoDot Engine. + +GDSCRIPT_FILE="commit.gd" +HEAD="$(git rev-parse --abbrev-ref HEAD) $(git rev-parse --short HEAD) $(git log -1 --format=%cd)" +echo "extends Node" > ${GDSCRIPT_FILE} +echo "# Файл сгенерирован автоматически! Не изменять вручную!" >> ${GDSCRIPT_FILE} +echo "const VCS_HEAD = '${HEAD}'" >> ${GDSCRIPT_FILE} \ No newline at end of file diff --git a/project.godot b/project.godot index 5c3d306..75164d6 100644 --- a/project.godot +++ b/project.godot @@ -28,8 +28,9 @@ gdscript/warnings/unused_signal=0 [display] -window/size/viewport_width=1920 -window/size/viewport_height=1080 +window/size/viewport_width=1910 +window/size/viewport_height=1070 +window/size/initial_position_type=0 [editor] diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 714ea0e..9344ed4 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -46,7 +46,12 @@ func _ready() -> void: node_select_yau_07b_2 = $TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control draw_tabl(node_select_yau_07b_2, Constants.ROWS_YAU_07B_2, Constants.ROWS_YAU_07B_2.size()) node_select_yau_07b_2.set_columns_min_size([160, 120]) - + + # Таблица ЯУ-07б-3 + var node_select_yau_07b_3 = $TabContainer/PRD/body_grid/litera_1/yau07b_control + draw_tabl(node_select_yau_07b_3, Constants.ROWS_YAU_07B_2, Constants.ROWS_YAU_07B_2.size()) + node_select_yau_07b_3.set_columns_min_size([160, 120]) + #Таблица ФС-2 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()) @@ -56,7 +61,46 @@ func _ready() -> void: 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([150, 120, 150]) - + + #Таблица ФС-3 + var node_select_fs_3 = $TabContainer/PRD/body_grid/litera_1/fs_control + draw_tabl(node_select_fs_3, Constants.ROWS_FS, Constants.ROWS_FS.size()) + node_select_fs_3.set_columns_min_size([150, 120, 150]) + + # Таблица ЯУ-07б-3 + var item_place_yau_07_3 = 38 + node_select_yau_07b_3.set_node_text(0, 0, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+0]) # 'ПРД-Н' + node_select_yau_07b_3.set_node_text(1, 0, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+1]) # 'Литера 1' + node_select_yau_07b_3.set_node_text(0, 1, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+2]) # 'Запрет СИ 1' + node_select_yau_07b_3.set_node_text(0, 2, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+3]) # 'Модуляция УМ' + node_select_yau_07b_3.set_node_text(0, 3, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+4]) # 'Положение луча' + node_select_yau_07b_3.set_node_text(0, 4, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+5]) # 'Аттенюатор УМ' + node_select_yau_07b_3.get_node2(1, 5).get_child(1).visible = false + node_select_yau_07b_3.set_node_text(0, 5, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+6]) # 'ФГОЗ' + node_select_yau_07b_3.set_node_text(0, 6, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+7]) # 'СИ 1 в УФ' + node_select_yau_07b_3.set_node_text(0, 7, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+8]) # 'СЗИ 1 от УФ' + + #Таблица ФС-3 + var item_place_fs_3 = 47 + node_select_fs_3.set_node_text(0, 0, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+0]) # 'Модуль ФС 1' + node_select_fs_3.set_node_text(1, 0, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+1]) # 'Литера ФС 1' + node_select_fs_3.set_node_text(0, 1, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+2]) # 'Состояние' + node_select_fs_3.set_node_text(0, 2, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+3]) # 'Частота' + node_select_fs_3.get_node2(1, 2).placeholder_text = 'в МГц' + node_select_fs_3.get_node2(1, 2).editable = true + node_select_fs_3.set_node_text(0, 3, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+4]) # 'Аттенюатор ФС' + node_select_fs_3.get_node2(1, 3).placeholder_text = 'в dB' + node_select_fs_3.get_node2(1, 3).editable = true + node_select_fs_3.set_node_text(0, 4, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+5]) # 'Модуляция ФС 1' + node_select_fs_3.get_node2(1, 4).add_item('Const') + node_select_fs_3.get_node2(1, 4).add_item('MSK') + node_select_fs_3.set_node_text(0, 5, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+6]) # 'Генератор ФС' + node_select_fs_3.set_node_text(0, 6, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+7]) # 'СИ 1 от ФС' + node_select_fs_3.set_node_text(0, 7, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+8]) # 'Фильтр CAN' + node_select_fs_3.get_node2(1, 7).placeholder_text = 'в МГц' + node_select_fs_3.get_node2(1, 7).editable = true + node_select_fs_3.set_node_text(0, 8, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+9]) # 'Статус CAN') + # Выбор прибора для подключения var node_select_device = $TabContainer/PRD/select_dev draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size()) @@ -71,7 +115,7 @@ func _ready() -> void: node_select_device.set_columns_min_size([100, 100]) # Получение выбранного прибора при загрузке - status_pribor = Constants.CURRENT_MODE + status_pribor = Constants.CURRENT_MODE add_signs_scene() @@ -204,6 +248,8 @@ func add_signs_scene(): node_select_fs_2.get_node2(1, 7).placeholder_text = 'в МГц' node_select_fs_2.get_node2(1, 7).editable = true node_select_fs_2.set_node_text(0, 8, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_2+9]) # 'Статус CAN') + + $TabContainer/PRD/body_grid/litera_1.visible = Constants.CURRENT_MODE ==Constants.MODE.PRD_K func _on_read_isa(unit_isa_ports: Dictionary) -> void: diff --git a/scripts/constants.gd b/scripts/constants.gd index 2a8317c..964169e 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -267,6 +267,31 @@ const SIGNS: Dictionary = { 'СИ 7 от ФС', 'Фильтр CAN', 'Статус CAN', + + # ЯУ-07б-2 + 'ПРД-К', + 'Литера 1', + 'Запрет СИ 1', + 'Модуляция УМ', + 'Положение луча', + 'Аттенюатор УМ', + '', + 'СИ 1 в УФ', + 'СЗИ 1 от УФ', + + # ФС-3 + 'Модуль ФС', + 'Литера 1', + 'Состояние', + 'Частота', + 'Аттенюатор', + 'Модуляция', + 'Генератор ФС', + 'СИ 1 от ФС', + 'Фильтр CAN', + 'Статус CAN', + + ], } diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index b085b9a..b4fb285 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -6,6 +6,7 @@ signal signal_on_modul_um() var timer: Timer = Timer.new() var timer_03: Timer = Timer.new() var node_cell_ind: Array +var um_cell_ind: Array var count_cell: int var past_pribor: int var logger: Node @@ -69,6 +70,7 @@ func _ready() -> void: timer_03.connect('timeout', Callable(self, '_on_timer_03')) self.connect('signal_on_start_timer_03', Callable(self, '_on_start_timer_03')) Network.connect('yau_receive', Callable(self, '_on_yau_received')) + Network.connect('yau_feedback_receive', Callable(self, '_on_yau_feedback_receive')) self.connect('signal_on_modul_um', Callable(self, '_on_modul_um')) node_cell_ind = [ @@ -101,6 +103,21 @@ func _ready() -> void: $soc_DKM/DKM_3, ] count_cell = len(node_cell_ind) + um_cell_ind = [ + $socket_ym_lb/blok_ym_1, + $socket_ym_lb/blok_ym_2, + $socket_ym_lb/blok_ym_3, + $socket_ym_lb/blok_ym_4, + $socket_ym_lb/blok_ym_5, + $socket_ym_lb/blok_ym_6, + + $socket_ym_pb/blok_ym_1, + $socket_ym_pb/blok_ym_2, + $socket_ym_pb/blok_ym_3, + $socket_ym_pb/blok_ym_4, + $socket_ym_pb/blok_ym_5, + $socket_ym_pb/blok_ym_6, + ] _draw_control_panel_prd(Constants.CURRENT_MODE) @@ -238,7 +255,7 @@ func fs_1_setup(freq): Network.get_gen_state_1() Network.status_can_macro_1(false) Network.set_fs_ferq_carrier(freq * 1_000_000) - Network.set_fs_attenuation(float(19)) + Network.set_fs_attenuation(float(18)) # Для литеры 4 Network.set_can_macro(freq) Network.status_can_macro_1(true) await get_tree().create_timer(0.4).timeout @@ -254,7 +271,7 @@ func fs_2_setup(freq): Network.get_gen_state_2() Network.status_can_macro_2(false) Network.set_fs_ferq_carrier_2(freq * 1_000_000) - Network.set_fs_attenuation_2(float(19)) + Network.set_fs_attenuation_2(float(16)) # Для литеры 5 Network.set_can_macro_2(freq) Network.status_can_macro_2(true) await get_tree().create_timer(0.8).timeout @@ -279,23 +296,23 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String): match CMD: Constants.CMD.READ_CARRIER: if GRP == Constants.GROUP.BASE: - logger.info('В модуль %s установлена частота: %s МГц ✅' % [fs_name, (fs_data.decode_u64(0xC) / 1_000_000.0)]) + logger.info('✅ В модуль %s установлена частота: %s МГц' % [fs_name, (fs_data.decode_u64(0xC) / 1_000_000.0)]) Constants.CMD.READ_ATT: if GRP == Constants.GROUP.RF: - logger.info('В модуль %s установлена аттенюация: %s dB ✅' % [fs_name, (fs_data.decode_float(0x18))]) + logger.info('✅ В модуль %s установлена аттенюация: %s dB' % [fs_name, (fs_data.decode_float(0x18))]) Constants.CMD.READ_GEN_STATUS: if GRP == Constants.GROUP.GENERATOR: if fs_data.decode_u32(0xC) == 0: - logger.info('Состояние генератора %s: Включен ✅' % fs_name) + logger.info('✅ Состояние генератора %s: Включен' % fs_name) else: if fs_name == 'ФС-1': flag_fs_1_ready = false if fs_name == 'ФС-2': flag_fs_2_ready = false - logger.info('Состояние генератора %s: Отключен ❌' % fs_name) + logger.info('🛈 Состояние генератора %s: Отключен' % fs_name) Constants.CMD.BASE_CAN_MACRO_READ: if GRP == Constants.GROUP.BASE: - logger.info('В модуль %s установлена частота CAN: %s МГц ✅' % [fs_name, (fs_data.decode_u16(0x20))]) + logger.info('✅ В модуль %s установлена частота CAN: %s МГц' % [fs_name, (fs_data.decode_u16(0x20))]) func _on_yau_received(status_yau): @@ -325,35 +342,33 @@ func _on_yau_received(status_yau): if arr_power_ukp_2[i] > array_pow_2[i]: array_pow_2[i] = arr_power_ukp_2[i] count_packet += 1 - if logger: - ## Флаг для проверки настройки угла и аттенюации на двух литерах - if Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+6) and Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+8): - if Network.unit.isa_ports[Constants.BASE_PORTS.UG+6] == 58 and Network.unit.isa_ports[Constants.BASE_PORTS.UG+8] == 58: - flag_ug = true - else: - flag_ug = false - ## Флаг для проверки модуяции на высоком - if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2): - if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_2: - if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000: - flag_modul_on_1 = true - print('Модуляция 1 включена!') - #logger.info('Модуляция УМ (2, 4, 6) включена!') - elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000: - flag_modul_on_1 = false - print('Модуляция 1 отключена!') - #logger.info('Модуляция УМ (2, 4, 6) отключена!') - if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_3: - if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000: - flag_modul_on_2 = true - print('Модуляция 2 включена!') - #logger.info('Модуляция УМ (3, 5, 7) включена!') - elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000: - flag_modul_on_2 = false - print('Модуляция 2 отключена!') - #logger.info('Модуляция УМ (3, 5, 7) включена!!') +func _on_yau_feedback_receive(_status_yau): + ## Флаг для проверки настройки угла и аттенюации на двух литерах + if Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+6) and Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+8): + if Network.unit.isa_ports[Constants.BASE_PORTS.UG+6] == 58 and Network.unit.isa_ports[Constants.BASE_PORTS.UG+8] == 58: + flag_ug = true + else: + flag_ug = false + ## Флаг для проверки модуяции на высоком + if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2): + if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_2: + if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000 and (not flag_modul_on_1): + flag_modul_on_1 = true + logger.info('✅ Модуляция УМ (2, 4, 6) включена!') + elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_1): + flag_modul_on_1 = false + logger.info('❌ Модуляция УМ (2, 4, 6) отключена!') + if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_3: + if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000 and (not flag_modul_on_2): + flag_modul_on_2 = true + logger.info('✅ Модуляция УМ (3, 5, 7) включена!') + elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_2): + flag_modul_on_2 = false + logger.info('❌ Модуляция УМ (3, 5, 7) отключена!') + + func _on_start_super_control(): $log_array/await.visible = true logger = Logger.new(get_node('log_array')) @@ -367,14 +382,16 @@ func _on_start_super_control(): _draw_control_panel_prd(Constants.CURRENT_MODE) if (Network.unit.online): $soc_y5/yau_07b.state = Constants.STATE_VAL.GOOD - logger.info("ЯУ-07Б: Есть связь ✅") + logger.info("✅ ЯУ-07Б: Есть связь") _status_cell(Network.unit.status) + else: for i in range(1, count_cell): node_cell_ind[i].state = Constants.STATE_VAL.NONE $soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR - logger.error("ЯУ-07Б: Нет связи ❌") + logger.error("❌ ЯУ-07Б: Нет связи") + _status_prd() $log_array/await.visible = false if Network.unit_fs.online: @@ -389,7 +406,7 @@ func _on_start_super_control(): fs_1_setup(fs_freq[0]) # Гц fs_2_setup(fs_freq[1]) # Гц else: - logger.info('Настройка модулей ФС ❌') + logger.info('❌ Настройка модулей ФС') func _status_cell(status): @@ -400,10 +417,10 @@ func _status_cell(status): for i in range(1, 5): if ((status_board >> (i-1)) & 0x1) == 1: node_cell_ind[i].state = Constants.STATE_VAL.GOOD - logger.info("%s : Есть связь ✅" % node_cell_ind[i].get('fname')) + logger.info("✅ %s : Есть связь" % node_cell_ind[i].get('fname')) else: node_cell_ind[i].state = Constants.STATE_VAL.ERROR - logger.error("%s : Нет связи ❌" % node_cell_ind[i].get('fname')) + logger.error("❌ %s : Нет связи" % node_cell_ind[i].get('fname')) #dry_contact if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD): @@ -415,10 +432,16 @@ func _status_cell(status): if not skip: if ((dry_contact >> (i_node-5)) & 0x1) == 0: node_cell_ind[i_node].state = Constants.STATE_VAL.GOOD - logger.info("%s : Есть связь ✅" % node_cell_ind[i_node].get('fname')) + logger.info("✅ %s : Есть связь" % node_cell_ind[i_node].get('fname')) else: node_cell_ind[i_node].state = Constants.STATE_VAL.ERROR - logger.error("%s : Нет связи ❌" % node_cell_ind[i_node].get('fname')) + logger.error("❌ %s : Нет связи" % node_cell_ind[i_node].get('fname')) + + if node_cell_ind[3].state == Constants.STATE_VAL.GOOD: + yau_07b_setup() + logger.info('%s: Настройка угла и аттенюации ...' % node_cell_ind[3].get('fname')) + else: + logger.error('❌ %s: Нет на связи, не буду продолжать' % node_cell_ind[3].get('fname')) else: for i_node_unknow in range(5, 13): node_cell_ind[i_node_unknow].state = Constants.STATE_VAL.NONE @@ -427,7 +450,7 @@ func _status_cell(status): func _on_timer(): if (Network.unit.online): logger = Logger.new(get_node('log_array')) - logger.info("ЯУ-07Б: Есть связь ✅ ") + logger.info("✅ ЯУ-07Б: Есть связь") $soc_y5/yau_07b.state = Constants.STATE_VAL.GOOD _status_cell(Network.unit.status) else: @@ -435,14 +458,14 @@ func _on_timer(): node_cell_ind[i].state = Constants.STATE_VAL.NONE $soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR - logger.error("ЯУ-07Б: Нет связи ❌") + logger.error("❌ ЯУ-07Б: Нет связи") if (Network.unit_fs.online): logger.info('Настройка модулей ФС Гц:') fs_1_setup(Constants.FS_FREQ.f2) # Гц fs_2_setup(Constants.FS_FREQ.f3) # Гц else: - logger.error('Настройка модулей ФС ❌') + logger.error('❌ Настройка модулей ФС') func _on_fs_status(META:int): @@ -455,7 +478,7 @@ func _on_fs_status(META:int): if flag_fs_1_ready and flag_fs_2_ready: #dkm var dkm: int = Network.unit.status.decode_u8(Constants.DataIndices.DKM) - $DKM.text = str(dkm) + if Constants.CURRENT_MODE == Constants.MODE.PRD_H: $soc_DKM/DKM_2.state = (dkm >> 1) & 0x1 $soc_DKM/DKM_3.state = (dkm >> 2) & 0x1 @@ -472,7 +495,6 @@ func _on_fs_status(META:int): if (dkm >> 1) & 0x1 == 1 and (dkm >> 2) & 0x1 == 1: # Следующий шаг -> flag_dkm = true - yau_07b_setup() elif Constants.CURRENT_MODE == Constants.MODE.PRD_B: $soc_DKM/DKM_2.state = (dkm >> 3) & 0x1 $soc_DKM/DKM_3.state = (dkm >> 4) & 0x1 @@ -486,9 +508,9 @@ func _on_fs_status(META:int): logger.info('%s: %s ✅' % [$Kasseta_FS/ref_A4.fname, 'Включено']) else: logger.info('%s: %s ❌' % [$Kasseta_FS/ref_A4.fname, 'Нет связи']) + if (dkm >> 3) & 0x1 == 1 and (dkm >> 4) & 0x1 == 1: # Следующий шаг -> flag_dkm = true - yau_07b_setup() elif Constants.CURRENT_MODE == Constants.MODE.PRD_K: $soc_DKM/DKM_1.state = (dkm >> 0) & 0x1 $soc_DKM/DKM_2.state = (dkm >> 5) & 0x1 @@ -526,9 +548,9 @@ func _on_timer_03(): Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000) flag_control_add = false await get_tree().create_timer(1.0).timeout - logger.info('Количество принятых пакетов от ЯУ-07Б: %s пакета' % count_packet) - logger.info('Максимальные значения по мощности от УКП-1: %s ' % str(array_pow_1)) - logger.info('Максимальные значения по мощности от УКП-1: %s ' % str(array_pow_2)) + logger.info('Количество принятых пакетов от ЯУ-07Б: %s пкт.' % count_packet) + logger.info('Максимальные значения мощностей от УКП-1: %s ' % str(array_pow_1)) + logger.info('Максимальные значения мощности от УКП-2: %s ' % str(array_pow_2)) _status_prd() $log_array/await.visible = false Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CZI_1) @@ -552,16 +574,28 @@ func _status_prd(): var min_dopusk: int = 40 if (status == count_cell-7): pribor_ispraven = true + var count_um: int = 0 for i_pow in array_pow_1: + um_cell_ind[count_um].value1 = i_pow if i_pow < min_dopusk: pribor_ispraven = false + um_cell_ind[count_um].state = Constants.STATE_VAL.ERROR + else: + um_cell_ind[count_um].state = Constants.STATE_VAL.GOOD + count_um += 1 + for i_pow in array_pow_2: + um_cell_ind[count_um].value1 = i_pow if i_pow < min_dopusk: pribor_ispraven = false + um_cell_ind[count_um].state = Constants.STATE_VAL.ERROR + else: + um_cell_ind[count_um].state = Constants.STATE_VAL.GOOD + count_um += 1 if pribor_ispraven: - $lbl_control.text = 'Прибор исправен' + $lbl_control.text = 'Прибор %s исправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0] $lbl_control.modulate = Color.AQUAMARINE else: - $lbl_control.text = 'Прибор неисправен' + $lbl_control.text = 'Прибор %s неисправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0] $lbl_control.modulate = Color.CRIMSON diff --git a/scripts/modul_fs.gd b/scripts/modul_fs.gd index 7bebe73..37307fd 100644 --- a/scripts/modul_fs.gd +++ b/scripts/modul_fs.gd @@ -1,15 +1,73 @@ extends Node const INDEX_SIZE = 0xC -var unit_fs = Fs.FGOS.new() +var unit_fs_1 = Fs.FGOS.new() var counter: int = 0 +var client_fs_1: StreamPeer +var ip_fs_1: String = Constants.ADDRESSES[0][4] +var peerstream_fs_1: PacketPeer +var state_fs = Constants.STATE.IDLE +var command_stack: Array +var counter_fs_1: int = 0 + func _ready() -> void: pass +# Подключится к модулю ФС +func connect_fs_1(): + if client_fs_1: + unit_fs_1.disconnect_fs(client_fs_1) + state_fs = Constants.STATE.IDLE + command_stack = [] + + client_fs_1 = StreamPeerTCP.new() + peerstream_fs_1 = PacketPeerStream.new() + var rc = client_fs_1.connect_to_host(ip_fs_1, Constants.PORT_FS) + if rc!= Error.OK: + emit_signal("port_error", ip_fs_1) + else: + peerstream_fs_1.set_stream_peer(client_fs_1) + + func _process(_delta: float) -> void: - pass + if client_fs_1: + poll_receive_fs(client_fs_1, peerstream_fs_1, ip_fs_1) + state_machine_fs(client_fs_1) + + +func state_machine_fs(client_fs): + ## State fs machine + if client_fs == client_fs_1: + if (state_fs == Constants.STATE.IDLE) or (state_fs == Constants.STATE.DONE): + if command_stack: + var pack: Array = command_stack.pop_front() + unit_fs_1.send_fs_data(pack, client_fs_1, peerstream_fs_1) + state_fs = Constants.STATE.SEND + + +func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: String): + client.poll() + var peer = peerstream.get_stream_peer() + # Проверяем, существует ли соединение + if not peer: + emit_signal("port_error", ip_fs) + return + # Проверяем состояние подключения + if client.get_status() != StreamPeerTCP.STATUS_CONNECTED: + if client == client_fs_1: + emit_signal("port_fs_closed_1", ip_fs) + return + + if peer.get_available_bytes() > 0: + var rx_data: PackedByteArray + rx_data.append_array(peer.get_data(peer.get_available_bytes())[1]) + if client == client_fs_1: + emit_signal("data_from_fs_1", rx_data) + emit_signal("port_fs_opened_1", ip_fs) + if state_fs == Constants.STATE.SEND: + state_fs = Constants.STATE.DONE func _enter_tree() -> void: @@ -57,30 +115,16 @@ func _on_data_send(): #$read.text = str(data.hex_encode()) -func _on_send_pressed() -> void: - unit_fs.get_carrier(counter, Network.client_fs_1) - - -func _on_get_att() -> void: - unit_fs.get_att_batch(counter, Network.client_fs_1) - - func _on_start(): - unit_fs.start_session(counter, Network.client_fs_1) - unit_fs.base_get_current_temp(counter, Network.client_fs_1) + unit_fs_1.start_session(counter, Network.client_fs_1) + unit_fs_1.get_base_current_temp(counter, Network.client_fs_1) func _on_get_status(toggled_btn): var inverted_state = not toggled_btn - unit_fs.set_gen_state(inverted_state, counter, Network.client_fs_1) - unit_fs.get_gen_state(counter, Network.client_fs_1) + unit_fs_1.set_gen_state(inverted_state, counter, Network.client_fs_1) + unit_fs_1.get_gen_state(counter, Network.client_fs_1) -func _on_set_ferq(): - var freq = int($set_space/write_to_set_freq.get_text()) * 1_000_000 - unit_fs.set_carrier(freq, counter, Network.client_fs_1) - - -func _on_set_att(): - var att = float($set_space/write_to_set_att.get_text()) - unit_fs.set_att_batch(att, counter, Network.client_fs_1) +func _on_addres_fs(input_addr: String) -> void: + ip_fs_1 = input_addr diff --git a/scripts/network.gd b/scripts/network.gd index 7fe9be8..bd61374 100644 --- a/scripts/network.gd +++ b/scripts/network.gd @@ -33,6 +33,7 @@ var counter_fs_2: int = 0 # Яу-07б signal yau_status_line(_status) ## Вызывается когда меняется состояние связи с ячейкой signal yau_receive(_data_from_yau) +signal yau_feedback_receive(_data_from_yau) signal yau_read_isa(_unit_isa_ports) # ФС модуль signal data_from_fs_1(data:PackedByteArray) @@ -63,6 +64,8 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник unit.parse(broadcast_packet) var data_from_yau_07 = unit.status emit_signal('yau_receive', data_from_yau_07) + if sock == soc_unicast: + emit_signal('yau_feedback_receive', data_from_yau_07) else: if sock.get_available_packet_count(): last_update_time_yau07 = 0.0 diff --git a/table/header.tscn b/table/header.tscn index f12873f..0e5e519 100644 --- a/table/header.tscn +++ b/table/header.tscn @@ -3,7 +3,7 @@ [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2thpi"] bg_color = Color(0.455894, 0.0685824, 0.187642, 0.945098) corner_radius_top_left = 5 -corner_radius_top_right = 2 +corner_radius_top_right = 5 corner_radius_bottom_right = 5 corner_radius_bottom_left = 5 diff --git a/table/блок-а.tscn b/table/блок-а.tscn index f3ac4a5..dab25cb 100644 --- a/table/блок-а.tscn +++ b/table/блок-а.tscn @@ -1,10 +1,10 @@ -[gd_scene load_steps=14 format=3 uid="uid://bkxblfoj7ejv0"] +[gd_scene load_steps=14 format=3 uid="uid://bn2n3lgc4ts1r"] [ext_resource type="Texture2D" uid="uid://ce3qpf070wgd2" path="res://pictures/состояние-исправности-0.png" id="1_xcvfs"] [ext_resource type="Texture2D" uid="uid://byweg7pgt8o4h" path="res://pictures/состояние-исправности-1.png" id="2_ad1dj"] [ext_resource type="Texture2D" uid="uid://bvikuv0lbvou8" path="res://pictures/состояние-исправности-2.png" id="3_vxg7f"] [ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://pictures/nine-patch-round.png" id="4_1bnn6"] -[ext_resource type="PackedScene" uid="uid://dyjtmfm4u58mu" path="res://table/уровень.tscn" id="5_3i5am"] +[ext_resource type="PackedScene" path="res://table/уровень.tscn" id="5_3i5am"] [sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_3nd2u"] @@ -219,6 +219,7 @@ layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 theme_override_font_sizes/font_size = 17 +text = "УМ" horizontal_alignment = 1 vertical_alignment = 1 @@ -238,10 +239,14 @@ size_flags_vertical = 6 layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +max_value = 150.0 +value_name = "T°" [node name="indicator1" parent="margin/vbox/grid1" instance=ExtResource("5_3i5am")] layout_mode = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +max_value = 2000.0 +value_name = "Pwr" [connection signal="pressed" from="button" to="." method="_on_button_pressed"]