Необходима доработка с ПРД-К

This commit is contained in:
Maxim
2025-07-09 22:30:17 +03:00
parent 3242b70078
commit 19af5eafdd
4 changed files with 82 additions and 37 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=75 format=3 uid="uid://cvor2jm4xk3ha"] [gd_scene load_steps=80 format=3 uid="uid://cvor2jm4xk3ha"]
[ext_resource type="Script" path="res://scripts/PRD.gd" id="1_v273n"] [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"] [ext_resource type="Texture2D" uid="uid://cdxdluvyb5uei" path="res://table/on.png" id="2_dv7xx"]
@@ -177,6 +177,16 @@ corner_radius_top_right = 5
corner_radius_bottom_right = 5 corner_radius_bottom_right = 5
corner_radius_bottom_left = 5 corner_radius_bottom_left = 5
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_4bi66"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_f7trn"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_wydcf"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_6bubr"]
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_o3x62"]
[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tn8m6"] [sub_resource type="StyleBoxTexture" id="StyleBoxTexture_tn8m6"]
[sub_resource type="ShaderMaterial" id="ShaderMaterial_07wue"] [sub_resource type="ShaderMaterial" id="ShaderMaterial_07wue"]
@@ -767,6 +777,22 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_eleyh")
text = "Подключение" text = "Подключение"
metadata/_edit_lock_ = true 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
tooltip_text = "Упрелвение блокировкой ЭМС для модуляции УМ"
mouse_default_cursor_shape = 2
theme_override_styles/focus = SubResource("StyleBoxEmpty_4bi66")
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 = "Управление блокировкой выходов ЭМС "
metadata/_edit_lock_ = true
[node name="ControlPanel" type="Panel" parent="TabContainer"] [node name="ControlPanel" type="Panel" parent="TabContainer"]
visible = false visible = false
layout_mode = 2 layout_mode = 2
@@ -1365,3 +1391,4 @@ metadata/_edit_lock_ = true
[connection signal="pressed" from="Background/switch_panel/texture_save_config" to="." method="_on_save_config"] [connection signal="pressed" from="Background/switch_panel/texture_save_config" to="." method="_on_save_config"]
[connection signal="pressed" from="Background/switch_panel/texture_load_config" to="." method="_on_load_config"] [connection signal="pressed" from="Background/switch_panel/texture_load_config" to="." method="_on_load_config"]
[connection signal="pressed" from="TabContainer/PRD/Connect_prd" to="." method="_on_connect_prd_pressed"] [connection signal="pressed" from="TabContainer/PRD/Connect_prd" to="." method="_on_connect_prd_pressed"]
[connection signal="toggled" from="TabContainer/PRD/ems_block" to="." method="on_ems_block"]

View File

@@ -23,10 +23,11 @@ var att_fs_2: float
var att_fs_3: float var att_fs_3: float
var status_pribor = null var status_pribor = null
var save_path = "res://saves/" var save_path = "res://saves/"
const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
var current_meta: Array = [Constants.META.MODUL_UM_1, Constants.META.MODUL_UM_2, Constants.META.MODUL_UM_3, Constants.META.MODUL_UM_28] var current_meta: Array = [Constants.META.MODUL_UM_1, Constants.META.MODUL_UM_2, Constants.META.MODUL_UM_3, Constants.META.MODUL_UM_28]
var modul_um: Array = [0, 0, 0, 0] var modul_um: Array = [0, 0, 0, 0]
var receive_yau_counter: Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] var receive_yau_counter: Array = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
const TIMER_BLOCK_EMS: float = 2.0
func _ready() -> void: func _ready() -> void:
@@ -240,8 +241,10 @@ func _ready() -> void:
self.add_child(timer_modul_um) self.add_child(timer_modul_um)
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um')) timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
timer_modul_um.wait_time = TIMER_BLOCK_EMS
self.connect('write_ems_g_start', _on_write_ems_g) self.connect('write_ems_g_start', _on_write_ems_g)
$Background/switch_panel/burgerButton.set_pressed_no_signal(true) $Background/switch_panel/burgerButton.set_pressed_no_signal(true)
_on_burger_button(true)
func add_signs_scene(): func add_signs_scene():
@@ -473,8 +476,6 @@ func _on_data_fs(fs_data: PackedByteArray, unit_fs_client: Node):
fs_control_node_path = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control fs_control_node_path = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
3: 3:
pass pass
match CMD: match CMD:
Constants.CMD.READ_CARRIER: Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE: if GRP == Constants.GROUP.BASE:
@@ -502,7 +503,7 @@ func _on_data_fs(fs_data: PackedByteArray, unit_fs_client: Node):
ray_node_path.material.set('shader_parameter/speed', 2.5) ray_node_path.material.set('shader_parameter/speed', 2.5)
fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(true) fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
else: else:
node_select_fs_1.set_node_text(2, 5, 'Отключен') node_select.set_node_text(2, 5, 'Отключен')
node_select.get_node2(2, 5).modulate = Color.CRIMSON node_select.get_node2(2, 5).modulate = Color.CRIMSON
ray_node_path.material.set('shader_parameter/speed', 0.0) ray_node_path.material.set('shader_parameter/speed', 0.0)
fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(false) fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
@@ -734,28 +735,11 @@ func _on_modul_um(item_from_ray_1: int, node: Node):
else: else:
return return
if modul_um.has(0x2000) or modul_um.has(0x8000):
timer_modul_um.wait_time = 2.3
timer_modul_um.start()
## Таймер для модуляции УМ ## Таймер для модуляции УМ
func _on_timer_modul_um(): func _on_timer_modul_um():
if modul_um.has(0x2000) or modul_um.has(0x8000): const DATA_FOR_UNBLOCK_EMS: int = 6666
for i in range(3): Network.write_port_isa(Constants.BASE_PORTS.EMS_G, DATA_FOR_UNBLOCK_EMS)
if modul_um[i] == 0x8000:
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, current_meta[i])
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i])
elif modul_um[i] == 0x2000:
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, current_meta[i])
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i])
if current_meta[i] == Constants.META.MODUL_UM_1:
modul_um[3] = modul_um[i]
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, Constants.META.MODUL_UM_28)
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[i])
else:
timer_modul_um.stop()
## Включение/отключение сигнала ФГОЗ ## Включение/отключение сигнала ФГОЗ
@@ -999,3 +983,10 @@ func save_settings(to_att_change: float, mode: int):
file.close() file.close()
Constants.read_file() Constants.read_file()
func on_ems_block(toggled_on: bool) -> void:
if toggled_on:
timer_modul_um.start()
else:
timer_modul_um.stop()

View File

@@ -39,6 +39,9 @@ func _on_read_ems_g():
func _on_sync(): func _on_sync():
if not get_parent().get_parent().get_child(0).get_child(1).get_child(2).is_pressed() or not $load_boadr.is_visible_in_tree():
return
for index in 16: for index in 16:
for row in 16: for row in 16:
var chk_btn = node_select1.get_node2(index+2, row+3).get_child(1, false) var chk_btn = node_select1.get_node2(index+2, row+3).get_child(1, false)

View File

@@ -153,6 +153,7 @@ func _on_connect_change(unit_state_connect) -> void:
func on_command_change_device(meta_device): func on_command_change_device(meta_device):
print(meta_device)
send_array = [] send_array = []
ip_address_yau = meta_device[0] ip_address_yau = meta_device[0]
ip_port_yau = meta_device[1] ip_port_yau = meta_device[1]
@@ -164,17 +165,40 @@ func on_command_change_device(meta_device):
unit_fs_2.disconnect_fs() unit_fs_2.disconnect_fs()
unit_fs_2.connect_to_host(meta_device[4], Constants.PORT_FS) unit_fs_2.connect_to_host(meta_device[4], Constants.PORT_FS)
await get_tree().create_timer(0.5).timeout await get_tree().create_timer(0.1).timeout
if unit_fs_1.online: setup_fs(unit_fs_1, meta_device[2])
unit_fs_1.get_carrier() setup_fs(unit_fs_2, meta_device[2])
unit_fs_1.get_att_batch()
unit_fs_1.get_gen_state()
unit_fs_1.get_base_current_temp()
unit_fs_1.get_base_can_macro()
if unit_fs_2.online:
unit_fs_2.get_carrier()
unit_fs_2.get_att_batch()
unit_fs_2.get_gen_state()
unit_fs_2.get_base_current_temp()
unit_fs_2.get_base_can_macro()
#ip_fs_3 = meta_device[5] #ip_fs_3 = meta_device[5]
func setup_fs(unit_fs: Node, mode_prd: int) -> void:
var freq: int
var att: float
if mode_prd == Constants.MODE.PRD_H:
freq = Constants.FS_FREQ.f2 if unit_fs == Network.unit_fs_1 else Constants.FS_FREQ.f3
att = Constants.FS_ATT['ПРД-Н1'][0] if unit_fs == Network.unit_fs_1 else Constants.FS_ATT['ПРД-Н1'][1]
elif mode_prd == Constants.MODE.PRD_B:
freq = Constants.FS_FREQ.f4 if unit_fs == Network.unit_fs_1 else Constants.FS_FREQ.f5
att = Constants.FS_ATT['ПРД-В1'][0] if unit_fs == Network.unit_fs_1 else Constants.FS_ATT['ПРД-В1'][1]
elif mode_prd == Constants.MODE.PRD_K:
freq = Constants.FS_FREQ.f6 if unit_fs == Network.unit_fs_1 else Constants.FS_FREQ.f7
att = Constants.FS_ATT['ПРД-К1'][0] if unit_fs == Network.unit_fs_1 else Constants.FS_ATT['ПРД-К1'][1]
#var freq = Constants.FS_FREQ.f1 if unit_fs = Network.unit_fs_1 else
if unit_fs.online:
unit_fs.set_gen_state(false)
await get_tree().create_timer(0.3).timeout
unit_fs.get_gen_state()
unit_fs.set_gen_state(true)
await get_tree().create_timer(0.3).timeout
unit_fs.set_carrier(freq * 1_000_000)
unit_fs.set_att_batch(att)
unit_fs.get_carrier()
unit_fs.get_att_batch()
unit_fs.get_base_current_temp()
unit_fs.get_base_can_macro()
unit_fs.get_gen_state()