сохранение/загрузка в эмс-г на доработке
This commit is contained in:
@@ -21,7 +21,9 @@ 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_modul_litera_1: bool = false
|
||||
var flag_start: bool = false
|
||||
var flag_continue_control: bool = false
|
||||
var prep_set_ug: int = 0
|
||||
|
||||
|
||||
@@ -124,6 +126,8 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not flag_continue_control:
|
||||
return
|
||||
if flag_dkm and flag_ug:
|
||||
emit_signal('signal_on_modul_um')
|
||||
if flag_modul_on_1 and flag_modul_on_2 and flag_start:
|
||||
@@ -242,6 +246,8 @@ func _draw_control_panel_prd(pribor):
|
||||
|
||||
|
||||
func fs_1_setup(freq: int, att: float):
|
||||
if not flag_continue_control:
|
||||
return
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.set_fs_gen_status(true) ## отключен на true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
@@ -258,6 +264,8 @@ func fs_1_setup(freq: int, att: float):
|
||||
|
||||
|
||||
func fs_2_setup(freq: int, att: float):
|
||||
if not flag_continue_control:
|
||||
return
|
||||
await get_tree().create_timer(0.8).timeout
|
||||
Network.set_fs_gen_status_2(true) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
@@ -274,7 +282,9 @@ func fs_2_setup(freq: int, att: float):
|
||||
|
||||
|
||||
func fs_3_setup(freq: int, att: float):
|
||||
await get_tree().create_timer(1.5).timeout
|
||||
if not flag_continue_control:
|
||||
return
|
||||
await get_tree().create_timer(1.8).timeout
|
||||
Network.set_fs_gen_status_3(true) ## отключен = true
|
||||
await get_tree().create_timer(0.1).timeout
|
||||
Network.get_gen_state_3()
|
||||
@@ -283,13 +293,15 @@ func fs_3_setup(freq: int, att: float):
|
||||
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
|
||||
await get_tree().create_timer(0.2).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):
|
||||
if not flag_continue_control:
|
||||
return
|
||||
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.EMS_G+2, Constants.META.MODUL_UM_2)
|
||||
@@ -319,13 +331,10 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
|
||||
if GRP == Constants.GROUP.GENERATOR:
|
||||
if fs_data.decode_u32(0xC) == 0:
|
||||
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':
|
||||
@@ -341,7 +350,7 @@ func _on_data_fs(fs_data:PackedByteArray, fs_name: String):
|
||||
|
||||
|
||||
func _on_yau_received(status_yau):
|
||||
if flag_control_add:
|
||||
if flag_control_add and flag_continue_control:
|
||||
# Сбор урожая с УКП-1
|
||||
var arr_power_ukp_1: Array = []
|
||||
var numbre_scrape = 7 if Constants.CURRENT_MODE == Constants.MODE.PRD_K else 6
|
||||
@@ -374,7 +383,7 @@ func _on_yau_received(status_yau):
|
||||
|
||||
|
||||
func _on_yau_feedback_receive(_status_yau):
|
||||
if logger:
|
||||
if logger and flag_continue_control:
|
||||
## Флаг для проверки настройки угла и аттенюации на двух литерах
|
||||
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] == prep_set_ug and Network.unit.isa_ports[Constants.BASE_PORTS.UG+8] == prep_set_ug:
|
||||
@@ -404,15 +413,20 @@ func _on_yau_feedback_receive(_status_yau):
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
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_1:
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x2000:
|
||||
print('Yes ')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000:
|
||||
print('NO')
|
||||
if Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x2000 and (not flag_modul_litera_1):
|
||||
flag_modul_litera_1 = true
|
||||
logger.info('✅ Модуляция УМ 1 включена!')
|
||||
elif Network.unit.isa_ports[Constants.BASE_PORTS.EMS_G+8] == 0x4000 and flag_modul_litera_1:
|
||||
flag_modul_litera_1 = false
|
||||
logger.info('🛈 Модуляция УМ 1 отключена!')
|
||||
|
||||
|
||||
func _on_start_super_control():
|
||||
$lbl_control.text = 'Контроль запущен'
|
||||
$lbl_control.modulate = Color.LIGHT_GRAY
|
||||
$log_array/await.visible = true
|
||||
logger = Logger.new(get_node('log_array'))
|
||||
flag_continue_control = true
|
||||
|
||||
if (past_pribor != Constants.CURRENT_MODE):
|
||||
_draw_control_panel_prd(Constants.CURRENT_MODE)
|
||||
@@ -435,14 +449,13 @@ func _on_start_super_control():
|
||||
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
|
||||
um_cell_ind[i_temperature].state = 2
|
||||
um_cell_ind[i_temperature].state = Constants.STATE_VAL.ERROR
|
||||
_on_contol_err()
|
||||
#timer.start(5)
|
||||
else:
|
||||
um_cell_ind[i_temperature].value0 = TMP_1
|
||||
if TMP_2 > 70:
|
||||
um_cell_ind[i_temperature+6].value0 = TMP_2
|
||||
um_cell_ind[i_temperature+6].state = 2
|
||||
um_cell_ind[i_temperature+6].state = Constants.STATE_VAL.ERROR
|
||||
_on_contol_err()
|
||||
else:
|
||||
um_cell_ind[i_temperature+6].value0 = TMP_2
|
||||
@@ -477,26 +490,29 @@ func _on_start_super_control():
|
||||
var fs_att_3: float
|
||||
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
|
||||
fs_freq.append(Constants.FS_FREQ.f2)
|
||||
fs_att_1 = Constants.FS_ATT.att_1_prd_K1
|
||||
fs_att_1 = Constants.FS_ATT['ПРД-Н1'][0]
|
||||
fs_freq.append(Constants.FS_FREQ.f3)
|
||||
fs_att_2 = Constants.FS_ATT.att_1_prd_K1
|
||||
fs_att_2 = Constants.FS_ATT['ПРД-Н1'][1]
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
|
||||
fs_freq.append(Constants.FS_FREQ.f4)
|
||||
fs_att_1 = Constants.FS_ATT['ПРД-В1'][0]
|
||||
fs_freq.append(Constants.FS_FREQ.f5)
|
||||
fs_att_2 = Constants.FS_ATT['ПРД-В1'][1]
|
||||
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_att_1 = Constants.FS_ATT['ПРД-К1'][0]
|
||||
fs_freq.append(Constants.FS_FREQ.f7)
|
||||
fs_att_2 = Constants.FS_ATT.att_2_prd_K1
|
||||
fs_att_2 = Constants.FS_ATT['ПРД-К1'][1]
|
||||
fs_freq.append(Constants.FS_FREQ.f1)
|
||||
fs_att_3 = Constants.FS_ATT.att_3_prd_K1
|
||||
fs_att_3 = Constants.FS_ATT['ПРД-К1'][2]
|
||||
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)])
|
||||
logger.info('🛈 Настройка модулей ФС %s Гц, [%s / %s / %s] АТТ' % [str(fs_freq), str(fs_att_1), str(fs_att_2), str(fs_att_3)])
|
||||
fs_1_setup(fs_freq[0], fs_att_1) # Гц
|
||||
fs_2_setup(fs_freq[1], fs_att_2) # Гц
|
||||
|
||||
else:
|
||||
logger.info('❌ Настройка модулей ФС')
|
||||
_on_contol_err()
|
||||
|
||||
|
||||
func _status_cell(status):
|
||||
@@ -511,6 +527,7 @@ func _status_cell(status):
|
||||
else:
|
||||
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
|
||||
logger.error("❌ %s : Нет связи" % node_cell_ind[i].get('fname'))
|
||||
_on_contol_err()
|
||||
|
||||
#dry_contact
|
||||
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
|
||||
@@ -526,6 +543,7 @@ func _status_cell(status):
|
||||
else:
|
||||
node_cell_ind[i_node].state = Constants.STATE_VAL.ERROR
|
||||
logger.error("❌ %s : Нет связи" % node_cell_ind[i_node].get('fname'))
|
||||
_on_contol_err()
|
||||
|
||||
if node_cell_ind[3].state == Constants.STATE_VAL.GOOD:
|
||||
var mask: int = 0x7
|
||||
@@ -543,6 +561,7 @@ func _status_cell(status):
|
||||
yau_07b_setup(prep_set_ug)
|
||||
else:
|
||||
logger.error('❌ %s: Нет на связи, не буду продолжать' % node_cell_ind[2].get('fname'))
|
||||
_on_contol_err()
|
||||
|
||||
else:
|
||||
for i_node_unknow in range(5, 13):
|
||||
@@ -562,16 +581,16 @@ func _on_timer():
|
||||
|
||||
|
||||
func _on_fs_status(META:int):
|
||||
if logger:
|
||||
if logger and flag_continue_control:
|
||||
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
|
||||
logger.info('ФС - 1 READY')
|
||||
logger.info('✅ Состояние генератора ФС-1: Включен')
|
||||
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
|
||||
logger.info('ФС - 2 READY')
|
||||
logger.info('✅ Состояние генератора ФС-2: Включен')
|
||||
elif META == Constants.META.CI_1_OT_FS:
|
||||
flag_fs_3_ready = true
|
||||
logger.info('ФС - 3 READY')
|
||||
logger.info('✅ Состояние генератора ФС-3: Включен')
|
||||
|
||||
|
||||
if flag_fs_1_ready and flag_fs_2_ready:
|
||||
@@ -676,6 +695,8 @@ func _on_fs_status(META:int):
|
||||
|
||||
|
||||
func _on_modul_um():
|
||||
if not flag_continue_control:
|
||||
return
|
||||
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, 0x8000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
@@ -691,15 +712,16 @@ func _on_modul_um():
|
||||
|
||||
|
||||
func _on_start_timer_03():
|
||||
count_packet = 0
|
||||
flag_start = false
|
||||
flag_control_add = true
|
||||
timer_03.wait_time = 0.3
|
||||
timer_03.one_shot = true
|
||||
count_packet = 0
|
||||
flag_control_add = true
|
||||
timer_03.start()
|
||||
|
||||
|
||||
func _on_timer_03():
|
||||
flag_control_add = false
|
||||
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, 0x4000)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.MODUL_UM_3)
|
||||
@@ -716,18 +738,17 @@ func _on_timer_03():
|
||||
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)
|
||||
logger.info('Максимальные значения мощностей от УКП-1: %s ' % str(array_pow_1))
|
||||
logger.info('Максимальные значения мощности от УКП-2: %s ' % str(array_pow_2))
|
||||
_on_contol_err()
|
||||
logger.info('🛈 Количество принятых пакетов от ЯУ-07Б: %s пкт.' % count_packet)
|
||||
logger.info('🛈 Максимальные значения мощностей от УКП-1: %s ' % str(array_pow_1))
|
||||
logger.info('🛈 Максимальные значения мощности от УКП-2: %s ' % str(array_pow_2))
|
||||
_status_prd()
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, Constants.META.CZI_1)
|
||||
|
||||
|
||||
func _on_contol_err():
|
||||
logger.warning('❌❌❌')
|
||||
$log_array/await.visible = false
|
||||
flag_continue_control = false
|
||||
_status_prd()
|
||||
#timer.start(5)
|
||||
|
||||
@@ -748,8 +769,7 @@ func _status_prd():
|
||||
|
||||
var pribor_ispraven: bool = false
|
||||
var min_dopusk: int = 40
|
||||
var status_need = count_cell-7 if Constants.CURRENT_MODE != Constants.MODE.PRD_K else count_cell-4
|
||||
|
||||
var status_need = count_cell-7 if Constants.CURRENT_MODE != Constants.MODE.PRD_K else count_cell+1
|
||||
if (status == status_need):
|
||||
pribor_ispraven = true
|
||||
|
||||
@@ -786,8 +806,9 @@ func _status_prd():
|
||||
array_pow_2 = []
|
||||
|
||||
if pribor_ispraven:
|
||||
$lbl_control.text = 'Прибор %s исправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0]
|
||||
$lbl_control.text = 'Прибор %s исправен' % Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]
|
||||
$lbl_control.modulate = Color.AQUAMARINE
|
||||
else:
|
||||
$lbl_control.text = 'Прибор %s неисправен' % Constants.ADDRESSES[Constants.CURRENT_MODE * 4][0]
|
||||
$lbl_control.text = 'Прибор %s неисправен' % Constants.ADDRESSES[self.get_parent().get_child(0).get_child(1).get_node2(1, 0).get_selected_id()][0]
|
||||
$lbl_control.modulate = Color.CRIMSON
|
||||
$log_array/await.visible = false
|
||||
|
||||
Reference in New Issue
Block a user