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

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

@@ -23,10 +23,11 @@ var att_fs_2: float
var att_fs_3: float
var status_pribor = null
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 modul_um: Array = [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:
@@ -240,8 +241,10 @@ func _ready() -> void:
self.add_child(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)
$Background/switch_panel/burgerButton.set_pressed_no_signal(true)
_on_burger_button(true)
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
3:
pass
match CMD:
Constants.CMD.READ_CARRIER:
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)
fs_control_node_path.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
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
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)
@@ -734,28 +735,11 @@ func _on_modul_um(item_from_ray_1: int, node: Node):
else:
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():
if modul_um.has(0x2000) or modul_um.has(0x8000):
for i in range(3):
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()
const DATA_FOR_UNBLOCK_EMS: int = 6666
Network.write_port_isa(Constants.BASE_PORTS.EMS_G, DATA_FOR_UNBLOCK_EMS)
## Включение/отключение сигнала ФГОЗ
@@ -999,3 +983,10 @@ func save_settings(to_att_change: float, mode: int):
file.close()
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():
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 row in 16:
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):
print(meta_device)
send_array = []
ip_address_yau = meta_device[0]
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.connect_to_host(meta_device[4], Constants.PORT_FS)
await get_tree().create_timer(0.5).timeout
if unit_fs_1.online:
unit_fs_1.get_carrier()
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()
await get_tree().create_timer(0.1).timeout
setup_fs(unit_fs_1, meta_device[2])
setup_fs(unit_fs_2, meta_device[2])
#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()