timer need
This commit is contained in:
138
scripts/PRD.gd
138
scripts/PRD.gd
@@ -5,6 +5,7 @@ signal read_ems_g_finish()
|
||||
|
||||
var node_select1: Node
|
||||
var node_select2: Node
|
||||
var node_select3: Node
|
||||
var node_select_yau_07b: Node
|
||||
var node_select_yau_07b_2: Node
|
||||
var node_select_fs_1: Node
|
||||
@@ -20,6 +21,8 @@ const need_port: Array = [0x122, 0x124, 0x126, 0x128, 0x12A]
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
$Background/lbl_commit.text = commit.VCS_HEAD
|
||||
|
||||
# Считывание аргументов с консоли (путь сохранения)
|
||||
var args = OS.get_cmdline_user_args()
|
||||
for i in range(args.size()):
|
||||
@@ -27,15 +30,20 @@ func _ready() -> void:
|
||||
save_path = args[i + 1]
|
||||
break
|
||||
|
||||
# Таблица УКП-1 (Температура, Мощность)
|
||||
# Таблица 1 УКП-1 (Температура, Мощность)
|
||||
node_select1 = $TabContainer/PRD/body_grid/litera_2_4_6/table_ukp_1
|
||||
draw_tabl(node_select1, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
|
||||
node_select1.set_columns_min_size([120, 120])
|
||||
|
||||
# Таблица УКП-2 (Температура, Мощность)
|
||||
# Таблица 2 УКП-2 (Температура, Мощность)
|
||||
node_select2 = $TabContainer/PRD/body_grid/litera_3_5_7/table_ukp_2
|
||||
draw_tabl(node_select2, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size())
|
||||
node_select2.set_columns_min_size([120, 120])
|
||||
|
||||
# Таблица 3 УКП-1 (Температура, Мощность)
|
||||
node_select3 = $TabContainer/PRD/body_grid/litera_1/table_ukp_1
|
||||
draw_tabl(node_select3, [[preload("res://table/header.tscn"), preload("res://table/header.tscn")], [preload("res://table/node.tscn"), preload("res://table/node.tscn")]], [[preload("res://table/header.tscn"), preload("res://table/header.tscn")], [preload("res://table/node.tscn"), preload("res://table/node.tscn")]].size())
|
||||
node_select3.set_columns_min_size([120, 120])
|
||||
|
||||
# Таблица ЯУ-07б-1
|
||||
node_select_yau_07b = $TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control
|
||||
@@ -123,16 +131,26 @@ func _ready() -> void:
|
||||
for key in Constants.OUT_x128:
|
||||
node_select_yau_07b.get_node2(1, 2).add_item(key)
|
||||
node_select_yau_07b_2.get_node2(1, 2).add_item(key)
|
||||
node_select_yau_07b_3.get_node2(1, 2).add_item(key)
|
||||
|
||||
|
||||
## Заполненение списка направления луча
|
||||
for key in Constants.RAY_DICT:
|
||||
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)
|
||||
|
||||
## Yau-07b 1
|
||||
node_select_yau_07b.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret_2'))
|
||||
@@ -180,6 +198,10 @@ func add_signs_scene():
|
||||
# Таблица УКП-2
|
||||
node_select2.set_node_text(0, 0, 'Мощность')
|
||||
node_select2.set_node_text(1, 0, 'Температура')
|
||||
|
||||
# Таблица УКП-1
|
||||
node_select3.set_node_text(0, 0, 'Мощность')
|
||||
node_select3.set_node_text(1, 0, 'Температура')
|
||||
|
||||
var item_place_yau_07: int = 9
|
||||
var item_place_fs_1: int = 18
|
||||
@@ -435,7 +457,7 @@ func _on_data_received(data_from_yau_07):
|
||||
|
||||
for i in range(6): ## Температура от УКП_1
|
||||
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP + 3
|
||||
node_select1.set_node_text(1, i+1, '%d °С' % TMP)
|
||||
|
||||
for i_pow in range(6): ## Мощность от УКП_2
|
||||
@@ -446,34 +468,20 @@ func _on_data_received(data_from_yau_07):
|
||||
for row in range(6): ## Температура от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row:
|
||||
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP + 3
|
||||
node_select2.set_node_text(1, row+1, '%d °С' % TMP)
|
||||
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * 7:
|
||||
var power_ukp_3 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * 7)
|
||||
var temperature_ukp_3 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * 7)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_3) * Constants.TEMP + 3
|
||||
node_select3.set_node_text(0, 1, '%d' % power_ukp_3)
|
||||
node_select3.set_node_text(1,1, '%d °С' % TMP)
|
||||
|
||||
|
||||
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')
|
||||
Network.get_gen_state_1()
|
||||
Network.get_gen_state_2()
|
||||
|
||||
|
||||
func _on_control_button() -> void:
|
||||
$TabContainer/ControlPanel._on_start_super_control()
|
||||
set_tab_and_buttons(1, 'select_control')
|
||||
|
||||
|
||||
func _on_emsg_select() -> void:
|
||||
emit_signal('read_ems_g_start')
|
||||
set_tab_and_buttons(2, 'select_ems_g')
|
||||
|
||||
|
||||
func _on_mfs_select() -> void:
|
||||
set_tab_and_buttons(3, 'select_fs')
|
||||
|
||||
|
||||
func _on_save_config():
|
||||
var da = DirAccess.open(save_path)
|
||||
var base_path = save_path + "save//"
|
||||
@@ -558,15 +566,6 @@ func _on_load_config():
|
||||
file_dialog.popup_centered()
|
||||
|
||||
|
||||
func set_tab_and_buttons(tab_index: int, button_name: String) -> void:
|
||||
$TabContainer.current_tab = tab_index
|
||||
var switch_panel = $Background/switch_panel
|
||||
|
||||
for button in switch_panel.get_children():
|
||||
if button is Button:
|
||||
button.button_pressed = (button.name == button_name)
|
||||
|
||||
|
||||
func on_mode_select(intem_from_sector: int) -> void:
|
||||
var node_select_device: GDTable = $TabContainer/PRD/select_dev
|
||||
var get_select_device = node_select_device.get_node2(1, 0)
|
||||
@@ -813,22 +812,69 @@ func _on_modul_fs_2(modulation_select_2) -> void:
|
||||
Network.set_configure_gen_msk_2()
|
||||
|
||||
|
||||
## Switch panel
|
||||
func _on_prd_select() -> void:
|
||||
emit_signal('read_ems_g_start')
|
||||
set_tab_and_buttons(0, 'select_prd', 'texture_prd')
|
||||
Network.get_gen_state_1()
|
||||
Network.get_gen_state_2()
|
||||
|
||||
|
||||
func _on_control_button() -> void:
|
||||
$TabContainer/ControlPanel._on_start_super_control()
|
||||
set_tab_and_buttons(1, 'select_control', 'texture_control')
|
||||
|
||||
|
||||
func _on_emsg_select() -> void:
|
||||
emit_signal('read_ems_g_start')
|
||||
set_tab_and_buttons(2, 'select_ems_g', 'texture_ems_g')
|
||||
|
||||
|
||||
func _on_mfs_select() -> void:
|
||||
set_tab_and_buttons(3, 'select_fs', 'texture_fs')
|
||||
|
||||
|
||||
func _on_burger_button(toggled_on: bool) -> void:
|
||||
$Background/switch_panel/texture_prd.visible = toggled_on
|
||||
$Background/switch_panel/select_prd.visible = not toggled_on
|
||||
$Background/switch_panel/texture_control.visible = toggled_on
|
||||
$Background/switch_panel/select_control.visible = not toggled_on
|
||||
$Background/switch_panel/select_ems_g.visible = not toggled_on
|
||||
$Background/switch_panel/select_fs.visible = not toggled_on
|
||||
$Background/switch_panel/save_config.visible = not toggled_on
|
||||
$Background/switch_panel/load_config.visible = not toggled_on
|
||||
var txt_grp: Array = get_tree().get_nodes_in_group('burger_gr')
|
||||
var select_grp: Array = get_tree().get_nodes_in_group('select_grp')
|
||||
var tween: Tween = get_tree().create_tween()
|
||||
var pos_on_select: int = 17
|
||||
var pos_on_txt: int = 15
|
||||
var temp = txt_grp
|
||||
var tmp_pos = pos_on_txt
|
||||
|
||||
var pos_off: int = -300
|
||||
|
||||
if toggled_on:
|
||||
temp = select_grp
|
||||
|
||||
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:
|
||||
# Анимация вправо
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property(panel, "global_position", Vector2(-170, panel.global_position.y), 0.5).set_trans(Tween.TRANS_QUINT).set_ease(Tween.EASE_OUT)
|
||||
tween.tween_property(panel, "global_position", Vector2(-170, panel.global_position.y), 0.3).set_trans(Tween.TRANS_SINE).set_ease(Tween.EASE_OUT)
|
||||
else:
|
||||
# Анимация влево
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property(panel, "global_position", Vector2(0, panel.global_position.y), 0.5).set_trans(Tween.TRANS_QUINT).set_ease(Tween.EASE_OUT)
|
||||
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
|
||||
|
||||
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)
|
||||
|
||||
|
||||
func set_tab_and_buttons(tab_index: int, button_name: String, txt_button_name: String) -> void:
|
||||
$TabContainer.current_tab = tab_index
|
||||
var switch_panel = $Background/switch_panel
|
||||
|
||||
for button in switch_panel.get_children():
|
||||
if button is Button or TextureButton:
|
||||
if button.name != 'burgerButton':
|
||||
button.button_pressed = (button.name == button_name or button.name == txt_button_name)
|
||||
|
||||
@@ -126,6 +126,17 @@ const ATT_DICT: Array = [
|
||||
' 10 dB',
|
||||
' 10.5 dB',
|
||||
]
|
||||
const ATT_DICT_correct: Array = [
|
||||
' 0 dB',
|
||||
' 1 dB',
|
||||
' 4 dB',
|
||||
' 5 dB',
|
||||
' 16 dB',
|
||||
' 17 dB',
|
||||
' 20 dB',
|
||||
' 21 dB',
|
||||
]
|
||||
|
||||
const SIGNS: Dictionary = {
|
||||
MODE.PRD_H: [
|
||||
# ЯУ-07б-1
|
||||
|
||||
@@ -316,6 +316,7 @@ 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 = []
|
||||
@@ -345,28 +346,29 @@ func _on_yau_received(status_yau):
|
||||
|
||||
|
||||
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) отключена!')
|
||||
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 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():
|
||||
|
||||
@@ -186,6 +186,25 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
|
||||
if frame_type == Constants.Frame.CONSTANT and status_fs_2 != Constants.Frame.CONSTANT:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_5_OT_FS)
|
||||
status_fs_2 = frame_type
|
||||
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
|
||||
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 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:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_6_OT_FS)
|
||||
status_fs_1 = 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:
|
||||
emit_signal('signal_FS_is_ready', Constants.META.CI_7_OT_FS)
|
||||
status_fs_2 = frame_type
|
||||
|
||||
|
||||
func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
|
||||
Reference in New Issue
Block a user