Merge remote-tracking branch 'origin/dev_maxim' into temp_dev

# Conflicts:
#	PRD_MP550.tscn
#	scripts/PRD.gd
#	scripts/constants.gd
#	scripts/control_panel.gd
This commit is contained in:
danil_tim
2025-02-07 11:09:29 +03:00
20 changed files with 558 additions and 384 deletions

View File

@@ -129,31 +129,6 @@ class FGOS:
i += 1
emit_signal('data_received', self)
#var GRP = data.decode_u8(0x0)
#var CMD = data.decode_u8(0x1)
#match CMD:
#Constants.CMD.READ_CARRIER:
#if GRP == Constants.GROUP.BASE:
#$manage_panel/get_freq/freq_ind.text = str(data.decode_u64(0xC)) + ' Гц'
#Constants.CMD.READ_ATT:
#if GRP == Constants.GROUP.RF:
#$manage_panel/get_att/att_ind.text = '-' + str(data.decode_float(0x18)) + ' dB'
#Constants.CMD.READ_GEN_STATUS:
#if GRP == Constants.GROUP.GENERATOR:
#if data.decode_u32(0xC) == 0:
#$manage_panel/get_gen_status/status_ind.text = 'Включен'
#$manage_panel/get_gen_status/status_ind.modulate = Color.GREEN
#else:
#$manage_panel/get_gen_status/status_ind.text = 'Выключен'
#$manage_panel/get_gen_status/status_ind.modulate = Color.RED
#Constants.CMD.BASE_GET_CURRENT_TEMP:
#if GRP == Constants.GROUP.BASE:
#$temp_1.text = '%.2f' % data.decode_float(0xC) + ' °C'
#$temp_2.text = str(data.decode_float(0x10)) + ' °C'
#$temp_3.text = str(data.decode_float(0x14)) + ' °C'
#$read.text = str(data.hex_encode())
func start_session():
counter = 0

View File

@@ -2,16 +2,32 @@ extends Node2D
signal read_ems_g_start()
signal read_ems_g_finish()
var unit_fs_1 = Fs.FGOS.new()
var flag_mode = Constants.ADDRESSES[0][3]
var broadcast_packet: PackedByteArray
var node_select1: Node
var node_select2: Node
var flag_yau_control: bool
var CONTROL_TABLE: Array
var isa_from_yau07b: Dictionary = {}
var JSOON = JSON.new()
var status_pribor = null
var save_path = "D://PRD-TU-MP550//"
var need_port: Array = [
0x122,
0x124,
0x126,
0x128,
0x12A
]
func _ready() -> void:
# Считывание аргументов с консоли (путь сохранения)
var args = OS.get_cmdline_user_args()
for i in range(args.size()):
if args[i] == "testsave-path" and i + 1 < args.size():
save_path = args[i + 1]
break
# Таблица УКП_1
node_select1 = $TabContainer/PRD/body_grid/litera_2_4_6/table_ukp_1
draw_tabl(node_select1, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
@@ -21,11 +37,67 @@ func _ready() -> void:
# Таблица УКП_2
node_select2 = $TabContainer/PRD/body_grid/litera_3_5_7/table_ukp_2
draw_tabl(node_select2, Constants.ROWS_UKP2_DATA, Constants.ROWS_UKP2_DATA.size())
draw_tabl(node_select2, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
node_select2.set_columns_min_size([120, 120])
node_select2.set_node_text(0, 0, 'Мощность')
node_select2.set_node_text(1, 0, 'Температура')
# Таблица ЯУ-07б
var node_select_yau_07b = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control
draw_tabl(node_select_yau_07b, Constants.ROWS_YAU_07B_1, Constants.ROWS_YAU_07B_1.size())
node_select_yau_07b.set_columns_min_size([160, 120])
node_select_yau_07b.set_node_text(0, 0, 'ПРД-Н')
node_select_yau_07b.set_node_text(1, 0, 'Литера 2')
node_select_yau_07b.set_node_text(0, 1, 'Запрет СИ 2')
node_select_yau_07b.set_node_text(0, 2, 'Модуляция УМ 2')
node_select_yau_07b.set_node_text(0, 3, 'Положение луча')
node_select_yau_07b.set_node_text(0, 4, 'Аттенюатор')
node_select_yau_07b.set_node_text(0, 6, 'СИ 2 в УФ')
var 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])
node_select_yau_07b_2.set_node_text(0, 0, 'ПРД-Н')
node_select_yau_07b_2.set_node_text(1, 0, 'Литера 3')
node_select_yau_07b_2.set_node_text(0, 1, 'Запрет СИ 3')
node_select_yau_07b_2.set_node_text(0, 2, 'Модуляция УМ 3')
node_select_yau_07b_2.set_node_text(0, 3, 'Положение луча')
node_select_yau_07b_2.set_node_text(0, 4, 'Аттенюатор')
node_select_yau_07b_2.set_node_text(0, 5, 'ФГОЗ 3')
node_select_yau_07b_2.set_node_text(0, 6, 'СИ 3 в УФ')
#Таблица ФС
var 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([120, 120, 150])
node_select_fs_1.set_node_text(0, 0, 'Модуль ФС')
node_select_fs_1.set_node_text(1, 0, 'Литера 2')
node_select_fs_1.set_node_text(0, 1, 'Состояние')
node_select_fs_1.set_node_text(0, 2, 'Частота')
node_select_fs_1.get_node2(1, 2).placeholder_text = 'в МГц'
node_select_fs_1.get_node2(1, 2).editable = true
node_select_fs_1.set_node_text(0, 3, 'Аттенюатор')
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, 'Генератор')
node_select_fs_1.set_node_text(0, 5, 'fpga')
node_select_fs_1.set_node_text(0, 6, 'СИ 2 от ФС')
var 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([120, 120, 150])
node_select_fs_2.set_node_text(0, 0, 'Модуль ФС')
node_select_fs_2.set_node_text(1, 0, 'Литера 3')
node_select_fs_2.set_node_text(0, 1, 'Состояние')
node_select_fs_2.set_node_text(0, 2, 'Частота')
#node_select_fs_2.get_node2(1, 2).placeholder_text = '500'
node_select_fs_2.set_node_text(0, 3, 'Аттенюатор')
#node_select_fs_2.get_node2(1, 3).placeholder_text = '38.7'
#node_select_fs_2.get_node2(1, 3).d = true
node_select_fs_2.set_node_text(0, 4, 'Генератор')
node_select_fs_2.set_node_text(0, 5, 'fpga')
node_select_fs_2.set_node_text(0, 6, 'СИ 3 от ФС')
# Выбор прибора для подключения
var node_select_device = $TabContainer/PRD/select_dev
draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size())
@@ -39,20 +111,45 @@ func _ready() -> void:
node_select_device.get_node2(0,0).text = 'ПРИБОР'
node_select_device.set_columns_min_size([100, 100])
# Получаем имя выбранного прибора
if Constants.ADDRESSES.size() > 0:
get_select_device.select(0)
status_pribor = get_select_device.get_item_text(0).strip_edges().substr(4)
## Заполненение списка модуляции УМ
for key in Constants.OUT_x128:
node_select_yau_07b.get_node2(1, 2).add_item(key)
node_select_yau_07b_2.get_node2(1, 2).add_item(key)
## Заполненение списка направления луча
for key in Constants.RAY_DICT:
$TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Ray_set_1.add_item(key)
$TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/Ray_set_2.add_item(key)
node_select_yau_07b.get_node2(1, 3).add_item(key)
node_select_yau_07b_2.get_node2(1, 3).add_item(key)
## Заполненение списка аттенюатора
for key in Constants.ATT_DICT:
$TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/att_set_1.add_item(key)
$TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/att_set_2.add_item(key)
node_select_yau_07b.get_node2(1, 4).add_item(key)
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
draw_control_panel_prd(Constants.ADDRESSES[0][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('data_from_fs_1', Callable(self, '_on_data_fs_1'))
node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret1'))
node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_1'))
node_select_yau_07b.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_1'))
node_select_yau_07b.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_1'))
node_select_yau_07b_2.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret2'))
node_select_yau_07b_2.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_2'))
node_select_yau_07b_2.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_2'))
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'))
node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_1'))
func draw_control_panel_prd(pribor) -> void:
@@ -177,8 +274,59 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
if isa_data.has(Constants.BASE_PORTS.UG+6):
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[0x106] & 0x7))
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[0x106] & 0x38))
if isa_data.has(Constants.BASE_PORTS.UG+8):
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[0x108] & 0x7))
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[0x108] & 0x38))
func _on_data_fs_1(fs_1_data):
var node_select_fs_1 = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control
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:
node_select_fs_1.set_node_text(2, 2, str(fs_1_data.decode_u64(0xC)) + ' Гц')
Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF:
node_select_fs_1.set_node_text(2, 3, '-' + str(fs_1_data.decode_float(0x18)) + ' dB')
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, 4, 'Включен')
node_select_fs_1.get_node2(2, 4).modulate = Color.AQUAMARINE
else:
node_select_fs_1.set_node_text(2, 4, 'Выключен')
node_select_fs_1.get_node2(2, 4).modulate = Color.CRIMSON
Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE:
node_select_fs_1.set_node_text(1, 5, '%.2f' % fs_1_data.decode_float(0xC) + ' °C')
#$read.text = str(fs_1_data.hex_encode())
func _on_data_fs_2(fs_2_data):
var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
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:
node_select_fs_2.set_node_text(2, 2, str(fs_2_data.decode_u64(0xC)) + ' Гц')
Constants.CMD.READ_ATT:
if GRP == Constants.GROUP.RF:
node_select_fs_2.set_node_text(2, 3, '-' + str(fs_2_data.decode_float(0x18)) + ' 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, 4, 'Включен')
node_select_fs_2.get_node2(2, 4).modulate = Color.AQUAMARINE
else:
node_select_fs_2.set_node_text(2, 4, 'Выключен')
node_select_fs_2.get_node2(2, 4).modulate = Color.CRIMSON
Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE:
node_select_fs_2.set_node_text(1, 5, '%.2f' % fs_2_data.decode_float(0xC) + ' °C')
## Рисует таблицу
@@ -200,28 +348,28 @@ func _on_data_received(data_from_yau_07):
var _DKM: int = data_from_yau_07.decode_u16(Constants.DataIndices.DKM) # ДКМ от УГ
#node_select1.set_node_text(2, 0, '%d' % dry_contact)
#node_select1.set_node_text(3, 0, '%d' % DKM)
## УКП
for i in range(8): ## Мощность от УКП_1
for i in range(6): ## Мощность от УКП_1
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
node_select1.set_node_text(0, i+1, '%d' % power_ukp_1)
for i in range(8): ## Температура от УКП_1
for i in range(6): ## Температура от УКП_1
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i)
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP
node_select1.set_node_text(1, i+1, '%d' % TMP)
node_select1.set_node_text(1, i+1, '%d °С' % TMP)
for i_pow in range(8): ## Мощность от УКП_2
for i_pow in range(6): ## Мощность от УКП_2
if len(data_from_yau_07) > Constants.DataIndices.POWER_UKP_2 + 2 * i_pow:
var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i_pow)
node_select2.set_node_text(0, i_pow+1, '%d' % power_ukp_2)
for row in range(8): ## Температура от УКП_2
for row in range(6): ## Температура от УКП_2
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row:
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row)
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP
node_select2.set_node_text(1, row+1, '%d' % TMP)
node_select2.set_node_text(1, row+1, '%d °С' % TMP)
func set_frame(node: Node, val: int): node.set_frame(val)
@@ -245,18 +393,93 @@ func _on_mfs_select() -> void:
func _on_save_config():
print('Тебе сюда')
var da = DirAccess.open(save_path)
var base_path = save_path + "save//"
if da == null:
return
else:
da.dir_exists(base_path)
da.make_dir_recursive(base_path)
var file_dialog = FileDialog.new()
file_dialog.title = "Сохранить файл как"
file_dialog.set_size(Vector2(600, 400))
file_dialog.mode = FileDialog.FILE_MODE_SAVE_FILE
file_dialog.current_dir = base_path
file_dialog.set_current_file("ЭМС-Г" + "-" + status_pribor)
file_dialog.connect("file_selected", Callable(self, "_save_selected_file"))
add_child(file_dialog)
file_dialog.popup_centered()
func _save_selected_file(file_path: String):
var data = Constants.EMS_G_PORT_DATA_HOLDER
var param_ems_g: Dictionary = {}
var other_data: Dictionary = {}
# Формируем словари
for item in data:
var regist: Dictionary = {}
regist[0x122] = item[0]
for key in item[1]:
if key in need_port:
regist[key] = item[1][key]
else:
other_data[key] = item[1]
param_ems_g[item[0]] = regist
# Переменные для сохранения
var ems_g_file = file_path
var other_name = "others" + "-" + status_pribor
var other_path = save_path + other_name
var other_names = other_name
var other_counter = 1
var dir = DirAccess.open(file_path.get_base_dir())
# Сохранение данных ЭМС-Г
var file = FileAccess.open(ems_g_file, FileAccess.WRITE)
if file != null:
file.store_string(JSON.stringify(param_ems_g))
file.close()
# Сохранение данных других
var save_other = $save_other.is_pressed()
if save_other:
while dir.file_exists(other_names):
other_names = other_name + "_" + str(other_counter)
other_path = save_path + other_names
other_counter += 1
var other_file = FileAccess.open(other_path, FileAccess.WRITE)
if other_file != null:
other_file.store_string(JSON.stringify(other_data))
other_file.close()
func _on_file_selected(file_path: String):
var file = FileAccess.open(file_path, FileAccess.READ)
# Проверка на открытие/чтение файла
if file != OK:
return
var file_content = file.get_as_text()
file.close()
var json = JSON.new()
var data = json.parse(file_content)
# Проверка на разбор содержимого файла
if data.error != OK:
return
Constants.EMS_G_PORT_DATA_HOLDER = data.result
func _on_load_config():
print('тебе сюда')
var file_dialog = FileDialog.new()
var base_path = save_path + "save//"
file_dialog.set_title("Выберите файл")
file_dialog.set_size(Vector2(600, 400))
file_dialog.access = FileDialog.ACCESS_FILESYSTEM
file_dialog.current_dir = base_path
add_child(file_dialog)
file_dialog.popup_centered()
func set_tab_and_buttons(tab_index: int, button_name: String) -> void:
$TabContainer.current_tab = tab_index
var side_panel = $Background/side_panel
for button in side_panel.get_children():
if button is Button:
button.button_pressed = (button.name == button_name)
@@ -267,6 +490,9 @@ func on_btn_select(intem_from_sector: int) -> void:
var get_select_device = node_select_device.get_node2(1, 0)
var meta = get_select_device.get_item_metadata(intem_from_sector)
Network.on_command_change_device(meta)
flag_mode = meta[2]
draw_control_panel_prd(flag_mode)
_on_start_fs_1()
Constants.CURRENT_MODE = meta[2]
draw_control_panel_prd(Constants.CURRENT_MODE)
@@ -281,51 +507,57 @@ func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: i
func _on_zapret1(toggled_on: bool) -> void:
var meta = $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Zapret.get_meta('dev_num')
var meta = 48
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
var zapret_mode = 0x4000 if toggled_on else 0x0
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode)
func _on_zapret2(toggled_on: bool) -> void:
var meta = $TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/Zapret2.get_meta('dev_num')
var meta = 49
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
var zapret_mode = 0x4000 if toggled_on else 0x0
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode)
func _on_modul_um_1(toggled_on: bool):
var meta = $TabContainer/PRD/body_grid/litera_2_4_6/yau_07b/Modul_um_1.get_meta('dev_num')
func _on_modul_um_1(item_from_ray_1: int):
var meta = 51
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
var modul_um = 0x2000 if toggled_on else 0x0
var modul_um_values = {
1: 0x2000,
2: 0x4000,
3: 0x8000
}
var modul_um = modul_um_values.get(item_from_ray_1, 0)
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
func _on_modul_um_2(toggled_on: bool):
var meta = $TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/Modul_um_2.get_meta('dev_num')
func _on_modul_um_2(item_from_ray_1: int):
var meta = 52
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
var modul_um = 0x2000 if toggled_on else 0x0
var modul_um_values = {
1: 0x2000,
2: 0x4000,
3: 0x8000,
}
var modul_um = modul_um_values.get(item_from_ray_1, 0)
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
## Включение/отключение сигнала ФГОЗ
func _on_fgos_2(toggled_on: bool):
var meta = $TabContainer/PRD/body_grid/litera_3_5_7/yau_07b/fgos_2.get_meta('dev_num')
var meta = 56
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
var modul_um = 0x2000 if toggled_on else 0x0
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
#func _on_fgos_2(toggled_on: bool):
#var meta = $TabContainer/PRD/Grid/Modul_um_2.get_meta('dev_num')
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
#var modul_um = 0x2000 if toggled_on else 0x0
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
## Регулировка положением луча 1
func _on_btn_ray_1(item_from_ray_1: int) -> void:
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+6):
Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_ray_1, 7))
var mask = 0x7
Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_ray_1, mask))
Network.read_port_isa([Constants.BASE_PORTS.UG+6])
else:
print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x6))
@@ -334,26 +566,33 @@ func _on_btn_ray_1(item_from_ray_1: int) -> void:
## Регулировка положением луча 2
func _on_btn_ray_2(item_from_ray_2: int) -> void:
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+8):
Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_ray_2, 7))
var mask = 0x7
Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_ray_2, mask))
Network.read_port_isa([Constants.BASE_PORTS.UG+8])
else:
print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x8))
## Регулировка аттенюатора луча 1
func _on_attenuator_1(item_from_att_1: int) -> void:
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+6):
Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_att_1 << 3, 0x38))
var mask = 0x38
Network.write_port_isa(Constants.BASE_PORTS.UG+6, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+6], item_from_att_1 << 3, mask))
Network.read_port_isa([Constants.BASE_PORTS.UG+6])
else:
print_debug('В ISA отсутствует данные в \"%x\" порту' % (Constants.BASE_PORTS.UG+0x6))
## Регулировка аттенюатора луча 2
func _on_attenuator_2(item_from_att_1: int) -> void:
if isa_from_yau07b.has(Constants.BASE_PORTS.UG+8):
Network.write_port_isa(Constants.BASE_PORTS.UG+8, set_bits(isa_from_yau07b[Constants.BASE_PORTS.UG+8], item_from_att_1 << 3, 0x38))
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])
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])
@@ -364,3 +603,24 @@ func _on_read_isa_pressed() -> void:
## [param m] - Маска изменяемых бит
func set_bits(v, a, m):
return (~m) & v | a & m
func _on_start_fs_1():
unit_fs_1.start_session()
unit_fs_1.base_get_current_temp()
func _on_get_status_1(toggled_btn):
var inverted_state = not toggled_btn
unit_fs_1.set_gen_state(inverted_state)
unit_fs_1.get_gen_state()
func _on_set_ferq():
var freq = int($set_space/write_to_set_freq.get_text()) * 1_000_000
unit_fs_1.set_carrier(freq)
func _on_set_att():
var att = float($set_space/write_to_set_att.get_text())
unit_fs_1.set_att_batch(att)

View File

@@ -12,32 +12,45 @@ const TableNode = preload("res://table/node.tscn")
const TableList = preload("res://table/node_list.tscn")
const Switch = preload("res://table/switch.tscn")
const SocketStatus = preload("res://table/socket_status.tscn")
const Header = preload("res://table/header.tscn")
const SELECT_DEVICE: Array = [[TableNode, TableList]]
const ROWS_REGS_DATA: Array = [
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[Header, Header],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode]]
const ROWS_UKP2_DATA: Array = [
const ROWS_YAU_07B_1: Array = [
[Header, Header],
[TableNode, Switch],
[TableNode, TableList],
[TableNode, TableList],
[TableNode, TableList],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode],
[TableNode, TableNode]]
[TableNode, SocketStatus]]
const ROWS_YAU_07B_2: Array = [
[Header, Header],
[TableNode, Switch],
[TableNode, TableList],
[TableNode, TableList],
[TableNode, TableList],
[TableNode, Switch],
[TableNode, SocketStatus]]
const ROWS_FS: Array = [
[Header, Header, Header],
[TableNode, TableNode, TableNode],
[TableNode, TableNode, TableNode],
[TableNode, TableNode, TableNode],
[TableNode, Switch, TableNode],
[TableNode, TableNode, TableNode],
[TableNode, SocketStatus, TableNode]]
const ADDRESSES: Array = [
['ПРД-Н1', '10.1.1.11', 50011, MODE.PRD_H, '10.1.2.18', '10.1.2.19', ''],
['ПРД-Н2', '10.1.1.21', 50021, MODE.PRD_H, '10.1.2.34', '10.1.2.35', ''],
['ПРД-Н3', '10.1.1.31', 50031, MODE.PRD_H, '10.1.2.50', '10.1.2.51', ''],
['ПРД-Н4', '10.1.1.41', 50041, MODE.PRD_H, '10.1.2.67', '10.1.2.67', ''],
['ПРД-Н4', '10.1.1.41', 50041, MODE.PRD_H, '10.1.2.66', '10.1.2.67', ''],
['ПРД-В1', '10.1.1.12', 50012, MODE.PRD_B, '10.1.2.20', '10.1.2.21', ''],
['ПРД-В2', '10.1.1.22', 50022, MODE.PRD_B, '10.1.2.36', '10.1.2.37', ''],
['ПРД-В3', '10.1.1.32', 50032, MODE.PRD_B, '10.1.2.52', '10.1.2.53', ''],
@@ -86,7 +99,7 @@ const OUT_EMS_G: Array = [
const OUT_x128: Array = [
'Р',
'К',
'0',
'Откл.',
'1',]
const RAY_DICT: Array = [
' Контроль',
@@ -96,24 +109,23 @@ const RAY_DICT: Array = [
' 25°',
' 35°',
' 45°',
' Контроль',
]
const ATT_DICT: Array = [
' 0 db',
' 0.5 db',
' 2 db',
' 2.5 db',
' 8 db',
' 8.5 db',
' 10 db',
' 10.5 db',
' 0 dB',
' 0.5 dB',
' 2 dB',
' 2.5 dB',
' 8 dB',
' 8.5 dB',
' 10 dB',
' 10.5 dB',
]
const SIGNS_PRD: Array = [
## ПРК-К
[
' Запрет СИ6',
' Запрет СИ7',
' Запрет СИ1',
'ЛИТЕРА 6! ПРД-К',
'ЛИТЕРА 7! ПРД-К',
'СЗИ6 от УФ',
'СЗИ7 от УФ',
@@ -129,9 +141,7 @@ const SIGNS_PRD: Array = [
'МАА №2',
'ИП9-50 №1',
'ИП9-50 №2',
'ИП12-50 №1',
'ИП9-50 №3',
'ИП12-50 №2',
'ИП5-25',
],
## ПРК-В
@@ -139,7 +149,6 @@ const SIGNS_PRD: Array = [
' Запрет СИ4',
' Запрет СИ5',
'',
'ЛИТЕРА 4! ПРД-В',
'ЛИТЕРА 5! ПРД-В',
'СЗИ4 от УФ',
'СЗИ5 от УФ',
@@ -155,21 +164,15 @@ const SIGNS_PRD: Array = [
'МАА №2',
'ИП9-50 №1',
'ИП9-50 №2',
'ИП12-50 №1',
'-',
'-',
'ИП5-25',
],
## ПРД-Н
[
' Запрет СИ2',
' Запрет СИ3',
'',
'ЛИТЕРА 2! ПРД-Н',
'ЛИТЕРА 3! ПРД-Н',
'СЗИ2 от УФ',
'СЗИ3 от УФ',
'СИ2 от ФС',
'СИ3 от ФС',
'СИ2 в УФ',
'СИ3 в УФ',
@@ -181,10 +184,10 @@ const SIGNS_PRD: Array = [
'МАА №2',
'ИП9-50 №1',
'ИП9-50 №2',
'ИП12-50 №1',
'-',
'-',
'ИП5-25',
'--',
],
]

View File

@@ -139,10 +139,16 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
if i == 1:
set_frame(get_specific_node(parent_node2, 1), frame_type)
var CI_2_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 6).get_child(1)
set_frame(CI_2_UF, frame_type)
if i == 2:
set_frame(get_specific_node(parent_node2, 2), frame_type)
var CI_3_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 6).get_child(1)
set_frame(CI_3_UF, frame_type)
if i == 9:
set_frame(get_specific_node(parent_node2, 3), frame_type)
var CI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_2_FS, frame_type)
if i == 10:
set_frame(get_specific_node(parent_node2, 4), frame_type)
@@ -151,17 +157,9 @@ func get_specific_node(parent_node2: Node, child_index: int)-> Node:
return parent_node2.get_child(3, false).get_child(1).get_child(4).get_child(child_index).get_child(3)
func _process(_delta: float) -> void:
pass
func set_frame(node: Node, val: int): node.set_frame(val)
func set_init():
pass
## Создает связь между кнопками
func create_link_button(node, count_rows_sart: int, count_rows_end: int, coln_start: int, coln_end: int):
## META_EMS_G[[Номер входа, Номер выхода]]

View File

@@ -15,7 +15,7 @@ func _process(_delta: float) -> void:
func _enter_tree() -> void:
# Подключаем сигналы к методам
Network.connect('data_send', _on_data_send)
Network.connect('data_received', _on_data_received)
Network.connect('data_from_fs_1', _on_data_received)
Network.connect('port_opened', _on_port_changed.bind(Color.GREEN))
Network.connect('port_closed', _on_port_changed.bind(Color.GRAY))
Network.connect('port_error', _on_port_changed.bind(Color.RED))
@@ -56,7 +56,6 @@ func _on_data_received(data: PackedByteArray):
$read.text = str(data.hex_encode())
func _on_send_pressed() -> void:
unit_fs.get_carrier()

View File

@@ -18,19 +18,21 @@ var ip_fs_1: String = Constants.ADDRESSES[0][4]
var command_stack: Array
var state_fs = Constants.STATE.IDLE
var client_fs_1: StreamPeer
var peerstream: PacketPeer
var peerstream_fs_1: PacketPeer
signal yau_status_line(_status) ## Вызывается когда меняется состояние связи с ячейкой
signal yau_receive(_data_from_yau)
signal yau_read_isa(_unit_isa_ports)
signal data_send()
signal data_received(data:PackedByteArray)
signal data_from_fs_1(data:PackedByteArray)
signal port_opened(port_name: String)
signal port_closed(port_name: String)
signal port_error(error_str: String)
## Класс для отправки данных в сокет
class Socket extends PacketPeerUDP:
func send_to(addr: String, port: int, data: PackedByteArray):
@@ -58,7 +60,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
func poll_receive_fs(client: StreamPeerTCP):
client.poll()
var peer = peerstream.get_stream_peer()
var peer = peerstream_fs_1.get_stream_peer()
# Проверяем, существует ли соединение
if not peer:
emit_signal("port_error", ip_fs_1)
@@ -71,7 +73,7 @@ func poll_receive_fs(client: StreamPeerTCP):
if peer.get_available_bytes() > 0:
var rx_data: PackedByteArray
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
emit_signal("data_received", rx_data)
emit_signal("data_from_fs_1", rx_data)
emit_signal("port_opened", ip_fs_1)
if state_fs == Constants.STATE.SEND:
state_fs = Constants.STATE.DONE
@@ -185,18 +187,18 @@ func connect_fs():
disconnect_fs(client_fs_1)
client_fs_1 = StreamPeerTCP.new()
peerstream = PacketPeerStream.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.set_stream_peer(client_fs_1)
peerstream_fs_1.set_stream_peer(client_fs_1)
# Отправить команду для ФС
func send_data(data_to_sand: PackedByteArray):
if client_fs_1.get_status() == 2:
var peer = peerstream.get_stream_peer()
var peer = peerstream_fs_1.get_stream_peer()
if peer:
peer.put_data(data_to_sand)
emit_signal("data_send")
@@ -207,4 +209,3 @@ func disconnect_fs(client_for_leave):
client_for_leave.disconnect_from_host()
state_fs = Constants.STATE.IDLE
command_stack = []