настройка мимикрии
This commit is contained in:
@@ -798,12 +798,11 @@ metadata/_edit_lock_ = true
|
||||
|
||||
[node name="log_array" type="TextEdit" parent="TabContainer/ControlPanel"]
|
||||
layout_mode = 0
|
||||
offset_left = 875.0
|
||||
offset_left = 810.0
|
||||
offset_top = 22.0
|
||||
offset_right = 1515.0
|
||||
offset_right = 1569.0
|
||||
offset_bottom = 664.0
|
||||
placeholder_text = "Ожидание контроля ..."
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="EMS_G" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
|
||||
@@ -9,7 +9,7 @@ custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="bin/testPRD.exe"
|
||||
export_path="bin/testPRD_2.0.exe"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
|
||||
@@ -10,16 +10,14 @@ var node_select_yau_07b_2: Node
|
||||
var node_select_fs_1: Node
|
||||
var node_select_fs_2: Node
|
||||
var isa_from_yau07b: Dictionary = {}
|
||||
var JSOON = JSON.new()
|
||||
var freq_fs_1: int
|
||||
var freq_fs_2: int
|
||||
var att_fs_1: float
|
||||
var att_fs_2: float
|
||||
var status_pribor = null
|
||||
var save_path = "D://PRD-TU-MP550//"
|
||||
var need_port: Array = [
|
||||
0x122,
|
||||
0x124,
|
||||
0x126,
|
||||
0x128,
|
||||
0x12A
|
||||
]
|
||||
const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
# Считывание аргументов с консоли (путь сохранения)
|
||||
@@ -239,25 +237,25 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
|
||||
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 == 48:
|
||||
if tmp_device_mode == Constants.META.CI_2_B_UF:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
|
||||
if tmp_device_mode == 49:
|
||||
if tmp_device_mode == Constants.META.CI_3_B_UF:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
|
||||
if tmp_device_mode == 51:
|
||||
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:
|
||||
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_2_4_6/yau07b_control.get_node2(1,2).select(select)
|
||||
if tmp_device_mode == 52:
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_3:
|
||||
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_3_5_7/yau07b_control.get_node2(1,2).select(select)
|
||||
if tmp_device_mode == 56:
|
||||
if tmp_device_mode == Constants.META.FGOZ_3:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13
|
||||
@@ -269,10 +267,12 @@ func _on_data_fs_1(fs_1_data):
|
||||
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) / 1_000_000) + ' МГц')
|
||||
freq_fs_1 = fs_1_data.decode_u64(0xC) / 1_000_000
|
||||
node_select_fs_1.set_node_text(2, 2, str(freq_fs_1) + ' МГц')
|
||||
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')
|
||||
att_fs_1 = fs_1_data.decode_float(0x18)
|
||||
node_select_fs_1.set_node_text(2, 3, str(att_fs_1) + ' dB')
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_1_data.decode_u32(0xC) == 0:
|
||||
@@ -299,10 +299,12 @@ func _on_data_fs_2(fs_2_data):
|
||||
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) / 1_000_000) + ' МГц')
|
||||
freq_fs_2 = fs_2_data.decode_u64(0xC) / 1_000_000
|
||||
node_select_fs_2.set_node_text(2, 2, str(freq_fs_2) + ' МГц')
|
||||
Constants.CMD.READ_ATT:
|
||||
if GRP == Constants.GROUP.RF:
|
||||
node_select_fs_2.set_node_text(2, 3, str(fs_2_data.decode_float(0x18)) + ' dB')
|
||||
att_fs_2 = fs_2_data.decode_float(0x18)
|
||||
node_select_fs_2.set_node_text(2, 3, str(att_fs_2) + ' dB')
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_2_data.decode_u32(0xC) == 0:
|
||||
@@ -323,6 +325,44 @@ 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 _process(_delta: float) -> void:
|
||||
# FS 1
|
||||
var node_freq_fs_1 = node_select_fs_1.get_node2(1, 2)
|
||||
var node_freq_fs_1_mod = node_select_fs_1.get_node2(0, 2)
|
||||
if (int(node_freq_fs_1.get_text()) != freq_fs_1) and node_freq_fs_1.get_text() != '':
|
||||
node_freq_fs_1_mod.modulate = Color.AQUAMARINE
|
||||
node_freq_fs_1_mod.text = 'Частота*'
|
||||
else:
|
||||
node_freq_fs_1_mod.modulate = Color(1, 1, 0.941, 1)
|
||||
node_freq_fs_1_mod.text = 'Частота'
|
||||
node_freq_fs_1 = node_select_fs_1.get_node2(1, 3)
|
||||
node_freq_fs_1_mod = node_select_fs_1.get_node2(0, 3)
|
||||
if (int(node_freq_fs_1.get_text()) != att_fs_1) and node_freq_fs_1.get_text() != '':
|
||||
node_freq_fs_1_mod.modulate = Color.AQUAMARINE
|
||||
node_freq_fs_1_mod.text = 'Аттенюатор*'
|
||||
else:
|
||||
node_freq_fs_1_mod.modulate = Color(1, 1, 0.941, 1)
|
||||
node_freq_fs_1_mod.text = 'Аттенюатор'
|
||||
|
||||
# FS 2
|
||||
var node_freq_fs_2 = node_select_fs_2.get_node2(1, 2)
|
||||
var node_freq_fs_2_mod = node_select_fs_2.get_node2(0, 2)
|
||||
if int(node_freq_fs_2.get_text()) != freq_fs_2 and node_freq_fs_2.get_text() != '':
|
||||
node_freq_fs_2_mod.modulate = Color.AQUAMARINE
|
||||
node_freq_fs_2_mod.text = 'Частота*'
|
||||
else:
|
||||
node_freq_fs_2_mod.modulate = Color(1, 1, 0.941, 1)
|
||||
node_freq_fs_2_mod.text = 'Частота'
|
||||
node_freq_fs_2 = node_select_fs_2.get_node2(1, 3)
|
||||
node_freq_fs_2_mod = node_select_fs_2.get_node2(0, 3)
|
||||
if int(node_freq_fs_2.get_text()) != freq_fs_2 and node_freq_fs_2.get_text() != '':
|
||||
node_freq_fs_2_mod.modulate = Color.AQUAMARINE
|
||||
node_freq_fs_2_mod.text = 'Аттенюатор*'
|
||||
else:
|
||||
node_freq_fs_2_mod.modulate = Color(1, 1, 0.941, 1)
|
||||
node_freq_fs_2_mod.text = 'Аттенюатор'
|
||||
|
||||
|
||||
## Рисует таблицу
|
||||
func draw_tabl(tbl: Node, row: Array, count_row: int):
|
||||
for i_row in count_row:
|
||||
@@ -356,6 +396,7 @@ func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
|
||||
|
||||
func _on_prd_select() -> void:
|
||||
emit_signal('read_ems_g_start')
|
||||
set_tab_and_buttons(0, 'select_prd')
|
||||
|
||||
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
extends Panel
|
||||
|
||||
signal signal_on_start_timer_03()
|
||||
|
||||
var timer: Timer = Timer.new()
|
||||
var timer_03: Timer = Timer.new()
|
||||
var node_cell_ind: Array
|
||||
var count_cell: int
|
||||
var past_pribor: int
|
||||
var logger: Node
|
||||
var flag_control_on: bool = false
|
||||
var array_pow: Array = []
|
||||
var count_packet:int = 0
|
||||
|
||||
|
||||
class Logger extends Node:
|
||||
@@ -15,7 +21,7 @@ class Logger extends Node:
|
||||
func _init(log_node):
|
||||
log_array = log_node
|
||||
log_array.clear()
|
||||
|
||||
|
||||
func get_current_datetime_string() -> String:
|
||||
var time = Time.get_datetime_dict_from_system()
|
||||
return ' [%02d-%02d-%04d %02d:%02d] ' % [time['day'], time['month'], time['year'], time['hour'], time['minute']]
|
||||
@@ -42,12 +48,19 @@ 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('data_from_fs_1', _on_data_fs_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))
|
||||
|
||||
self.add_child(timer)
|
||||
timer.connect('timeout', Callable(self, '_on_timer'))
|
||||
Network.connect('yau_receive', Callable(self, '_on_yau_received'))
|
||||
|
||||
# Добавляем таймер как дочерний узел
|
||||
self.add_child(timer_03)
|
||||
# Подключаем сигнал timeout к функции _on_timer_03
|
||||
timer_03.connect('timeout', Callable(self, '_on_timer_03'))
|
||||
self.connect('signal_on_start_timer_03', Callable(self, '_on_start_timer_03'))
|
||||
|
||||
node_cell_ind = [
|
||||
$soc_y5/yau_07b,
|
||||
@@ -113,21 +126,41 @@ func _status_cell(status):
|
||||
|
||||
#dry_contact
|
||||
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
|
||||
for i in range(5, 13):
|
||||
if ((dry_contact >> (i-5)) & 0x1) == 0:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
|
||||
logger.info("%s : Есть связь ✅" % node_cell_ind[i].get('fname'))
|
||||
for i_node in range(5, 13):
|
||||
if i_node == 10 or i_node == 11:
|
||||
if Constants.CURRENT_MODE != Constants.MODE.PRD_K:
|
||||
return
|
||||
if ((dry_contact >> (i_node-5)) & 0x1) == 0:
|
||||
node_cell_ind[i_node].state = Constants.STATE_VAL.GOOD
|
||||
logger.info("%s : Есть связь ✅" % node_cell_ind[i_node].get('fname'))
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
logger.error("%s : Нет связи ❌" % node_cell_ind[i].get('fname'))
|
||||
node_cell_ind[i_node].state = Constants.STATE_VAL.ERROR
|
||||
logger.error("%s : Нет связи ❌" % node_cell_ind[i_node].get('fname'))
|
||||
else:
|
||||
for i in range(5, 13):
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
for i_node_unknow in range(5, 13):
|
||||
node_cell_ind[i_node_unknow].state = Constants.STATE_VAL.NONE
|
||||
|
||||
|
||||
func _on_yau_received(status_yau):
|
||||
if flag_control_on:
|
||||
var arr_power_ukp_1: Array = []
|
||||
for i in range(6): ## Мощность от УКП_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 = arr_power_ukp_1
|
||||
else:
|
||||
for i in range(6):
|
||||
if arr_power_ukp_1[i] > array_pow[i]:
|
||||
array_pow[i] = arr_power_ukp_1[i]
|
||||
count_packet +=1
|
||||
|
||||
|
||||
func _status_prd():
|
||||
var status: int = 0
|
||||
for i in range(10):
|
||||
print([node_cell_ind[i].state, i])
|
||||
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
|
||||
for i in range(12, count_cell-2):
|
||||
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
|
||||
@@ -139,9 +172,11 @@ func _status_prd():
|
||||
status += 1 if (node_cell_ind[17].state == Constants.STATE_VAL.GOOD) else 0
|
||||
status += 1 if (node_cell_ind[18].state == Constants.STATE_VAL.GOOD) else 0
|
||||
|
||||
if (status == count_cell-5):
|
||||
$lbl_control.text = 'Прибор исправен'
|
||||
$lbl_control.modulate = Color.AQUAMARINE
|
||||
if (status == count_cell-7):
|
||||
print(status)
|
||||
#$lbl_control.text = 'Прибор исправен'
|
||||
#$lbl_control.modulate = Color.AQUAMARINE
|
||||
emit_signal('signal_on_start_timer_03')
|
||||
else:
|
||||
$lbl_control.text = 'Прибор неисправен'
|
||||
$lbl_control.modulate = Color.CRIMSON
|
||||
@@ -253,26 +288,44 @@ func _draw_control_panel_prd(pribor):
|
||||
$soc_DKM/DKM_2.fname = 'ДКМ7'
|
||||
|
||||
|
||||
func _on_fs_status_1(name_port, status_fs_1: int):
|
||||
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):
|
||||
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_setup(freq_1):
|
||||
func fs_1_setup(freq):
|
||||
Network.status_can_macro_1(false)
|
||||
Network.set_fs_ferq_carrier(freq_1 * 1_000_000)
|
||||
Network.set_fs_ferq_carrier(freq * 1_000_000)
|
||||
Network.set_fs_attenuation(float(19))
|
||||
Network.set_can_macro(freq_1)
|
||||
Network.set_can_macro(freq)
|
||||
Network.status_can_macro_1(true)
|
||||
Network.get_fs_gen_status(false)
|
||||
Network.get_fs_gen_status(true) ## отключен пока что (поменять на false)
|
||||
|
||||
|
||||
func fs_2_setup(freq):
|
||||
Network.status_can_macro_2(false)
|
||||
Network.set_fs_ferq_carrier_2(freq * 1_000_000)
|
||||
Network.set_fs_attenuation_2(float(19))
|
||||
Network.set_can_macro_2(freq)
|
||||
Network.status_can_macro_2(true)
|
||||
Network.get_fs_gen_status_2(true) ## отключен пока что (поменять на false)
|
||||
|
||||
|
||||
func yau_07b_setup():
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+6, 56)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+8, 56)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 51)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 52)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 2<<13)
|
||||
|
||||
|
||||
func _on_data_fs_1(fs_1_data):
|
||||
@@ -297,13 +350,9 @@ func _on_data_fs_1(fs_1_data):
|
||||
logger.info('В модуль ФС-1 установлена частота CAN: %s МГц ✅' % (fs_1_data.decode_u16(0x20)))
|
||||
|
||||
|
||||
func yau_07b_setup():
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG, 9)
|
||||
|
||||
|
||||
func _on_start_super_control():
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
timer.start(5)
|
||||
#timer.start(5)
|
||||
|
||||
if (past_pribor != Constants.CURRENT_MODE):
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
@@ -320,8 +369,12 @@ func _on_start_super_control():
|
||||
logger.error("ЯУ-07Б: Нет связи ❌")
|
||||
|
||||
if Network.unit_fs.online:
|
||||
logger.info('Настройка модуля ФС (932 Гц)')
|
||||
fs_setup(932) # Гц
|
||||
logger.info('Настройка модуля ФС %s Гц' % 932)
|
||||
fs_1_setup(932) # Гц
|
||||
fs_2_setup(1137) # Гц
|
||||
else:
|
||||
logger.info('Настройка модуля ФС ❌')
|
||||
|
||||
|
||||
_status_prd()
|
||||
past_pribor = Constants.CURRENT_MODE
|
||||
@@ -330,7 +383,7 @@ func _on_start_super_control():
|
||||
func _on_timer():
|
||||
if (Network.unit.online):
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
logger.info("ЯУ-07Б: Есть связь ✅")
|
||||
logger.info("ЯУ-07Б: Есть связь ✅ ")
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.GOOD
|
||||
_status_cell(Network.unit.status)
|
||||
else:
|
||||
@@ -339,3 +392,31 @@ func _on_timer():
|
||||
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR
|
||||
logger.error("ЯУ-07Б: Нет связи ❌")
|
||||
|
||||
if (Network.unit_fs.online):
|
||||
logger.info('Настройка модуля ФС %s Гц' % 932)
|
||||
fs_1_setup(932) # Гц
|
||||
fs_2_setup(1137) # Гц
|
||||
else:
|
||||
logger.info('Настройка модуля ФС ❌')
|
||||
|
||||
|
||||
func _on_start_timer_03():
|
||||
timer_03.wait_time = 0.3
|
||||
timer_03.one_shot = true
|
||||
array_pow = []
|
||||
flag_control_on = true
|
||||
count_packet = 0
|
||||
logger.info('Включение Модуляции УМ на высокое')
|
||||
#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, 1<<13)
|
||||
timer_03.start()
|
||||
|
||||
|
||||
func _on_timer_03():
|
||||
#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, 0<<13)
|
||||
logger.info('Отключение Модуляции УМ')
|
||||
flag_control_on = false
|
||||
logger.info('Количество принятых пакетов от ЯУ-07Б: %s пакета' % count_packet)
|
||||
logger.info('Максимальные значения по мощности от УКП-1: %s ' % str(array_pow))
|
||||
|
||||
Reference in New Issue
Block a user