add git-hook-gdscript.sh
This commit is contained in:
@@ -46,7 +46,12 @@ func _ready() -> void:
|
||||
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])
|
||||
|
||||
|
||||
# Таблица ЯУ-07б-3
|
||||
var node_select_yau_07b_3 = $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
|
||||
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())
|
||||
@@ -56,7 +61,46 @@ func _ready() -> void:
|
||||
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])
|
||||
|
||||
|
||||
#Таблица ФС-3
|
||||
var 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
|
||||
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'
|
||||
node_select_yau_07b_3.set_node_text(0, 2, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+3]) # 'Модуляция УМ'
|
||||
node_select_yau_07b_3.set_node_text(0, 3, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+4]) # 'Положение луча'
|
||||
node_select_yau_07b_3.set_node_text(0, 4, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+5]) # 'Аттенюатор УМ'
|
||||
node_select_yau_07b_3.get_node2(1, 5).get_child(1).visible = false
|
||||
node_select_yau_07b_3.set_node_text(0, 5, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+6]) # 'ФГОЗ'
|
||||
node_select_yau_07b_3.set_node_text(0, 6, Constants.SIGNS[Constants.MODE.PRD_K][item_place_yau_07_3+7]) # 'СИ 1 в УФ'
|
||||
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
|
||||
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]) # 'Состояние'
|
||||
node_select_fs_3.set_node_text(0, 2, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+3]) # 'Частота'
|
||||
node_select_fs_3.get_node2(1, 2).placeholder_text = 'в МГц'
|
||||
node_select_fs_3.get_node2(1, 2).editable = true
|
||||
node_select_fs_3.set_node_text(0, 3, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+4]) # 'Аттенюатор ФС'
|
||||
node_select_fs_3.get_node2(1, 3).placeholder_text = 'в dB'
|
||||
node_select_fs_3.get_node2(1, 3).editable = true
|
||||
node_select_fs_3.set_node_text(0, 4, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+5]) # 'Модуляция ФС 1'
|
||||
node_select_fs_3.get_node2(1, 4).add_item('Const')
|
||||
node_select_fs_3.get_node2(1, 4).add_item('MSK')
|
||||
node_select_fs_3.set_node_text(0, 5, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+6]) # 'Генератор ФС'
|
||||
node_select_fs_3.set_node_text(0, 6, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+7]) # 'СИ 1 от ФС'
|
||||
node_select_fs_3.set_node_text(0, 7, Constants.SIGNS[Constants.MODE.PRD_K][item_place_fs_3+8]) # 'Фильтр CAN'
|
||||
node_select_fs_3.get_node2(1, 7).placeholder_text = 'в МГц'
|
||||
node_select_fs_3.get_node2(1, 7).editable = true
|
||||
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
|
||||
draw_tabl(node_select_device, Constants.SELECT_DEVICE, Constants.SELECT_DEVICE.size())
|
||||
@@ -71,7 +115,7 @@ func _ready() -> void:
|
||||
node_select_device.set_columns_min_size([100, 100])
|
||||
|
||||
# Получение выбранного прибора при загрузке
|
||||
status_pribor = Constants.CURRENT_MODE
|
||||
status_pribor = Constants.CURRENT_MODE
|
||||
|
||||
add_signs_scene()
|
||||
|
||||
@@ -204,6 +248,8 @@ func add_signs_scene():
|
||||
node_select_fs_2.get_node2(1, 7).placeholder_text = 'в МГц'
|
||||
node_select_fs_2.get_node2(1, 7).editable = true
|
||||
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
|
||||
|
||||
|
||||
func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
|
||||
@@ -267,6 +267,31 @@ const SIGNS: Dictionary = {
|
||||
'СИ 7 от ФС',
|
||||
'Фильтр CAN',
|
||||
'Статус CAN',
|
||||
|
||||
# ЯУ-07б-2
|
||||
'ПРД-К',
|
||||
'Литера 1',
|
||||
'Запрет СИ 1',
|
||||
'Модуляция УМ',
|
||||
'Положение луча',
|
||||
'Аттенюатор УМ',
|
||||
'',
|
||||
'СИ 1 в УФ',
|
||||
'СЗИ 1 от УФ',
|
||||
|
||||
# ФС-3
|
||||
'Модуль ФС',
|
||||
'Литера 1',
|
||||
'Состояние',
|
||||
'Частота',
|
||||
'Аттенюатор',
|
||||
'Модуляция',
|
||||
'Генератор ФС',
|
||||
'СИ 1 от ФС',
|
||||
'Фильтр CAN',
|
||||
'Статус CAN',
|
||||
|
||||
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ signal signal_on_modul_um()
|
||||
var timer: Timer = Timer.new()
|
||||
var timer_03: Timer = Timer.new()
|
||||
var node_cell_ind: Array
|
||||
var um_cell_ind: Array
|
||||
var count_cell: int
|
||||
var past_pribor: int
|
||||
var logger: Node
|
||||
@@ -69,6 +70,7 @@ func _ready() -> void:
|
||||
timer_03.connect('timeout', Callable(self, '_on_timer_03'))
|
||||
self.connect('signal_on_start_timer_03', Callable(self, '_on_start_timer_03'))
|
||||
Network.connect('yau_receive', Callable(self, '_on_yau_received'))
|
||||
Network.connect('yau_feedback_receive', Callable(self, '_on_yau_feedback_receive'))
|
||||
self.connect('signal_on_modul_um', Callable(self, '_on_modul_um'))
|
||||
|
||||
node_cell_ind = [
|
||||
@@ -101,6 +103,21 @@ func _ready() -> void:
|
||||
$soc_DKM/DKM_3,
|
||||
]
|
||||
count_cell = len(node_cell_ind)
|
||||
um_cell_ind = [
|
||||
$socket_ym_lb/blok_ym_1,
|
||||
$socket_ym_lb/blok_ym_2,
|
||||
$socket_ym_lb/blok_ym_3,
|
||||
$socket_ym_lb/blok_ym_4,
|
||||
$socket_ym_lb/blok_ym_5,
|
||||
$socket_ym_lb/blok_ym_6,
|
||||
|
||||
$socket_ym_pb/blok_ym_1,
|
||||
$socket_ym_pb/blok_ym_2,
|
||||
$socket_ym_pb/blok_ym_3,
|
||||
$socket_ym_pb/blok_ym_4,
|
||||
$socket_ym_pb/blok_ym_5,
|
||||
$socket_ym_pb/blok_ym_6,
|
||||
]
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
|
||||
|
||||
@@ -238,7 +255,7 @@ func fs_1_setup(freq):
|
||||
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(19))
|
||||
Network.set_fs_attenuation(float(18)) # Для литеры 4
|
||||
Network.set_can_macro(freq)
|
||||
Network.status_can_macro_1(true)
|
||||
await get_tree().create_timer(0.4).timeout
|
||||
@@ -254,7 +271,7 @@ func fs_2_setup(freq):
|
||||
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(19))
|
||||
Network.set_fs_attenuation_2(float(16)) # Для литеры 5
|
||||
Network.set_can_macro_2(freq)
|
||||
Network.status_can_macro_2(true)
|
||||
await get_tree().create_timer(0.8).timeout
|
||||
@@ -279,23 +296,23 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
|
||||
match CMD:
|
||||
Constants.CMD.READ_CARRIER:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
logger.info('В модуль %s установлена частота: %s МГц ✅' % [fs_name, (fs_data.decode_u64(0xC) / 1_000_000.0)])
|
||||
logger.info('✅ В модуль %s установлена частота: %s МГц' % [fs_name, (fs_data.decode_u64(0xC) / 1_000_000.0)])
|
||||
Constants.CMD.READ_ATT:
|
||||
if GRP == Constants.GROUP.RF:
|
||||
logger.info('В модуль %s установлена аттенюация: %s dB ✅' % [fs_name, (fs_data.decode_float(0x18))])
|
||||
logger.info('✅ В модуль %s установлена аттенюация: %s dB' % [fs_name, (fs_data.decode_float(0x18))])
|
||||
Constants.CMD.READ_GEN_STATUS:
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_data.decode_u32(0xC) == 0:
|
||||
logger.info('Состояние генератора %s: Включен ✅' % fs_name)
|
||||
logger.info('✅ Состояние генератора %s: Включен' % fs_name)
|
||||
else:
|
||||
if fs_name == 'ФС-1':
|
||||
flag_fs_1_ready = false
|
||||
if fs_name == 'ФС-2':
|
||||
flag_fs_2_ready = false
|
||||
logger.info('Состояние генератора %s: Отключен ❌' % fs_name)
|
||||
logger.info('🛈 Состояние генератора %s: Отключен' % fs_name)
|
||||
Constants.CMD.BASE_CAN_MACRO_READ:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
logger.info('В модуль %s установлена частота CAN: %s МГц ✅' % [fs_name, (fs_data.decode_u16(0x20))])
|
||||
logger.info('✅ В модуль %s установлена частота CAN: %s МГц' % [fs_name, (fs_data.decode_u16(0x20))])
|
||||
|
||||
|
||||
func _on_yau_received(status_yau):
|
||||
@@ -325,35 +342,33 @@ func _on_yau_received(status_yau):
|
||||
if arr_power_ukp_2[i] > array_pow_2[i]:
|
||||
array_pow_2[i] = arr_power_ukp_2[i]
|
||||
count_packet += 1
|
||||
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:
|
||||
flag_ug = true
|
||||
else:
|
||||
flag_ug = false
|
||||
## Флаг для проверки модуяции на высоком
|
||||
if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2):
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_2:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000:
|
||||
flag_modul_on_1 = true
|
||||
print('Модуляция 1 включена!')
|
||||
#logger.info('Модуляция УМ (2, 4, 6) включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000:
|
||||
flag_modul_on_1 = false
|
||||
print('Модуляция 1 отключена!')
|
||||
#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:
|
||||
flag_modul_on_2 = true
|
||||
print('Модуляция 2 включена!')
|
||||
#logger.info('Модуляция УМ (3, 5, 7) включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000:
|
||||
flag_modul_on_2 = false
|
||||
print('Модуляция 2 отключена!')
|
||||
#logger.info('Модуляция УМ (3, 5, 7) включена!!')
|
||||
|
||||
|
||||
func _on_yau_feedback_receive(_status_yau):
|
||||
## Флаг для проверки настройки угла и аттенюации на двух литерах
|
||||
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:
|
||||
flag_ug = true
|
||||
else:
|
||||
flag_ug = false
|
||||
## Флаг для проверки модуяции на высоком
|
||||
if Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+8) and Network.unit.isa_ports.has(Constants.BASE_PORTS.EMS_G+2):
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+2] == Constants.META.MODUL_UM_2:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x8000 and (not flag_modul_on_1):
|
||||
flag_modul_on_1 = true
|
||||
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) отключена!')
|
||||
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) отключена!')
|
||||
|
||||
|
||||
func _on_start_super_control():
|
||||
$log_array/await.visible = true
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
@@ -367,14 +382,16 @@ func _on_start_super_control():
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
if (Network.unit.online):
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.GOOD
|
||||
logger.info("ЯУ-07Б: Есть связь ✅")
|
||||
logger.info("✅ ЯУ-07Б: Есть связь")
|
||||
_status_cell(Network.unit.status)
|
||||
|
||||
else:
|
||||
for i in range(1, count_cell):
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR
|
||||
logger.error("ЯУ-07Б: Нет связи ❌")
|
||||
logger.error("❌ ЯУ-07Б: Нет связи")
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
|
||||
if Network.unit_fs.online:
|
||||
@@ -389,7 +406,7 @@ func _on_start_super_control():
|
||||
fs_1_setup(fs_freq[0]) # Гц
|
||||
fs_2_setup(fs_freq[1]) # Гц
|
||||
else:
|
||||
logger.info('Настройка модулей ФС ❌')
|
||||
logger.info('❌ Настройка модулей ФС')
|
||||
|
||||
|
||||
func _status_cell(status):
|
||||
@@ -400,10 +417,10 @@ func _status_cell(status):
|
||||
for i in range(1, 5):
|
||||
if ((status_board >> (i-1)) & 0x1) == 1:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
|
||||
logger.info("%s : Есть связь ✅" % node_cell_ind[i].get('fname'))
|
||||
logger.info("✅ %s : Есть связь" % node_cell_ind[i].get('fname'))
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
logger.error("%s : Нет связи ❌" % node_cell_ind[i].get('fname'))
|
||||
logger.error("❌ %s : Нет связи" % node_cell_ind[i].get('fname'))
|
||||
|
||||
#dry_contact
|
||||
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
|
||||
@@ -415,10 +432,16 @@ func _status_cell(status):
|
||||
if not skip:
|
||||
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'))
|
||||
logger.info("✅ %s : Есть связь" % node_cell_ind[i_node].get('fname'))
|
||||
else:
|
||||
node_cell_ind[i_node].state = Constants.STATE_VAL.ERROR
|
||||
logger.error("%s : Нет связи ❌" % node_cell_ind[i_node].get('fname'))
|
||||
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'))
|
||||
else:
|
||||
logger.error('❌ %s: Нет на связи, не буду продолжать' % node_cell_ind[3].get('fname'))
|
||||
else:
|
||||
for i_node_unknow in range(5, 13):
|
||||
node_cell_ind[i_node_unknow].state = Constants.STATE_VAL.NONE
|
||||
@@ -427,7 +450,7 @@ func _status_cell(status):
|
||||
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:
|
||||
@@ -435,14 +458,14 @@ func _on_timer():
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.NONE
|
||||
|
||||
$soc_y5/yau_07b.state = Constants.STATE_VAL.ERROR
|
||||
logger.error("ЯУ-07Б: Нет связи ❌")
|
||||
logger.error("❌ ЯУ-07Б: Нет связи")
|
||||
|
||||
if (Network.unit_fs.online):
|
||||
logger.info('Настройка модулей ФС Гц:')
|
||||
fs_1_setup(Constants.FS_FREQ.f2) # Гц
|
||||
fs_2_setup(Constants.FS_FREQ.f3) # Гц
|
||||
else:
|
||||
logger.error('Настройка модулей ФС ❌')
|
||||
logger.error('❌ Настройка модулей ФС')
|
||||
|
||||
|
||||
func _on_fs_status(META:int):
|
||||
@@ -455,7 +478,7 @@ func _on_fs_status(META:int):
|
||||
if flag_fs_1_ready and flag_fs_2_ready:
|
||||
#dkm
|
||||
var dkm: int = Network.unit.status.decode_u8(Constants.DataIndices.DKM)
|
||||
$DKM.text = str(dkm)
|
||||
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
|
||||
$soc_DKM/DKM_2.state = (dkm >> 1) & 0x1
|
||||
$soc_DKM/DKM_3.state = (dkm >> 2) & 0x1
|
||||
@@ -472,7 +495,6 @@ func _on_fs_status(META:int):
|
||||
|
||||
if (dkm >> 1) & 0x1 == 1 and (dkm >> 2) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
yau_07b_setup()
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
|
||||
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
|
||||
@@ -486,9 +508,9 @@ func _on_fs_status(META:int):
|
||||
logger.info('%s: %s ✅' % [$Kasseta_FS/ref_A4.fname, 'Включено'])
|
||||
else:
|
||||
logger.info('%s: %s ❌' % [$Kasseta_FS/ref_A4.fname, 'Нет связи'])
|
||||
|
||||
if (dkm >> 3) & 0x1 == 1 and (dkm >> 4) & 0x1 == 1: # Следующий шаг ->
|
||||
flag_dkm = true
|
||||
yau_07b_setup()
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
|
||||
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
|
||||
@@ -526,9 +548,9 @@ func _on_timer_03():
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, 0x4000)
|
||||
flag_control_add = false
|
||||
await get_tree().create_timer(1.0).timeout
|
||||
logger.info('Количество принятых пакетов от ЯУ-07Б: %s пакета' % count_packet)
|
||||
logger.info('Максимальные значения по мощности от УКП-1: %s ' % str(array_pow_1))
|
||||
logger.info('Максимальные значения по мощности от УКП-1: %s ' % str(array_pow_2))
|
||||
logger.info('Количество принятых пакетов от ЯУ-07Б: %s пкт.' % count_packet)
|
||||
logger.info('Максимальные значения мощностей от УКП-1: %s ' % str(array_pow_1))
|
||||
logger.info('Максимальные значения мощности от УКП-2: %s ' % str(array_pow_2))
|
||||
_status_prd()
|
||||
$log_array/await.visible = false
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CZI_1)
|
||||
@@ -552,16 +574,28 @@ func _status_prd():
|
||||
var min_dopusk: int = 40
|
||||
if (status == count_cell-7):
|
||||
pribor_ispraven = true
|
||||
var count_um: int = 0
|
||||
for i_pow in array_pow_1:
|
||||
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
|
||||
|
||||
if pribor_ispraven:
|
||||
$lbl_control.text = 'Прибор исправен'
|
||||
$lbl_control.text = 'Прибор %s исправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0]
|
||||
$lbl_control.modulate = Color.AQUAMARINE
|
||||
else:
|
||||
$lbl_control.text = 'Прибор неисправен'
|
||||
$lbl_control.text = 'Прибор %s неисправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0]
|
||||
$lbl_control.modulate = Color.CRIMSON
|
||||
|
||||
@@ -1,15 +1,73 @@
|
||||
extends Node
|
||||
|
||||
const INDEX_SIZE = 0xC
|
||||
var unit_fs = Fs.FGOS.new()
|
||||
var unit_fs_1 = Fs.FGOS.new()
|
||||
var counter: int = 0
|
||||
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 counter_fs_1: int = 0
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
pass
|
||||
|
||||
|
||||
# Подключится к модулю ФС
|
||||
func connect_fs_1():
|
||||
if client_fs_1:
|
||||
unit_fs_1.disconnect_fs(client_fs_1)
|
||||
state_fs = Constants.STATE.IDLE
|
||||
command_stack = []
|
||||
|
||||
client_fs_1 = StreamPeerTCP.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_fs_1.set_stream_peer(client_fs_1)
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
pass
|
||||
if client_fs_1:
|
||||
poll_receive_fs(client_fs_1, peerstream_fs_1, ip_fs_1)
|
||||
state_machine_fs(client_fs_1)
|
||||
|
||||
|
||||
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()
|
||||
unit_fs_1.send_fs_data(pack, client_fs_1, peerstream_fs_1)
|
||||
state_fs = Constants.STATE.SEND
|
||||
|
||||
|
||||
func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: String):
|
||||
client.poll()
|
||||
var peer = peerstream.get_stream_peer()
|
||||
# Проверяем, существует ли соединение
|
||||
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)
|
||||
return
|
||||
|
||||
if 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
|
||||
|
||||
|
||||
func _enter_tree() -> void:
|
||||
@@ -57,30 +115,16 @@ func _on_data_send():
|
||||
#$read.text = str(data.hex_encode())
|
||||
|
||||
|
||||
func _on_send_pressed() -> void:
|
||||
unit_fs.get_carrier(counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_get_att() -> void:
|
||||
unit_fs.get_att_batch(counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_start():
|
||||
unit_fs.start_session(counter, Network.client_fs_1)
|
||||
unit_fs.base_get_current_temp(counter, Network.client_fs_1)
|
||||
unit_fs_1.start_session(counter, Network.client_fs_1)
|
||||
unit_fs_1.get_base_current_temp(counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_get_status(toggled_btn):
|
||||
var inverted_state = not toggled_btn
|
||||
unit_fs.set_gen_state(inverted_state, counter, Network.client_fs_1)
|
||||
unit_fs.get_gen_state(counter, Network.client_fs_1)
|
||||
unit_fs_1.set_gen_state(inverted_state, counter, Network.client_fs_1)
|
||||
unit_fs_1.get_gen_state(counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_set_ferq():
|
||||
var freq = int($set_space/write_to_set_freq.get_text()) * 1_000_000
|
||||
unit_fs.set_carrier(freq, counter, Network.client_fs_1)
|
||||
|
||||
|
||||
func _on_set_att():
|
||||
var att = float($set_space/write_to_set_att.get_text())
|
||||
unit_fs.set_att_batch(att, counter, Network.client_fs_1)
|
||||
func _on_addres_fs(input_addr: String) -> void:
|
||||
ip_fs_1 = input_addr
|
||||
|
||||
@@ -33,6 +33,7 @@ var counter_fs_2: int = 0
|
||||
# Яу-07б
|
||||
signal yau_status_line(_status) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
signal yau_receive(_data_from_yau)
|
||||
signal yau_feedback_receive(_data_from_yau)
|
||||
signal yau_read_isa(_unit_isa_ports)
|
||||
# ФС модуль
|
||||
signal data_from_fs_1(data:PackedByteArray)
|
||||
@@ -63,6 +64,8 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
unit.parse(broadcast_packet)
|
||||
var data_from_yau_07 = unit.status
|
||||
emit_signal('yau_receive', data_from_yau_07)
|
||||
if sock == soc_unicast:
|
||||
emit_signal('yau_feedback_receive', data_from_yau_07)
|
||||
else:
|
||||
if sock.get_available_packet_count():
|
||||
last_update_time_yau07 = 0.0
|
||||
|
||||
Reference in New Issue
Block a user