1 litera is almost ready
This commit is contained in:
@@ -113,9 +113,11 @@ class FGOS:
|
||||
packet.resize(packet.size() + 4)
|
||||
packet.encode_u32(packet.size() - 4, crc)
|
||||
if client == Network.client_fs_1:
|
||||
Network.command_stack.append(packet)
|
||||
else:
|
||||
Network.command_stack_1.append(packet)
|
||||
elif client == Network.client_fs_2:
|
||||
Network.command_stack_2.append(packet)
|
||||
elif client == Network.client_fs_3:
|
||||
Network.command_stack_3.append(packet)
|
||||
online = true
|
||||
|
||||
|
||||
|
||||
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())
|
||||
|
||||
@@ -398,6 +398,7 @@ enum META {
|
||||
FGOZ_6 = 55,
|
||||
FGOZ_3 = 56,
|
||||
FGOZ_5 = 56,
|
||||
MODUL_UM_28 = 57,
|
||||
}
|
||||
enum FS_FREQ {
|
||||
f1 = 430,
|
||||
@@ -408,3 +409,32 @@ enum FS_FREQ {
|
||||
f6 = 2750,
|
||||
f7 = 4750,
|
||||
}
|
||||
|
||||
enum FS_ATT {
|
||||
att_1_prd_H1 = 18,
|
||||
att_2_prd_H1 = 19,
|
||||
att_1_prd_H2 = 18,
|
||||
att_2_prd_H2 = 19,
|
||||
att_1_prd_H3 = 18,
|
||||
att_2_prd_H4 = 19,
|
||||
att_1_prd_B1 = 17,
|
||||
att_2_prd_B1 = 16,
|
||||
att_1_prd_B2 = 17,
|
||||
att_2_prd_B2 = 16,
|
||||
att_1_prd_B3 = 17,
|
||||
att_2_prd_B3 = 16,
|
||||
att_1_prd_B4 = 17,
|
||||
att_2_prd_B4 = 16,
|
||||
att_1_prd_K1 = 15,
|
||||
att_2_prd_K1 = 10,
|
||||
att_3_prd_K1 = 5,
|
||||
att_1_prd_K2 = 17,
|
||||
att_2_prd_K2 = 16,
|
||||
att_3_prd_K2 = 19,
|
||||
att_1_prd_K3 = 17,
|
||||
att_2_prd_K3 = 18,
|
||||
att_3_prd_K3 = 19,
|
||||
att_1_prd_K4 = 17,
|
||||
att_2_prd_K4 = 18,
|
||||
att_3_prd_K4 = 19,
|
||||
}
|
||||
|
||||
@@ -16,11 +16,13 @@ var count_packet:int = 0
|
||||
var flag_control_add: bool = false
|
||||
var flag_fs_1_ready: bool = false
|
||||
var flag_fs_2_ready: bool = false
|
||||
var flag_fs_3_ready: bool = false
|
||||
var flag_dkm: bool = false
|
||||
var flag_ug: bool = false
|
||||
var flag_modul_on_1: bool = false
|
||||
var flag_modul_on_2: bool = false
|
||||
var flag_start: bool = false
|
||||
var prep_set_ug: int = 0
|
||||
|
||||
|
||||
class Logger extends Node:
|
||||
@@ -55,13 +57,11 @@ class Logger extends Node:
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Network.connect('port_fs_opened_1', _on_fs_status_1.bind(Constants.STATE_VAL.GOOD))
|
||||
Network.connect('port_fs_closed_1', _on_fs_status_1.bind(Constants.STATE_VAL.ERROR))
|
||||
#Network.connect('port_fs_opened', _on_fs_status.bind(Constants.STATE_VAL.GOOD))
|
||||
#Network.connect('port_fs_closed', _on_fs_status.bind(Constants.STATE_VAL.ERROR))
|
||||
Network.connect('data_from_fs_1', _on_data_fs.bind('ФС-1'))
|
||||
|
||||
Network.connect('port_fs_opened_2', _on_fs_status_2.bind(Constants.STATE_VAL.GOOD))
|
||||
Network.connect('port_fs_closed_2', _on_fs_status_2.bind(Constants.STATE_VAL.ERROR))
|
||||
Network.connect('data_from_fs_2', _on_data_fs.bind('ФС-2'))
|
||||
Network.connect('data_from_fs_3', _on_data_fs.bind('ФС-3'))
|
||||
|
||||
self.add_child(timer)
|
||||
self.add_child(timer_03)
|
||||
@@ -117,6 +117,8 @@ func _ready() -> void:
|
||||
$socket_ym_pb/blok_ym_4,
|
||||
$socket_ym_pb/blok_ym_5,
|
||||
$socket_ym_pb/blok_ym_6,
|
||||
|
||||
$socket_ym_lb/blok_ym_litera_1,
|
||||
]
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
|
||||
@@ -157,11 +159,12 @@ func _draw_control_panel_prd(pribor):
|
||||
$soc_P1/MAA_2.rname = 'А23'
|
||||
# Кассета П-2
|
||||
$soc_P2.visible = false
|
||||
|
||||
# ДКМ
|
||||
$soc_DKM/DKM_1.visible = false
|
||||
$soc_DKM/DKM_2.fname = 'ДКМ-2'
|
||||
$soc_DKM/DKM_3.fname = 'ДКМ-3'
|
||||
# УМ УМ
|
||||
$socket_ym_lb/blok_ym_litera_1.visible = false
|
||||
|
||||
elif pribor == Constants.MODE.PRD_B:
|
||||
# Кассета У5
|
||||
@@ -195,6 +198,8 @@ func _draw_control_panel_prd(pribor):
|
||||
$soc_DKM/DKM_1.visible = false
|
||||
$soc_DKM/DKM_2.fname = 'ДКМ-4'
|
||||
$soc_DKM/DKM_3.fname = 'ДКМ-5'
|
||||
# УМ УМ
|
||||
$socket_ym_lb/blok_ym_litera_1.visible = false
|
||||
|
||||
elif pribor == Constants.MODE.PRD_K:
|
||||
# Кассета У5
|
||||
@@ -232,57 +237,64 @@ func _draw_control_panel_prd(pribor):
|
||||
$soc_DKM/DKM_1.visible = true
|
||||
$soc_DKM/DKM_2.fname = 'ДКМ-6'
|
||||
$soc_DKM/DKM_3.fname = 'ДКМ-7'
|
||||
# УМ УМ
|
||||
$socket_ym_lb/blok_ym_litera_1.visible = true
|
||||
|
||||
|
||||
func _on_fs_status_1(_name_port, status_fs_1: int):
|
||||
$Kasseta_FS/ref_A1.state = status_fs_1
|
||||
#if logger:
|
||||
#var message: String = "Модуль ФС-1: %s" % name_port
|
||||
#logger.info(message)
|
||||
|
||||
|
||||
func _on_fs_status_2(_name_port, status_fs_2):
|
||||
$Kasseta_FS/ref_A2.state = status_fs_2
|
||||
#if logger:
|
||||
#var message: String = "Модуль ФС-2: %s" % name_port
|
||||
#logger.info(message)
|
||||
|
||||
|
||||
func fs_1_setup(freq):
|
||||
await get_tree().create_timer(0.4).timeout
|
||||
func fs_1_setup(freq: int, att: float):
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status(true) ## отключен на true
|
||||
await get_tree().create_timer(0.4).timeout
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_1()
|
||||
Network.status_can_macro_1(false)
|
||||
Network.set_fs_ferq_carrier(freq * 1_000_000)
|
||||
Network.set_fs_attenuation(float(18)) # Для литеры 4
|
||||
Network.set_fs_attenuation(att) # Для литеры 2, 4, 6
|
||||
Network.set_can_macro(freq)
|
||||
Network.status_can_macro_1(true)
|
||||
await get_tree().create_timer(0.4).timeout
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status(false) ## отключен на true
|
||||
await get_tree().create_timer(0.4).timeout
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_1()
|
||||
|
||||
|
||||
func fs_2_setup(freq):
|
||||
await get_tree().create_timer(1.8).timeout
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
func fs_2_setup(freq: int, att: float):
|
||||
await get_tree().create_timer(0.8).timeout
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_2()
|
||||
Network.status_can_macro_2(false)
|
||||
Network.set_fs_ferq_carrier_2(freq * 1_000_000)
|
||||
Network.set_fs_attenuation_2(float(16)) # Для литеры 5
|
||||
Network.set_fs_attenuation_2(float(att)) # Для литеры 3, 5, 7
|
||||
Network.set_can_macro_2(freq)
|
||||
Network.status_can_macro_2(true)
|
||||
await get_tree().create_timer(0.8).timeout
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status_2(false) ## отключен = true
|
||||
await get_tree().create_timer(0.8).timeout
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_2()
|
||||
|
||||
|
||||
func yau_07b_setup():
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+6, 58)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+8, 58)
|
||||
func fs_3_setup(freq: int, att: float):
|
||||
await get_tree().create_timer(1.5).timeout
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_3()
|
||||
Network.status_can_macro_3(false)
|
||||
Network.set_fs_ferq_carrier_3(freq * 1_000_000)
|
||||
Network.set_fs_attenuation_3(float(att)) # Для литеры 1
|
||||
Network.set_can_macro_3(freq)
|
||||
Network.status_can_macro_3(true)
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status_3(false) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_3()
|
||||
|
||||
|
||||
func yau_07b_setup(angle_and_att: int):
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0x6, angle_and_att)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0x8, angle_and_att)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+0xA, (angle_and_att & 0x38)>>3)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_1)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13) ## Отключить модуляцию (литера 1)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_2)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13) ## Отключить модуляцию (литера 2)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
@@ -303,12 +315,22 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_data.decode_u32(0xC) == 0:
|
||||
logger.info('✅ Состояние генератора %s: Включен' % fs_name)
|
||||
if fs_name == 'ФС-1':
|
||||
logger.info('✅ Состояние генератора %s: Включен' % fs_name)
|
||||
$Kasseta_FS/ref_A1.state = Constants.STATE_VAL.GOOD
|
||||
elif fs_name == 'ФС-2':
|
||||
logger.info('✅ Состояние генератора %s: Включен' % fs_name)
|
||||
$Kasseta_FS/ref_A2.state = Constants.STATE_VAL.GOOD
|
||||
elif fs_name == 'ФС-3':
|
||||
logger.info('✅ Состояние генератора %s: Включен' % fs_name)
|
||||
$Kasseta_FS/FS_PRD_K.state = Constants.STATE_VAL.GOOD
|
||||
else:
|
||||
if fs_name == 'ФС-1':
|
||||
flag_fs_1_ready = false
|
||||
if fs_name == 'ФС-2':
|
||||
flag_fs_2_ready = false
|
||||
if fs_name == 'ФС-3':
|
||||
flag_fs_3_ready = false
|
||||
logger.info('🛈 Состояние генератора %s: Отключен' % fs_name)
|
||||
Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
@@ -316,18 +338,18 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
|
||||
|
||||
|
||||
func _on_yau_received(status_yau):
|
||||
#print(Network.unit.status.decode_u8(Constants.DataIndices.DKM))
|
||||
if flag_control_add:
|
||||
# Сбор урожая с УКП-1
|
||||
var arr_power_ukp_1: Array = []
|
||||
for i in range(6): ## Мощность от УКП_1
|
||||
var numbre_scrape: int = 7 if Constants.CURRENT_MODE == Constants.MODE.PRD_K else 6
|
||||
for i in range(numbre_scrape): ## Мощность от УКП_1
|
||||
var power_ukp_1 = status_yau.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
|
||||
arr_power_ukp_1.append(power_ukp_1)
|
||||
|
||||
if count_packet == 0:
|
||||
array_pow_1 = arr_power_ukp_1
|
||||
else:
|
||||
for i in range(6):
|
||||
for i in range(numbre_scrape):
|
||||
if arr_power_ukp_1[i] > array_pow_1[i]:
|
||||
array_pow_1[i] = arr_power_ukp_1[i]
|
||||
# Сбор урожая с УКП-2
|
||||
@@ -349,7 +371,7 @@ func _on_yau_feedback_receive(_status_yau):
|
||||
if logger:
|
||||
## Флаг для проверки настройки угла и аттенюации на двух литерах
|
||||
if Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+6) and Network.unit.isa_ports.has(Constants.BASE_PORTS.UG+8):
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.UG+6] == 58 and Network.unit.isa_ports[Constants.BASE_PORTS.UG+8] == 58:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.UG+6] == prep_set_ug and Network.unit.isa_ports[Constants.BASE_PORTS.UG+8] == prep_set_ug:
|
||||
flag_ug = true
|
||||
else:
|
||||
flag_ug = false
|
||||
@@ -361,27 +383,68 @@ func _on_yau_feedback_receive(_status_yau):
|
||||
logger.info('✅ Модуляция УМ (2, 4, 6) включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_1):
|
||||
flag_modul_on_1 = false
|
||||
logger.info('❌ Модуляция УМ (2, 4, 6) отключена!')
|
||||
logger.info('🛈 Модуляция УМ (2, 4, 6) отключена!')
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_3:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000 and (not flag_modul_on_2):
|
||||
flag_modul_on_2 = true
|
||||
logger.info('✅ Модуляция УМ (3, 5, 7) включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and (flag_modul_on_2):
|
||||
flag_modul_on_2 = false
|
||||
logger.info('❌ Модуляция УМ (3, 5, 7) отключена!')
|
||||
logger.info('🛈 Модуляция УМ (3, 5, 7) отключена!')
|
||||
|
||||
|
||||
func _on_start_super_control():
|
||||
$log_array/await.visible = true
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
|
||||
if (past_pribor != Constants.CURRENT_MODE):
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
|
||||
for i in count_cell:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
flag_dkm = false
|
||||
flag_ug = false
|
||||
#timer.start(5)
|
||||
for node in um_cell_ind:
|
||||
node.value0 = 0
|
||||
node.value1 = 0
|
||||
node.state = Constants.STATE_VAL.NONE
|
||||
|
||||
if (past_pribor != Constants.CURRENT_MODE):
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
## Temperature for
|
||||
for i_temperature in range(6): ## Температура от УКП
|
||||
if len(Network.unit.status) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * i_temperature:
|
||||
var temperature_ukp_1 = Network.unit.status.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i_temperature)
|
||||
var temperature_ukp_2 = Network.unit.status.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * i_temperature)
|
||||
var TMP_1 = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP + 3
|
||||
var TMP_2 = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP + 3
|
||||
if TMP_1 > 70:
|
||||
um_cell_ind[i_temperature].value0 = TMP_1
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
#timer.start(5)
|
||||
return
|
||||
else:
|
||||
um_cell_ind[i_temperature].value0 = TMP_1
|
||||
if TMP_2 > 70:
|
||||
um_cell_ind[i_temperature+6].value0 = TMP_2
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
#timer.start(5)
|
||||
return
|
||||
else:
|
||||
um_cell_ind[i_temperature+6].value0 = TMP_2
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
if len(Network.unit.status) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * 7:
|
||||
var temperature_litera_1 = Network.unit.status.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * 7)
|
||||
var TEMPERATURE = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_litera_1) * Constants.TEMP + 3
|
||||
if TEMPERATURE > 70:
|
||||
um_cell_ind[12].value0 = TEMPERATURE
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
#timer.start(5)
|
||||
return
|
||||
else:
|
||||
um_cell_ind[12].value0 = TEMPERATURE
|
||||
|
||||
if (Network.unit.online):
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.GOOD
|
||||
logger.info("✅ ЯУ-07Б: Есть связь")
|
||||
@@ -397,16 +460,30 @@ func _on_start_super_control():
|
||||
$log_array/await.visible = false
|
||||
|
||||
if Network.unit_fs.online:
|
||||
var fs_freq: Array = [0, 0, 0]
|
||||
var fs_freq: Array
|
||||
var fs_att_1: float
|
||||
var fs_att_2: float
|
||||
var fs_att_3: float
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
|
||||
fs_freq[0] = Constants.FS_FREQ.f2
|
||||
fs_freq[1] = Constants.FS_FREQ.f3
|
||||
fs_freq.append(Constants.FS_FREQ.f2)
|
||||
fs_att_1 = Constants.FS_ATT.att_1_prd_K1
|
||||
fs_freq.append(Constants.FS_FREQ.f3)
|
||||
fs_att_2 = Constants.FS_ATT.att_1_prd_K1
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
fs_freq[0] = Constants.FS_FREQ.f4
|
||||
fs_freq[1] = Constants.FS_FREQ.f5
|
||||
logger.info('Настройка модулей ФС %s Гц' % str(fs_freq))
|
||||
fs_1_setup(fs_freq[0]) # Гц
|
||||
fs_2_setup(fs_freq[1]) # Гц
|
||||
fs_freq.append(Constants.FS_FREQ.f4)
|
||||
fs_freq.append(Constants.FS_FREQ.f5)
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
fs_freq.append(Constants.FS_FREQ.f6)
|
||||
fs_att_1 = Constants.FS_ATT.att_1_prd_K1
|
||||
fs_freq.append(Constants.FS_FREQ.f7)
|
||||
fs_att_2 = Constants.FS_ATT.att_2_prd_K1
|
||||
fs_freq.append(Constants.FS_FREQ.f1)
|
||||
fs_att_3 = Constants.FS_ATT.att_3_prd_K1
|
||||
fs_3_setup(fs_freq[2], fs_att_3)
|
||||
logger.info('🛈 Настройка модулей ФС %s Гц, %s, %s АТТ' % [str(fs_freq), str(fs_att_1), str(fs_att_2)])
|
||||
fs_1_setup(fs_freq[0], fs_att_1) # Гц
|
||||
fs_2_setup(fs_freq[1], fs_att_2) # Гц
|
||||
|
||||
else:
|
||||
logger.info('❌ Настройка модулей ФС')
|
||||
|
||||
@@ -440,42 +517,47 @@ func _status_cell(status):
|
||||
logger.error("❌ %s : Нет связи" % node_cell_ind[i_node].get('fname'))
|
||||
|
||||
if node_cell_ind[3].state == Constants.STATE_VAL.GOOD:
|
||||
yau_07b_setup()
|
||||
logger.info('%s: Настройка угла и аттенюации ...' % node_cell_ind[3].get('fname'))
|
||||
var mask: int = 0x7
|
||||
prep_set_ug = 0
|
||||
var index_ray: int = Constants.RAY_DICT.find(' 25°')
|
||||
var index_att: int = Constants.ATT_DICT.find(' 10.5 dB')
|
||||
## Регулировка положением луча 1
|
||||
prep_set_ug = set_bits(prep_set_ug, index_ray, mask)
|
||||
## Регулировка положением луча 2
|
||||
mask = 0x38
|
||||
prep_set_ug = set_bits(prep_set_ug, index_att << 3, mask)
|
||||
|
||||
logger.info('🛈 %s: Настройка угла %s' % [node_cell_ind[2].get('fname'), Constants.RAY_DICT[index_ray]])
|
||||
logger.info('🛈 %s: Настройка аттенюации %s' % [node_cell_ind[2].get('fname'), Constants.ATT_DICT[index_att]])
|
||||
yau_07b_setup(prep_set_ug)
|
||||
else:
|
||||
logger.error('❌ %s: Нет на связи, не буду продолжать' % node_cell_ind[3].get('fname'))
|
||||
logger.error('❌ %s: Нет на связи, не буду продолжать' % node_cell_ind[2].get('fname'))
|
||||
|
||||
else:
|
||||
for i_node_unknow in range(5, 13):
|
||||
node_cell_ind[i_node_unknow].state = Constants.STATE_VAL.NONE
|
||||
|
||||
|
||||
func _on_timer():
|
||||
if (Network.unit.online):
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
logger.info("✅ ЯУ-07Б: Есть связь")
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.GOOD
|
||||
_status_cell(Network.unit.status)
|
||||
else:
|
||||
for i in range(1, count_cell-9):
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR
|
||||
logger.error("❌ ЯУ-07Б: Нет связи")
|
||||
## Устанавливает биты в соответствии с маской
|
||||
## [param v] - Прежние значения бит
|
||||
## [param a] - Новые значения бит
|
||||
## [param m] - Маска изменяемых бит
|
||||
func set_bits(v, a, m):
|
||||
return (~m) & v | a & m
|
||||
|
||||
if (Network.unit_fs.online):
|
||||
logger.info('Настройка модулей ФС Гц:')
|
||||
fs_1_setup(Constants.FS_FREQ.f2) # Гц
|
||||
fs_2_setup(Constants.FS_FREQ.f3) # Гц
|
||||
else:
|
||||
logger.error('❌ Настройка модулей ФС')
|
||||
|
||||
func _on_timer():
|
||||
_on_start_super_control()
|
||||
|
||||
|
||||
func _on_fs_status(META:int):
|
||||
if logger:
|
||||
if META == Constants.META.CI_2_OT_FS or META == Constants.META.CI_4_OT_FS:
|
||||
if META == Constants.META.CI_2_OT_FS or META == Constants.META.CI_4_OT_FS or META == Constants.META.CI_6_OT_FS:
|
||||
flag_fs_1_ready = true
|
||||
elif META == Constants.META.CI_3_OT_FS or META == Constants.META.CI_5_OT_FS:
|
||||
elif META == Constants.META.CI_3_OT_FS or META == Constants.META.CI_5_OT_FS or META == Constants.META.CI_7_OT_FS:
|
||||
flag_fs_2_ready = true
|
||||
elif META == Constants.META.CI_1_OT_FS:
|
||||
flag_fs_3_ready = true
|
||||
|
||||
if flag_fs_1_ready and flag_fs_2_ready:
|
||||
#dkm
|
||||
@@ -487,32 +569,48 @@ func _on_fs_status(META:int):
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
if (dkm >> 1) & 0x1 == 1:
|
||||
logger.info('%s: %s ✅' % [$Kasseta_FS/ref_A3.fname, 'Включено'])
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('%s: %s ❌' % [$Kasseta_FS/ref_A3.fname, 'Нет связи'])
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи'])
|
||||
if (dkm >> 2) & 0x1 == 1:
|
||||
logger.info('%s: %s ✅' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('%s: %s ❌' % [$Kasseta_FS/ref_A4.fname, 'Нет связи'])
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Нет связи'])
|
||||
|
||||
if (dkm >> 1) & 0x1 == 1 and (dkm >> 2) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
else:
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
|
||||
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
if (dkm >> 3) & 0x1 == 1:
|
||||
logger.info('%s: %s ✅' % [$Kasseta_FS/ref_A3.fname, 'Включено'])
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('%s: %s ❌' % [$Kasseta_FS/ref_A3.fname, 'Нет связи'])
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи'])
|
||||
if (dkm >> 4) & 0x1 == 1:
|
||||
logger.info('%s: %s ✅' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('%s: %s ❌' % [$Kasseta_FS/ref_A4.fname, 'Нет связи'])
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Нет связи'])
|
||||
|
||||
if (dkm >> 3) & 0x1 == 1 and (dkm >> 4) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
else:
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
|
||||
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
|
||||
@@ -520,6 +618,30 @@ func _on_fs_status(META:int):
|
||||
$Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state
|
||||
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
|
||||
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
|
||||
if (dkm >> 0) & 0x1 == 1:
|
||||
print('OK')
|
||||
else:
|
||||
print('FAIL: ', dkm)
|
||||
if (dkm >> 5) & 0x1 == 1:
|
||||
logger.info('✅ %s: %s ' % [$Kasseta_FS/ref_A3.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A3.fname, 'Нет связи'])
|
||||
if (dkm >> 6) & 0x1 == 1:
|
||||
logger.info('✅ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('❌ %s: %s' % [$Kasseta_FS/ref_A4.fname, 'Нет связи'])
|
||||
|
||||
if (dkm >> 5) & 0x1 == 1 and (dkm >> 6) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
else:
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
Network.get_gen_state_3()
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
|
||||
|
||||
func _on_modul_um():
|
||||
@@ -548,6 +670,14 @@ func _on_timer_03():
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
Network.set_fs_gen_status(true) ## отключен = true
|
||||
Network.get_gen_state_1()
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
Network.get_gen_state_2()
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
Network.get_gen_state_3()
|
||||
|
||||
flag_control_add = false
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
logger.info('Количество принятых пакетов от ЯУ-07Б: %s пкт.' % count_packet)
|
||||
@@ -574,27 +704,40 @@ func _status_prd():
|
||||
|
||||
var pribor_ispraven: bool = false
|
||||
var min_dopusk: int = 40
|
||||
if (status == count_cell-7):
|
||||
var status_need = count_cell-7 if Constants.CURRENT_MODE != Constants.MODE.PRD_K else count_cell-4
|
||||
|
||||
if (status == status_need):
|
||||
pribor_ispraven = true
|
||||
var count_um: int = 0
|
||||
for i_pow in array_pow_1:
|
||||
|
||||
var count_um: int = 0
|
||||
for i_pow in array_pow_1:
|
||||
if count_um == 6:
|
||||
um_cell_ind[count_um+6].value1 = i_pow
|
||||
if i_pow < min_dopusk:
|
||||
pribor_ispraven = false
|
||||
um_cell_ind[count_um+6].state = Constants.STATE_VAL.ERROR
|
||||
else:
|
||||
um_cell_ind[count_um+6].state = Constants.STATE_VAL.GOOD
|
||||
count_um -=1
|
||||
else:
|
||||
um_cell_ind[count_um].value1 = i_pow
|
||||
if i_pow < min_dopusk:
|
||||
pribor_ispraven = false
|
||||
um_cell_ind[count_um].state = Constants.STATE_VAL.ERROR
|
||||
else:
|
||||
um_cell_ind[count_um].state = Constants.STATE_VAL.GOOD
|
||||
count_um += 1
|
||||
|
||||
for i_pow in array_pow_2:
|
||||
um_cell_ind[count_um].value1 = i_pow
|
||||
if i_pow < min_dopusk:
|
||||
pribor_ispraven = false
|
||||
um_cell_ind[count_um].state = Constants.STATE_VAL.ERROR
|
||||
else:
|
||||
um_cell_ind[count_um].state = Constants.STATE_VAL.GOOD
|
||||
count_um += 1
|
||||
|
||||
count_um += 1
|
||||
|
||||
|
||||
for i_pow in array_pow_2:
|
||||
um_cell_ind[count_um].value1 = i_pow
|
||||
if i_pow < min_dopusk:
|
||||
pribor_ispraven = false
|
||||
um_cell_ind[count_um].state = Constants.STATE_VAL.ERROR
|
||||
else:
|
||||
um_cell_ind[count_um].state = Constants.STATE_VAL.GOOD
|
||||
count_um += 1
|
||||
|
||||
if pribor_ispraven:
|
||||
$lbl_control.text = 'Прибор %s исправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0]
|
||||
$lbl_control.modulate = Color.AQUAMARINE
|
||||
|
||||
@@ -6,6 +6,7 @@ var shift: int = 2
|
||||
var button_link_meta: Dictionary = {}
|
||||
var status_fs_1
|
||||
var status_fs_2
|
||||
var status_fs_3
|
||||
|
||||
|
||||
func _on_read_ems_g():
|
||||
@@ -190,21 +191,21 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
|
||||
if i == 8: # СИ_1_от_ФС
|
||||
var CI_1_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(2).get_child(0).get_node2(1, 6).get_child(1)
|
||||
set_frame(CI_1_FS, frame_type)
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_7_OT_FS)
|
||||
status_fs_2 = frame_type
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_1_OT_FS)
|
||||
status_fs_1 = frame_type
|
||||
if i == 13: # СИ_6_от_ФС
|
||||
var CI_6_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_6_FS, frame_type)
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_1 != Constants.Frame.CONSTANT:
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_6_OT_FS)
|
||||
status_fs_1 = frame_type
|
||||
status_fs_2 = frame_type
|
||||
if i == 14: # СИ_7_от_ФС
|
||||
var CI_7_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1)
|
||||
set_frame(CI_7_FS, frame_type)
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT:
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_3 != Constants.Frame.CONSTANT:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_7_OT_FS)
|
||||
status_fs_2 = frame_type
|
||||
status_fs_3 = frame_type
|
||||
|
||||
|
||||
func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
@@ -260,7 +261,14 @@ func on_mode_link(mode, list):
|
||||
|
||||
## Формирование команды для отправкы команды на устройство
|
||||
address_port_wr = Constants.BASE_PORTS.EMS_G+8
|
||||
var set_mode = 0x0000 if mode == 0 else 0x2000 if mode == 1 else 0x4000 if mode == 2 else 0x8000
|
||||
var set_mode: int = 0x0000 if mode == 0 else 0x2000 if mode == 1 else 0x4000 if mode == 2 else 0x8000
|
||||
var node_prd: Node = get_parent().get_parent()
|
||||
for i_meta in 3:
|
||||
if meta == node_prd.current_meta[i_meta]:
|
||||
node_prd.modul_um[i_meta] = set_mode
|
||||
if node_prd.modul_um.has(0x8000):
|
||||
node_prd.timer_modul_um.wait_time = 2.3
|
||||
node_prd.timer_modul_um.start()
|
||||
Network.write_port_isa(address_port_wr, set_mode)
|
||||
|
||||
|
||||
|
||||
@@ -18,8 +18,8 @@ var send_array: Array = []
|
||||
var client_fs_1: StreamPeer
|
||||
var ip_fs_1: String = Constants.ADDRESSES[0][4]
|
||||
var peerstream_fs_1: PacketPeer
|
||||
var state_fs = Constants.STATE.IDLE
|
||||
var command_stack: Array
|
||||
var state_fs_1 = Constants.STATE.IDLE
|
||||
var command_stack_1: Array
|
||||
var counter_fs_1: int = 0
|
||||
|
||||
## 2 ФС
|
||||
@@ -30,6 +30,14 @@ var state_fs_2 = Constants.STATE.IDLE
|
||||
var command_stack_2: Array
|
||||
var counter_fs_2: int = 0
|
||||
|
||||
## 3 ФС
|
||||
var client_fs_3: StreamPeer
|
||||
var ip_fs_3: String = Constants.ADDRESSES[0][5]
|
||||
var peerstream_fs_3: PacketPeer
|
||||
var state_fs_3 = Constants.STATE.IDLE
|
||||
var command_stack_3: Array
|
||||
var counter_fs_3: int = 0
|
||||
|
||||
# Яу-07б
|
||||
signal yau_status_line(_status) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
signal yau_receive(_data_from_yau)
|
||||
@@ -38,10 +46,9 @@ signal yau_read_isa(_unit_isa_ports)
|
||||
# ФС модуль
|
||||
signal data_from_fs_1(data:PackedByteArray)
|
||||
signal data_from_fs_2(data:PackedByteArray)
|
||||
signal port_fs_opened_1(port_name: String)
|
||||
signal port_fs_opened_2(port_name: String)
|
||||
signal port_fs_closed_1(port_name: String)
|
||||
signal port_fs_closed_2(port_name: String)
|
||||
signal data_from_fs_3(data:PackedByteArray)
|
||||
signal port_fs_opened(port_name: String)
|
||||
signal port_fs_closed(port_name: String)
|
||||
signal port_error(error_str: String)
|
||||
|
||||
|
||||
@@ -79,27 +86,37 @@ func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: Strin
|
||||
if not peer:
|
||||
emit_signal("port_error", ip_fs)
|
||||
return
|
||||
# Проверяем состояние подключения
|
||||
|
||||
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
|
||||
if client == client_fs_1:
|
||||
emit_signal("port_fs_closed_1", ip_fs)
|
||||
elif client == client_fs_2:
|
||||
emit_signal("port_fs_closed_2", ip_fs)
|
||||
emit_signal("port_fs_closed", ip_fs)
|
||||
return
|
||||
|
||||
if peer.get_available_bytes() > 0:
|
||||
# Проверяем состояние подключения
|
||||
#if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
|
||||
#if client == client_fs_1:
|
||||
#emit_signal("port_fs_closed", ip_fs)
|
||||
#elif client == client_fs_2:
|
||||
#emit_signal("port_fs_closed", ip_fs)
|
||||
#elif client == client_fs_3:
|
||||
#emit_signal("port_fs_closed", ip_fs)
|
||||
#return
|
||||
while peer.get_available_bytes() > 0:
|
||||
var rx_data: PackedByteArray
|
||||
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
|
||||
if client == client_fs_1:
|
||||
emit_signal("data_from_fs_1", rx_data)
|
||||
emit_signal("port_fs_opened_1", ip_fs)
|
||||
if state_fs == Constants.STATE.SEND:
|
||||
state_fs = Constants.STATE.DONE
|
||||
emit_signal("port_fs_opened", ip_fs)
|
||||
if state_fs_1 == Constants.STATE.SEND:
|
||||
state_fs_1 = Constants.STATE.DONE
|
||||
elif client == client_fs_2:
|
||||
emit_signal("data_from_fs_2", rx_data)
|
||||
emit_signal("port_fs_opened_2", ip_fs)
|
||||
emit_signal("port_fs_opened", ip_fs)
|
||||
if state_fs_2 == Constants.STATE.SEND:
|
||||
state_fs_2 = Constants.STATE.DONE
|
||||
elif client == client_fs_3:
|
||||
emit_signal("data_from_fs_3", rx_data)
|
||||
emit_signal("port_fs_opened", ip_fs)
|
||||
if state_fs_3 == Constants.STATE.SEND:
|
||||
state_fs_3 = Constants.STATE.DONE
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
@@ -116,7 +133,11 @@ func _ready() -> void:
|
||||
|
||||
unit.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
unit.connect('command_fail', Callable(self, 'on_command_fail'))
|
||||
|
||||
set_config()
|
||||
|
||||
|
||||
|
||||
func set_config():
|
||||
write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CI_2_B_UF)
|
||||
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
|
||||
write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CI_3_B_UF)
|
||||
@@ -128,9 +149,11 @@ func _ready() -> void:
|
||||
write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.FGOZ_3)
|
||||
read_port_isa([Constants.BASE_PORTS.EMS_G+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+8])
|
||||
connect_fs_1()
|
||||
start_work_fs()
|
||||
connect_fs_2()
|
||||
connect_fs_3()
|
||||
start_work_fs()
|
||||
start_work_fs_2()
|
||||
start_work_fs_3()
|
||||
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
@@ -144,6 +167,9 @@ func _process(delta: float) -> void:
|
||||
if client_fs_2:
|
||||
poll_receive_fs(client_fs_2, peerstream_fs_2, ip_fs_2)
|
||||
state_machine_fs(client_fs_2)
|
||||
if client_fs_3:
|
||||
poll_receive_fs(client_fs_3, peerstream_fs_3, ip_fs_3)
|
||||
state_machine_fs(client_fs_3)
|
||||
|
||||
poll_receive_yau07(soc_brodcast)
|
||||
poll_receive_yau07(soc_unicast)
|
||||
@@ -207,33 +233,41 @@ func on_command_change_device(meta_device):
|
||||
ip_port_yau = meta_device[1]
|
||||
ip_fs_1 = meta_device[3]
|
||||
ip_fs_2 = meta_device[4]
|
||||
#ip_fs_3 = meta_device[5]
|
||||
ip_fs_3 = meta_device[5]
|
||||
connect_fs_1()
|
||||
connect_fs_2()
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
connect_fs_3()
|
||||
|
||||
|
||||
func state_machine_fs(client_fs):
|
||||
## State fs machine
|
||||
if client_fs == client_fs_1:
|
||||
if (state_fs == Constants.STATE.IDLE) or (state_fs == Constants.STATE.DONE):
|
||||
if command_stack:
|
||||
var pack: Array = command_stack.pop_front()
|
||||
if (state_fs_1 == Constants.STATE.IDLE) or (state_fs_1 == Constants.STATE.DONE):
|
||||
if command_stack_1:
|
||||
var pack: Array = command_stack_1.pop_front()
|
||||
unit_fs.send_fs_data(pack, client_fs_1, peerstream_fs_1)
|
||||
state_fs = Constants.STATE.SEND
|
||||
state_fs_1 = Constants.STATE.SEND
|
||||
if client_fs == client_fs_2:
|
||||
if (state_fs_2 == Constants.STATE.IDLE) or (state_fs_2 == Constants.STATE.DONE):
|
||||
if command_stack_2:
|
||||
var pack: Array = command_stack_2.pop_front()
|
||||
unit_fs.send_fs_data(pack, client_fs_2, peerstream_fs_2)
|
||||
state_fs_2 = Constants.STATE.SEND
|
||||
if client_fs == client_fs_3:
|
||||
if (state_fs_3 == Constants.STATE.IDLE) or (state_fs_3 == Constants.STATE.DONE):
|
||||
if command_stack_3:
|
||||
var pack: Array = command_stack_3.pop_front()
|
||||
unit_fs.send_fs_data(pack, client_fs_3, peerstream_fs_3)
|
||||
state_fs_3 = Constants.STATE.SEND
|
||||
|
||||
|
||||
# Подключится к модулю ФС
|
||||
func connect_fs_1():
|
||||
if client_fs_1:
|
||||
unit_fs.disconnect_fs(client_fs_1)
|
||||
state_fs = Constants.STATE.IDLE
|
||||
command_stack = []
|
||||
state_fs_1 = Constants.STATE.IDLE
|
||||
command_stack_1 = []
|
||||
|
||||
client_fs_1 = StreamPeerTCP.new()
|
||||
peerstream_fs_1 = PacketPeerStream.new()
|
||||
@@ -254,6 +288,15 @@ func start_work_fs():
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_gen_state(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
var set_freq = Constants.FS_FREQ.f2 if Constants.CURRENT_MODE == Constants.MODE.PRD_H else Constants.FS_FREQ.f4 if Constants.CURRENT_MODE == Constants.MODE.PRD_B else Constants.FS_FREQ.f6
|
||||
unit_fs.set_carrier(set_freq * 1_000_000, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.set_att_batch(Constants.FS_ATT.att_1_prd_H1, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.set_base_can_macro(set_freq, counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
unit_fs.get_att_batch(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
unit_fs.get_carrier(counter_fs_1, client_fs_1)
|
||||
@@ -272,8 +315,8 @@ func set_fs_gen_status(state_gen):
|
||||
func get_gen_state_1():
|
||||
unit_fs.get_gen_state(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
#unit_fs.get_base_current_temp(counter_fs_1, client_fs_1)
|
||||
#counter_fs_1 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_1, client_fs_1)
|
||||
counter_fs_1 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier(freq: int):
|
||||
@@ -348,6 +391,15 @@ func start_work_fs_2():
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_gen_state(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
var set_freq = Constants.FS_FREQ.f3 if Constants.CURRENT_MODE == Constants.MODE.PRD_H else Constants.FS_FREQ.f5 if Constants.CURRENT_MODE == Constants.MODE.PRD_B else Constants.FS_FREQ.f7
|
||||
unit_fs.set_carrier(set_freq * 1_000_000, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.set_att_batch(Constants.FS_ATT.att_2_prd_H1, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.set_base_can_macro(set_freq, counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
unit_fs.get_att_batch(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
unit_fs.get_carrier(counter_fs_2, client_fs_2)
|
||||
@@ -366,8 +418,8 @@ func set_fs_gen_status_2(state_gen: bool):
|
||||
func get_gen_state_2():
|
||||
unit_fs.get_gen_state(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
#unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
#counter_fs_2 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier_2(freq: int):
|
||||
@@ -416,3 +468,108 @@ func set_configure_gen_msk_2():
|
||||
func set_configure_gen_const_2():
|
||||
unit_fs.set_configure_state_msk_const_1(counter_fs_2, client_fs_2)
|
||||
counter_fs_2 += 1
|
||||
|
||||
|
||||
## 3 ФС коннект
|
||||
func connect_fs_3():
|
||||
if client_fs_3:
|
||||
unit_fs.disconnect_fs(client_fs_3)
|
||||
state_fs_3 = Constants.STATE.IDLE
|
||||
command_stack_3 = []
|
||||
|
||||
client_fs_3 = StreamPeerTCP.new()
|
||||
peerstream_fs_3 = PacketPeerStream.new()
|
||||
var rc = client_fs_3.connect_to_host(ip_fs_3, Constants.PORT_FS)
|
||||
if rc!= Error.OK:
|
||||
emit_signal("port_error", ip_fs_3)
|
||||
else:
|
||||
peerstream_fs_3.set_stream_peer(client_fs_3)
|
||||
|
||||
|
||||
func start_work_fs_3():
|
||||
counter_fs_3 = 0
|
||||
unit_fs.start_session(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_gen_state(false, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_gen_state(true, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_gen_state(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
var set_freq = Constants.FS_FREQ.f1
|
||||
unit_fs.set_carrier(set_freq * 1_000_000, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_att_batch(Constants.FS_ATT.att_3_prd_K1, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_base_can_macro(set_freq, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
unit_fs.get_att_batch(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_carrier(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func set_fs_gen_status_3(state_gen: bool):
|
||||
unit_fs.set_gen_state(state_gen, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func get_gen_state_3():
|
||||
unit_fs.get_gen_state(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func set_fs_ferq_carrier_3(freq: int):
|
||||
unit_fs.set_carrier(freq, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_carrier(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
func set_fs_attenuation_3(attenuation: float):
|
||||
unit_fs.set_att_batch(attenuation, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_att_batch(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка CAN частоты для подстройки фильтра ФС
|
||||
func set_can_macro_3(can_frequency: int):
|
||||
unit_fs.set_base_can_macro(can_frequency, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_current_temp(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.get_base_can_macro(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка CAN статуса(вкл/откл) для подстройки фильтра ФС
|
||||
func status_can_macro_3(state_can: bool):
|
||||
unit_fs.status_can_macro_exec(state_can, counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка модуляции msk на генератор ФС
|
||||
func set_configure_gen_msk_3():
|
||||
unit_fs.set_configure_state_msk_modul_3(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
unit_fs.set_configure_state_msk_modul_3(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
|
||||
## Установка модуляции const на генератор ФС
|
||||
func set_configure_gen_const_3():
|
||||
unit_fs.set_configure_state_msk_const_1(counter_fs_3, client_fs_3)
|
||||
counter_fs_3 += 1
|
||||
|
||||
Reference in New Issue
Block a user