1 litera is almost ready
This commit is contained in:
282
scripts/PRD.gd
282
scripts/PRD.gd
@@ -12,14 +12,19 @@ var node_select_yau_07b: Node
|
||||
var node_select_yau_07b_2: Node
|
||||
var node_select_fs_1: Node
|
||||
var node_select_fs_2: Node
|
||||
var node_select_fs_3: Node
|
||||
var isa_from_yau07b: Dictionary = {}
|
||||
var freq_fs_1: int
|
||||
var freq_fs_2: int
|
||||
var freq_fs_3: int
|
||||
var att_fs_1: float
|
||||
var att_fs_2: float
|
||||
var att_fs_3: float
|
||||
var status_pribor = null
|
||||
var save_path = "D://PRD-TU-MP550//"
|
||||
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]
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -58,27 +63,31 @@ func _ready() -> void:
|
||||
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
|
||||
var node_select_yau_07b_3: Node = $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
|
||||
#Таблица ФС-1
|
||||
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())
|
||||
node_select_fs_1.set_columns_min_size([150, 120, 150])
|
||||
node_select_fs_1.get_node2(1, 4).add_item('Const')
|
||||
node_select_fs_1.get_node2(1, 4).add_item('MSK')
|
||||
|
||||
#Таблица ФС-2
|
||||
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])
|
||||
node_select_fs_2.get_node2(1, 4).add_item('Const')
|
||||
node_select_fs_2.get_node2(1, 4).add_item('MSK')
|
||||
|
||||
#Таблица ФС-3
|
||||
var node_select_fs_3 = $TabContainer/PRD/body_grid/litera_1/fs_control
|
||||
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
|
||||
var item_place_yau_07_3: int = 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'
|
||||
@@ -91,7 +100,7 @@ func _ready() -> void:
|
||||
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
|
||||
var item_place_fs_3: int = 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]) # 'Состояние'
|
||||
@@ -112,15 +121,12 @@ func _ready() -> void:
|
||||
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
|
||||
var node_select_device: Node = $TabContainer/PRD/select_dev
|
||||
draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size())
|
||||
var get_select_device = node_select_device.get_node2(1, 0)
|
||||
|
||||
# Заполнение адресов
|
||||
for i_addr in Constants.ADDRESSES.size():
|
||||
var get_select_device: Node = node_select_device.get_node2(1, 0)
|
||||
for i_addr in Constants.ADDRESSES.size(): # Заполнение адресов
|
||||
get_select_device.add_item(Constants.ADDRESSES[i_addr][0])
|
||||
get_select_device.set_item_metadata(i_addr, Constants.ADDRESSES[i_addr].slice(1,7))
|
||||
get_select_device.connect('item_selected', Callable(self, 'on_mode_select'))
|
||||
node_select_device.get_node2(0,0).text = 'ПРИБОР'
|
||||
node_select_device.set_columns_min_size([100, 100])
|
||||
|
||||
@@ -144,19 +150,18 @@ func _ready() -> void:
|
||||
node_select_yau_07b.get_node2(1, 3).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 3).add_item(key)
|
||||
|
||||
|
||||
node_select_yau_07b_3.get_node2(1, 3).add_item(' 15°')
|
||||
|
||||
|
||||
## Заполненение списка аттенюатора
|
||||
for key in Constants.ATT_DICT:
|
||||
node_select_yau_07b.get_node2(1, 4).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
|
||||
|
||||
## Заполненение списка аттенюатора
|
||||
for key in Constants.ATT_DICT_correct:
|
||||
node_select_yau_07b_3.get_node2(1, 4).add_item(key)
|
||||
|
||||
|
||||
get_select_device.connect('item_selected', Callable(self, 'on_mode_select'))
|
||||
|
||||
## Yau-07b 1
|
||||
node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret_2'))
|
||||
node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um').bind(node_select_yau_07b.get_node2(1, 2)))
|
||||
@@ -170,6 +175,7 @@ func _ready() -> void:
|
||||
node_select_yau_07b_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_2'))
|
||||
node_select_yau_07b_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_fgos_2'))
|
||||
## Yau-07b 3
|
||||
node_select_yau_07b_3.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret_1'))
|
||||
node_select_yau_07b_3.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um').bind(node_select_yau_07b_3.get_node2(1, 2)))
|
||||
node_select_yau_07b_3.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_3'))
|
||||
|
||||
@@ -187,20 +193,26 @@ func _ready() -> void:
|
||||
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, 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'))
|
||||
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_1', _on_port_changed_fs_1.bind(Color.AQUAMARINE))
|
||||
Network.connect('port_fs_closed_1', _on_port_changed_fs_1.bind(Color.CRIMSON))
|
||||
Network.connect('port_fs_opened_2', _on_port_changed_fs_2.bind(Color.AQUAMARINE))
|
||||
Network.connect('port_fs_closed_2', _on_port_changed_fs_2.bind(Color.CRIMSON))
|
||||
Network.connect('port_fs_opened', _on_port_changed.bind(Color.AQUAMARINE))
|
||||
Network.connect('port_fs_closed', _on_port_changed.bind(Color.CRIMSON))
|
||||
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)
|
||||
|
||||
self.add_child(timer_modul_um)
|
||||
timer_modul_um.connect('timeout', Callable(self, '_on_timer_modul_um'))
|
||||
|
||||
|
||||
|
||||
func add_signs_scene():
|
||||
@@ -255,8 +267,6 @@ func add_signs_scene():
|
||||
node_select_fs_1.get_node2(1, 3).placeholder_text = 'в dB'
|
||||
node_select_fs_1.get_node2(1, 3).editable = true
|
||||
node_select_fs_1.set_node_text(0, 4, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_1+5]) # 'Модуляция'
|
||||
node_select_fs_1.get_node2(1, 4).add_item('Const')
|
||||
node_select_fs_1.get_node2(1, 4).add_item('MSK')
|
||||
node_select_fs_1.set_node_text(0, 5, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_1+6]) # 'Генератор ФС'
|
||||
node_select_fs_1.set_node_text(0, 6, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_1+7]) # 'СИ 2 от ФС'
|
||||
node_select_fs_1.set_node_text(0, 7, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_1+8]) # 'Фильтр CAN'
|
||||
@@ -275,8 +285,6 @@ func add_signs_scene():
|
||||
node_select_fs_2.get_node2(1, 3).placeholder_text = 'в dB'
|
||||
node_select_fs_2.get_node2(1, 3).editable = true
|
||||
node_select_fs_2.set_node_text(0, 4, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_2+5]) # 'Модуляция'
|
||||
node_select_fs_2.get_node2(1, 4).add_item('Const')
|
||||
node_select_fs_2.get_node2(1, 4).add_item('MSK')
|
||||
node_select_fs_2.set_node_text(0, 5, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_2+6]) # 'Генератор ФС'
|
||||
node_select_fs_2.set_node_text(0, 6, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_2+7]) # 'СИ 3 от ФС'
|
||||
node_select_fs_2.set_node_text(0, 7, Constants.SIGNS[Constants.CURRENT_MODE][item_place_fs_2+8]) # 'Фильтр CAN'
|
||||
@@ -285,6 +293,13 @@ func add_signs_scene():
|
||||
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
|
||||
node_select_yau_07b_2.get_node2(1, 4).clear()
|
||||
if Constants.CURRENT_MODE ==Constants.MODE.PRD_K:
|
||||
for key in Constants.ATT_DICT_correct:
|
||||
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
|
||||
else:
|
||||
for key in Constants.ATT_DICT:
|
||||
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
|
||||
|
||||
|
||||
func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
@@ -311,19 +326,23 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
|
||||
$TabContainer/EMS_G/load_boadr/win_load.material.set('shader_parameter/dot_color_end', Color(0.8, 0.5, 1.0, 1.0 - 0.05 * len(Constants.EMS_G_PORT_DATA_HOLDER)))
|
||||
|
||||
if isa_data.has(Constants.BASE_PORTS.UG+6):
|
||||
if (isa_data[Constants.BASE_PORTS.UG+6] & 0x7) < 7:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+6] & 0x7)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+6] & 0x38)>> 3)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+6] & 0x7))
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+6] & 0x38))
|
||||
if isa_data.has(Constants.BASE_PORTS.UG+8):
|
||||
if isa_data.has(Constants.BASE_PORTS.UG+0x6):
|
||||
if (isa_data[Constants.BASE_PORTS.UG+0x6] & 0x7) < 7:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+0x6] & 0x7)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+0x6] & 0x38)>> 3)
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+0x6] & 0x7))
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+0x6] & 0x38))
|
||||
if isa_data.has(Constants.BASE_PORTS.UG+0x8):
|
||||
if (isa_data[Constants.BASE_PORTS.UG+8] & 0x7) < 7:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+8] & 0x7)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+8] & 0x38)>>3)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+8] & 0x7))
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+8] & 0x38))
|
||||
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+0x8] & 0x7)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+0x8] & 0x38)>>3)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+0x8] & 0x7))
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+0x8] & 0x38))
|
||||
if isa_data.has(Constants.BASE_PORTS.UG+0xA):
|
||||
if (isa_data[Constants.BASE_PORTS.UG+0xA] & 0x7) < 8:
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * ((isa_data[Constants.BASE_PORTS.UG+0xA] & 0x7) * (isa_data[Constants.BASE_PORTS.UG+0xA] & 0x7)) )
|
||||
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1, 4).select(isa_data[Constants.BASE_PORTS.UG+0xA])
|
||||
|
||||
for index in Constants.EMS_G_PORT_DATA_HOLDER.size():
|
||||
var tmp_device_mode = Constants.EMS_G_PORT_DATA_HOLDER[index][0]
|
||||
if tmp_device_mode == Constants.META.CI_2_B_UF:
|
||||
@@ -334,6 +353,11 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
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
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_1:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
var select = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 if data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 < 3 else 3
|
||||
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1,2).select(select)
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_2:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
@@ -403,13 +427,13 @@ func _on_data_fs_2(fs_2_data):
|
||||
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)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 5).get_child(1).button_pressed = true
|
||||
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)
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 5).get_child(1).button_pressed = false
|
||||
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')
|
||||
@@ -418,6 +442,38 @@ func _on_data_fs_2(fs_2_data):
|
||||
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_3_5_7/PSK2/ray_2.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_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_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:
|
||||
# FS 1
|
||||
var node_freq_fs_1 = node_select_fs_1.get_node2(1, 2)
|
||||
@@ -586,9 +642,11 @@ func on_mode_select(intem_from_sector: int) -> void:
|
||||
Constants.CURRENT_MODE = meta[2]
|
||||
add_signs_scene()
|
||||
Network.on_command_change_device(meta)
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.UG+6])
|
||||
_on_start_fs_1()
|
||||
_on_start_fs_2()
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+0xA])
|
||||
Network.start_work_fs()
|
||||
Network.start_work_fs_2()
|
||||
if meta[2] == Constants.MODE.PRD_K:
|
||||
Network.start_work_fs_3()
|
||||
|
||||
|
||||
func _on_zapret_1(toggled_on: bool) -> void:
|
||||
@@ -612,9 +670,6 @@ func _on_zapret_3(toggled_on: bool) -> void:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode)
|
||||
|
||||
|
||||
var current_meta: Array = [0, 0, 0]
|
||||
var modul_um: Array = [0, 0, 0]
|
||||
|
||||
func _on_modul_um(item_from_ray_1: int, node: Node):
|
||||
var modul_um_values = {
|
||||
1: 0x2000,
|
||||
@@ -641,16 +696,24 @@ func _on_modul_um(item_from_ray_1: int, node: Node):
|
||||
if modul_um.has(0x8000):
|
||||
timer_modul_um.wait_time = 2.3
|
||||
timer_modul_um.start()
|
||||
else:
|
||||
timer_modul_um.stop()
|
||||
|
||||
|
||||
|
||||
## Таймер для модуляции УМ
|
||||
func _on_timer_modul_um():
|
||||
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])
|
||||
print('Модуляция вызывается')
|
||||
if modul_um.has(0x8000):
|
||||
for i in range(3):
|
||||
if modul_um[i] == 0x8000:
|
||||
print('Модуляция есть ', modul_um)
|
||||
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()
|
||||
|
||||
|
||||
## Включение/отключение сигнала ФГОЗ
|
||||
@@ -711,17 +774,12 @@ func _on_attenuator_2(item_from_att_1: int) -> void:
|
||||
|
||||
## Регулировка аттенюатора луча 3
|
||||
func _on_attenuator_3(item_from_att_1: int) -> void:
|
||||
print('test')
|
||||
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+8):
|
||||
var mask = 0x38
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_att_1 << 3, mask))
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+8])
|
||||
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+0xA):
|
||||
var mask = 0x7
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0xA, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+0xA], item_from_att_1, mask))
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+0xA])
|
||||
else:
|
||||
print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x8))
|
||||
|
||||
|
||||
func _on_read_isa_pressed() -> void:
|
||||
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+2, Constants.BASE_PORTS.EMS_G+4, Constants.BASE_PORTS.EMS_G+8])
|
||||
print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0xA))
|
||||
|
||||
|
||||
## Устанавливает биты в соответствии с маской
|
||||
@@ -732,16 +790,19 @@ func set_bits(v, a, m):
|
||||
return (~m) & v | a & m
|
||||
|
||||
|
||||
## 1 ФС
|
||||
func _on_port_changed_fs_1(port_name: String, color: Color) -> void:
|
||||
$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
|
||||
|
||||
|
||||
func _on_start_fs_1():
|
||||
Network.start_work_fs()
|
||||
|
||||
## ФС 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
|
||||
|
||||
# Установка формы сигнала (модуляция константа или msk)
|
||||
func _on_modul_fs_1(modulation_select_1) -> void:
|
||||
if modulation_select_1 == 0:
|
||||
Network.set_configure_gen_const_1()
|
||||
@@ -749,6 +810,7 @@ func _on_modul_fs_1(modulation_select_1) -> void:
|
||||
Network.set_configure_gen_msk_1()
|
||||
|
||||
|
||||
# Установка и получение статуса генератора фс
|
||||
func _on_get_status_1(toggled_btn):
|
||||
if $Background/switch_panel/select_prd.button_pressed or $Background/switch_panel/texture_prd.button_pressed:
|
||||
var inverted_state = not toggled_btn
|
||||
@@ -787,17 +849,8 @@ func _on_status_can_macro_1(toggled_btn: bool):
|
||||
|
||||
|
||||
## 2 ФС
|
||||
func _on_port_changed_fs_2(port_name: String, color: Color) -> void:
|
||||
$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
|
||||
|
||||
|
||||
func _on_start_fs_2():
|
||||
Network.start_work_fs_2()
|
||||
|
||||
|
||||
func _on_get_status_2(toggled_btn):
|
||||
if $Background/switch_panel/select_prd.button_pressed:
|
||||
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()
|
||||
@@ -839,6 +892,50 @@ func _on_modul_fs_2(modulation_select_2) -> void:
|
||||
Network.set_configure_gen_msk_2()
|
||||
|
||||
|
||||
## ФС 3
|
||||
func _on_get_status_3(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_3(inverted_state)
|
||||
Network.get_gen_state_3()
|
||||
|
||||
|
||||
func _on_set_ferq_3(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_3(freq_int)
|
||||
|
||||
|
||||
func _on_set_att_3(att: String):
|
||||
Network.set_fs_attenuation_3(float(att))
|
||||
|
||||
|
||||
func _on_set_base_can_macro_3(can_freq: String):
|
||||
Network.set_can_macro_3(int(can_freq))
|
||||
|
||||
|
||||
func _on_status_can_macro_3(toggled_btn: bool):
|
||||
Network.status_can_macro_3(toggled_btn)
|
||||
|
||||
|
||||
func _on_modul_fs_3(modulation_select_3) -> void:
|
||||
if modulation_select_3 == 0:
|
||||
Network.set_configure_gen_const_3()
|
||||
elif modulation_select_3 == 1:
|
||||
Network.set_configure_gen_msk_3()
|
||||
|
||||
|
||||
## Switch panel
|
||||
func _on_prd_select() -> void:
|
||||
emit_signal('read_ems_g_start')
|
||||
@@ -869,16 +966,17 @@ func _on_burger_button(toggled_on: bool) -> void:
|
||||
var pos_on_txt: int = 15
|
||||
var temp = txt_grp
|
||||
var tmp_pos = pos_on_txt
|
||||
|
||||
var pos_off: int = -300
|
||||
|
||||
var panel = $Background/switch_panel
|
||||
if toggled_on:
|
||||
tween.tween_property($Background/switch_panel/burgerButton/block, "global_position", Vector2(180, $Background/switch_panel/burgerButton/block.global_position.y), 0.1).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
|
||||
temp = select_grp
|
||||
|
||||
else:
|
||||
tween.tween_property($Background/switch_panel/burgerButton/block, "global_position", Vector2(10, $Background/switch_panel/burgerButton/block.global_position.y), 0.1).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
|
||||
|
||||
for btn in temp:
|
||||
tween.tween_property(btn, "global_position", Vector2(pos_off, btn.global_position.y), 0.1).set_trans(Tween.TRANS_QUINT).set_ease(Tween.EASE_OUT)
|
||||
|
||||
var panel = $Background/switch_panel
|
||||
|
||||
if toggled_on:
|
||||
# Анимация вправо
|
||||
tween.tween_property(panel, "global_position", Vector2(-170, panel.global_position.y), 0.3).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
|
||||
@@ -886,15 +984,13 @@ func _on_burger_button(toggled_on: bool) -> void:
|
||||
# Анимация влево
|
||||
tween.tween_property(panel, "global_position", Vector2(0, panel.global_position.y), 0.3).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
|
||||
|
||||
if toggled_on:
|
||||
temp = txt_grp
|
||||
tmp_pos = pos_on_txt
|
||||
else:
|
||||
temp = select_grp
|
||||
tmp_pos = pos_on_select
|
||||
temp = txt_grp if toggled_on else select_grp
|
||||
tmp_pos = pos_on_txt if toggled_on else pos_on_select
|
||||
|
||||
for btn in temp:
|
||||
tween.tween_property(btn, "global_position", Vector2(tmp_pos, btn.global_position.y), 0.1).set_trans(Tween.TRANS_QUINT).set_ease(Tween.EASE_OUT)
|
||||
|
||||
tween.tween_property($Background/switch_panel/burgerButton/block, "global_position", Vector2(-90, $Background/switch_panel/burgerButton/block.global_position.y), 0.1).set_trans(Tween.TRANS_LINEAR).set_ease(Tween.EASE_OUT)
|
||||
|
||||
|
||||
func set_tab_and_buttons(tab_index: int, button_name: String, txt_button_name: String) -> void:
|
||||
@@ -905,3 +1001,7 @@ func set_tab_and_buttons(tab_index: int, button_name: String, txt_button_name: S
|
||||
if button is Button or TextureButton:
|
||||
if button.name != 'burgerButton':
|
||||
button.button_pressed = (button.name == button_name or button.name == txt_button_name)
|
||||
|
||||
|
||||
func _on_connect_prd_pressed() -> void:
|
||||
on_mode_select($TabContainer/PRD/select_dev.get_node2(1, 0).get_selected_id())
|
||||
|
||||
Reference in New Issue
Block a user