Новый клиент от ФС

This commit is contained in:
Maxim
2025-05-28 14:52:37 +03:00
parent eb36856831
commit f916c742c9
8 changed files with 1779 additions and 849 deletions

View File

@@ -202,37 +202,49 @@ 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, 4).connect('item_selected', Callable(self, '_on_modul_fs_1'))
node_select_fs_1.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_1'))
node_select_fs_1.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_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, 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, 4).connect('item_selected', Callable(self, '_on_modul_fs_2'))
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_2'))
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status').bind(Network.unit_fs_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'))
## 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'))
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_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'))
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.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, true))
Network.unit_fs_1.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, false))
Network.unit_fs_1.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_1, false))
Network.unit_fs_1.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_1))
Network.unit_fs_2.connect("connected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, true))
Network.unit_fs_2.connect("disconnected", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, false))
Network.unit_fs_2.connect("error_connect", Callable(self, "_on_port_changed").bind(Network.unit_fs_2, false))
Network.unit_fs_2.connect("data_fs", Callable(self, "_on_data_fs").bind(Network.unit_fs_2))
self.add_child(timer_modul_um)
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
self.connect('write_ems_g_start', _on_write_ems_g)
$Background/switch_panel/burgerButton.button_pressed = true
$Background/switch_panel/burgerButton.set_pressed_no_signal(true)
func add_signs_scene():
@@ -324,10 +336,12 @@ func add_signs_scene():
# Список статусов ячеек ЯУ-07б
func _on_yau_status(addr: String):
var count_packets_await: int = 10
var count_packets_await: int = 20
var status_yau_list = $TabContainer/PRD/status_yau_list.get_children()
var status_label = $TabContainer/PRD/status_yau
if addr.is_empty():
if Network.unit.online:
return
# Сброс состояния, если адрес пуст (нет связи)
for label in status_yau_list:
label.text = ''
@@ -398,15 +412,15 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
if tmp_device_mode == Constants.META.CI_1_B_UF:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1,1).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14)
if tmp_device_mode == Constants.META.CI_2_B_UF:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14)
if tmp_device_mode == Constants.META.CI_3_B_UF:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14)
if tmp_device_mode == Constants.META.MODUL_UM_1: ## Синхронизация с Модуляцией УМ лиетры 1
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
@@ -437,107 +451,137 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
if tmp_device_mode == Constants.META.FGOZ_4:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,5).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15)
if tmp_device_mode == Constants.META.FGOZ_3:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).set_pressed_no_signal(data_dict[Constants.BASE_PORTS.EMS_G+8] >> 15)
## Процесс обработки данных от модулей ФС в таблице
func _on_data_fs(fs_data: PackedByteArray, unit_fs_client: Node):
var GRP = fs_data.decode_u8(0x0)
var CMD = fs_data.decode_u8(0x1)
var node_select
var ray_node_path
var fs_control_node_path
var fs_number = 1 if unit_fs_client == Network.unit_fs_1 else 2 if unit_fs_client == Network.unit_fs_2 else 3
match fs_number:
1:
node_select = node_select_fs_1
ray_node_path = $TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1
fs_control_node_path = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control
2:
node_select = node_select_fs_2
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
func _on_data_fs_1(fs_1_data):
var GRP = fs_1_data.decode_u8(0x0)
var CMD = fs_1_data.decode_u8(0x1)
match CMD:
Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE:
freq_fs_1 = fs_1_data.decode_u64(0xC) / 1_000_000
node_select_fs_1.set_node_text(2, 2, str(freq_fs_1) + ' МГц')
var freq = int(fs_data.decode_u64(0xC) / 1_000_000.0)
node_select.set_node_text(2, 2, str(freq) + ' МГц')
match fs_number:
1: freq_fs_1 = freq
2: freq_fs_2 = freq
3: freq_fs_3 = freq
Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF:
att_fs_1 = fs_1_data.decode_float(0x18)
node_select_fs_1.set_node_text(2, 3, str(att_fs_1) + ' dB')
var att = fs_data.decode_float(0x18)
node_select.set_node_text(2, 3, str(att) + ' dB')
match fs_number:
1: att_fs_1 = att
2: att_fs_2 = att
3: att_fs_3 = att
Constants.CMD.READ_GEN_STATUS:
if GRP == Constants.GROUP.GENERATOR:
if fs_1_data.decode_u32(0xC) == 0:
node_select_fs_1.set_node_text(2, 5, 'Включен')
node_select_fs_1.get_node2(2, 5).modulate = Color.AQUAMARINE
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/speed', 2.5)
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 5).get_child(1).button_pressed = true
if fs_data.decode_u32(0xC) == 0:
node_select.set_node_text(2, 5, 'Включен')
node_select.get_node2(2, 5).modulate = Color.AQUAMARINE
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_fs_1.get_node2(2, 5).modulate = Color.CRIMSON
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/speed', 0.0)
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1, 5).get_child(1).button_pressed = false
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)
Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE:
node_select_fs_1.set_node_text(2, 0, '%.2f' % fs_1_data.decode_float(0xC) + ' °C')
node_select.set_node_text(2, 0, '%.2f' % fs_data.decode_float(0xC) + ' °C')
Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE:
node_select_fs_1.set_node_text(2, 7, str(fs_1_data.decode_u16(0x20)) + ' МГц')
node_select.set_node_text(2, 7, str(fs_data.decode_u16(0x20)) + ' МГц')
func _on_data_fs_2(fs_2_data):
var GRP = fs_2_data.decode_u8(0x0)
var CMD = fs_2_data.decode_u8(0x1)
match CMD:
Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE:
freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000
node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF:
att_fs_2 = fs_2_data.decode_float(0x18)
node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
Constants.CMD.READ_GEN_STATUS:
if GRP == Constants.GROUP.GENERATOR:
if fs_2_data.decode_u32(0xC) == 0:
node_select_fs_2.set_node_text(2, 5, 'Включен')
node_select_fs_2.get_node2(2, 5).modulate = Color.AQUAMARINE
node_select_fs_2.get_node2(1, 5).get_child(1).button_pressed = true
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
else:
node_select_fs_2.set_node_text(2, 5, 'Отключен')
node_select_fs_2.get_node2(2, 5).modulate = Color.CRIMSON
node_select_fs_2.get_node2(1, 5).get_child(1).button_pressed = false
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE:
node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE:
node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц')
func _on_data_fs_3(fs_3_data):
var GRP = fs_3_data.decode_u8(0x0)
var CMD = fs_3_data.decode_u8(0x1)
match CMD:
Constants.CMD.READ_CARRIER:
if GRP == Constants.GROUP.BASE:
freq_fs_3 = fs_3_data.decode_u64(0xC) / 1_000_000
node_select_fs_3.set_node_text(2, 2, str(freq_fs_3) + ' МГц')
Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF:
att_fs_3 = fs_3_data.decode_float(0x18)
node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB')
Constants.CMD.READ_GEN_STATUS:
if GRP == Constants.GROUP.GENERATOR:
if fs_3_data.decode_u32(0xC) == 0:
node_select_fs_3.set_node_text(2, 5, 'Включен')
node_select_fs_3.get_node2(2, 5).modulate = Color.AQUAMARINE
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = true
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
else:
node_select_fs_3.set_node_text(2, 5, 'Отключен')
node_select_fs_3.get_node2(2, 5).modulate = Color.CRIMSON
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = false
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE:
node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
Constants.CMD.BASE_CAN_MACRO_READ:
if GRP == Constants.GROUP.BASE:
node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц')
#func _on_data_fs_2(fs_2_data):
#var GRP = fs_2_data.decode_u8(0x0)
#var CMD = fs_2_data.decode_u8(0x1)
#match CMD:
#Constants.CMD.READ_CARRIER:
#if GRP == Constants.GROUP.BASE:
#freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000.0
#node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
#Constants.CMD.READ_ATT:
#if GRP == Constants.GROUP.RF:
#att_fs_2 = fs_2_data.decode_float(0x18)
#node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
#Constants.CMD.READ_GEN_STATUS:
#if GRP == Constants.GROUP.GENERATOR:
#if fs_2_data.decode_u32(0xC) == 0:
#node_select_fs_2.set_node_text(2, 5, 'Включен')
#node_select_fs_2.get_node2(2, 5).modulate = Color.AQUAMARINE
#node_select_fs_2.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
#else:
#node_select_fs_2.set_node_text(2, 5, 'Отключен')
#node_select_fs_2.get_node2(2, 5).modulate = Color.CRIMSON
#node_select_fs_2.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
#Constants.CMD.BASE_GET_CURRENT_TEMP:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_2.set_node_text(2, 0, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
#Constants.CMD.BASE_CAN_MACRO_READ:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_2.set_node_text(2, 7, str(fs_2_data.decode_u16(0x20)) + ' МГц')
#
#
#func _on_data_fs_3(fs_3_data):
#var GRP = fs_3_data.decode_u8(0x0)
#var CMD = fs_3_data.decode_u8(0x1)
#match CMD:
#Constants.CMD.READ_CARRIER:
#if GRP == Constants.GROUP.BASE:
#freq_fs_3 = fs_3_data.decode_u64(0xC) / 1_000_000
#node_select_fs_3.set_node_text(2, 2, str(freq_fs_3) + ' МГц')
#Constants.CMD.READ_ATT:
#if GRP == Constants.GROUP.RF:
#att_fs_3 = fs_3_data.decode_float(0x18)
#node_select_fs_3.set_node_text(2, 3, str(att_fs_3) + ' dB')
#Constants.CMD.READ_GEN_STATUS:
#if GRP == Constants.GROUP.GENERATOR:
#if fs_3_data.decode_u32(0xC) == 0:
#node_select_fs_3.set_node_text(2, 5, 'Включен')
#node_select_fs_3.get_node2(2, 5).modulate = Color.AQUAMARINE
#node_select_fs_3.get_node2(1, 5).get_child(1).set_pressed_no_signal(true)
#$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
#else:
#node_select_fs_3.set_node_text(2, 5, 'Отключен')
#node_select_fs_3.get_node2(2, 5).modulate = Color.CRIMSON
#node_select_fs_3.get_node2(1, 5).get_child(1).set_pressed_no_signal(false)
#$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
#Constants.CMD.BASE_GET_CURRENT_TEMP:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
#Constants.CMD.BASE_CAN_MACRO_READ:
#if GRP == Constants.GROUP.BASE:
#node_select_fs_3.set_node_text(2, 7, str(fs_3_data.decode_u16(0x20)) + ' МГц')
func _process(_delta: float) -> void:
@@ -708,10 +752,10 @@ func on_mode_select(intem_from_sector: int) -> void:
add_signs_scene()
Network.on_command_change_device(meta)
Network.read_port_isa([Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+0xA])
Network.start_work_fs_1(pribor_selec)
Network.start_work_fs_2(pribor_selec)
if meta[2] == Constants.MODE.PRD_K:
Network.start_work_fs_3(pribor_selec)
#Network.start_work_fs_1(pribor_selec)
#Network.start_work_fs_2(pribor_selec)
#if meta[2] == Constants.MODE.PRD_K:
#Network.start_work_fs_3(pribor_selec)
$load_status_yau.value = 0
emit_signal('read_ems_g_start')
$load_status_yau.visible = true
@@ -862,16 +906,18 @@ func set_bits(v, a, m):
## ФС Connect close
func _on_port_changed(port_name: String, color: Color) -> void:
if port_name == Network.ip_fs_1:
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, port_name)
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = color
elif port_name == Network.ip_fs_2:
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, port_name)
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = color
elif port_name == Network.ip_fs_3:
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, port_name)
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = color
func _on_port_changed(client_addr: String, unit_fs_client: Node, status_online:bool) -> void:
if unit_fs_client == Network.unit_fs_1:
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, client_addr)
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
elif unit_fs_client == Network.unit_fs_2:
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, client_addr)
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
elif unit_fs_client == Network.unit_fs_3:
$TabContainer/PRD/body_grid/litera_1/fs_control.set_node_text(1, 1, client_addr)
$TabContainer/PRD/body_grid/litera_1/fs_control.get_node2(1,1).modulate = Color.AQUAMARINE if status_online else Color.DARK_GRAY
# Установка формы сигнала (модуляция константа или msk)
func _on_modul_fs_1(modulation_select_1) -> void:
@@ -882,14 +928,14 @@ func _on_modul_fs_1(modulation_select_1) -> void:
# Установка и получение статуса генератора фс
func _on_get_status_1(toggled_btn):
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
func _on_get_status(toggled_btn: bool, unit_fs_client: Node):
if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
var inverted_state = not toggled_btn
Network.set_fs_gen_status(inverted_state)
Network.get_gen_state_1()
unit_fs_client.set_gen_state(inverted_state)
unit_fs_client.get_gen_state()
func _on_set_ferq_1(freq: String):
func _on_set_ferq(freq: String, unit_fs_client: Node):
# Проверка на наличие символов в строке freq
var regex = RegEx.new()
regex.compile("^[0-9]+$")
@@ -904,12 +950,14 @@ func _on_set_ferq_1(freq: String):
print_debug('Некорректная частота')
return
Network.set_fs_ferq_carrier(freq_int)
unit_fs_client.set_carrier(freq_int)
unit_fs_client.get_carrier()
func _on_set_att_1(att: String):
Network.set_fs_attenuation(float(att))
Network.unit_fs_1.set_att_batch(float(att))
save_settings(float(att), 0)
Network.unit_fs_1.get_att_batch()
func _on_set_base_can_macro(can_freq: String):
@@ -920,29 +968,29 @@ func _on_status_can_macro_1(toggled_btn: bool):
Network.status_can_macro_1(toggled_btn)
## 2 ФС
func _on_get_status_2(toggled_btn):
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
var inverted_state = not toggled_btn
Network.set_fs_gen_status_2(inverted_state)
Network.get_gen_state_2()
### 2 ФС
#func _on_get_status_2(toggled_btn):
#if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
#var inverted_state = not toggled_btn
#Network.unit_fs_2.set_gen_state(inverted_state)
#Network.unit_fs_2.get_gen_state()
func _on_set_ferq_2(freq: String):
# Проверка на наличие символов в строке freq
var regex = RegEx.new()
regex.compile("^[0-9]+$")
if not regex.search(freq):
print_debug('Ошибка: частота должна быть числом без букв')
return
# Преобразование строки в число
var freq_int = int(freq) * 1_000_000
# Проверка на диапазон
if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
print_debug('Некорректная частота')
return
Network.set_fs_ferq_carrier_2(freq_int)
#func _on_set_ferq_2(freq: String):
## Проверка на наличие символов в строке freq
#var regex = RegEx.new()
#regex.compile("^[0-9]+$")
#if not regex.search(freq):
#print_debug('Ошибка: частота должна быть числом без букв')
#return
## Преобразование строки в число
#var freq_int = int(freq) * 1_000_000
#
## Проверка на диапазон
#if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
#print_debug('Некорректная частота')
#return
#Network.set_fs_ferq_carrier_2(freq_int)
func _on_set_att_2(att: String):
@@ -967,7 +1015,7 @@ func _on_modul_fs_2(modulation_select_2) -> void:
## ФС 3
func _on_get_status_3(toggled_btn):
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
if $Background/switch_panel/select_prd.is_pressed() or $Background/switch_panel/texture_prd.is_pressed():
var inverted_state = not toggled_btn
Network.set_fs_gen_status_3(inverted_state)
Network.get_gen_state_3()
@@ -1015,8 +1063,8 @@ func _on_prd_select() -> void:
$load_status_yau.value = 0
emit_signal('read_ems_g_start')
set_tab_and_buttons(0, 'select_prd', 'texture_prd')
Network.get_gen_state_1()
Network.get_gen_state_2()
Network.unit_fs_1.get_gen_state()
Network.unit_fs_2.get_gen_state()
func _on_control_button() -> void:
@@ -1076,7 +1124,7 @@ func set_tab_and_buttons(tab_index: int, button_name: String, txt_button_name: S
for button in switch_panel.get_children():
if button is Button or TextureButton:
if button.name != 'burgerButton':
button.button_pressed = (button.name == button_name or button.name == txt_button_name)
button.set_pressed_no_signal(button.name == button_name or button.name == txt_button_name)
if button.name == 'select_control' or button.name == 'texture_control':
if button_name == 'select_control' or button_name == 'texture_control':
$load_status_yau.visible = false