diff --git a/scenes/pribor-prd-k/pribor-prd-k.gd b/scenes/pribor-prd-k/pribor-prd-k.gd index 12be888..1a3a975 100644 --- a/scenes/pribor-prd-k/pribor-prd-k.gd +++ b/scenes/pribor-prd-k/pribor-prd-k.gd @@ -59,64 +59,70 @@ var ug_work_1: int = 3 ## Аттенюация усилителей мощно var ug_work_2: int = 2 ## Аттенюация усилителей мощности var ug_work_3: int = 0 ## Аттенюация усилителей мощности var mashine_timer: Timer = Timer.new() -var prd_k_module: Object +#var prd_k_module: Object var unit_prd_k: Object -var control_prd_k: Object +#var control_prd_k: Object # Результаты контроля -var control_results_k: Dictionary = { - 'block_ip': false, # Проверка касет П1 и ИП МА2000 - 'temperature': true, - 'dkm_1': false, - 'dkm_6': false, - 'dkm_7': false, - 'dou_6': false, - 'dou_7': false, - 'fs_1': 2, - 'fs_6': 2, - 'fs_7': 2, -} +#var control_results_k: Dictionary = { + #'block_ip': false, # Проверка касет П1 и ИП МА2000 + #'temperature': true, + #'dkm_1': false, + #'dkm_6': false, + #'dkm_7': false, + #'dou_6': false, + #'dou_7': false, + #'fs_1': 2, + #'fs_6': 2, + #'fs_7': 2, +#} -var test_control_k = preload('res://scripts/pribor-prd.gd') var ctrl_pos = 30 func _ready() -> void: if Engine.is_editor_hint(): return + var unit_name = get_meta('unit_name')[0] + var prd_k_module = prd.prd_dict[unit_name] + unit_prd_k = prd_k_module.unit_control - initialize_connections() + unit_prd_k.connect('control_is_over', Callable(self, 'on_control_result')) + + +func start_control() -> void: + #initialize_connections() setup_timer() set_default_state() find_labels(self) -func on_state_mashine() -> void: - control_prd_k.state_control_machine() +#func on_state_mashine() -> void: + #control_prd_k.state_control_machine() -func initialize_connections() -> void: - var unit_name = get_meta('unit_name')[0] - prd_k_module = prd.prd_dict[unit_name] - unit_prd_k = prd_k_module.unit_yau07 - - unit_prd_k.connect('line_changed', Callable(self, 'on_line_changed')) - var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier') - var init_data: Dictionary = { - 'control_label': $control_result, - 'power_amplifiers': power_amplifiers, - 'unit_prd': unit_prd_k, - 'module_prd' : prd_k_module, - 'constants': constants_k, - 'prd_config': PRIBOR_CONFIG, - 'fs_params': FS_PARAMS, - 'block_ip_prd_config': block_ip_config_k, - 'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_k, - 'control_results': control_results_k, - 'current_litera': start_litera, - } - control_prd_k = test_control_k.TestPRD.new(init_data) - add_child(control_prd_k) - control_prd_k.connect('control_is_over', Callable(self, 'on_control_result')) +#func initialize_connections() -> void: + #var unit_name = get_meta('unit_name')[0] + #prd_k_module = prd.prd_dict[unit_name] + #unit_prd_k = prd_k_module.unit_yau07 +# + #unit_prd_k.connect('line_changed', Callable(self, 'on_line_changed')) + #var power_amplifiers: Array = get_tree().get_nodes_in_group('power_amplifier') + #var init_data: Dictionary = { + #'control_label': $control_result, + #'power_amplifiers': power_amplifiers, + #'unit_prd': unit_prd_k, + #'module_prd' : prd_k_module, + #'constants': constants_k, + #'prd_config': PRIBOR_CONFIG, + #'fs_params': FS_PARAMS, + #'block_ip_prd_config': block_ip_config_k, + #'block_kasseta_y5_prd_config': block_kasseta_y5_prd_config_k, + #'control_results': control_results_k, + #'current_litera': start_litera, + #} + #control_prd_k = test_control_k.TestPRD.new(init_data) + #add_child(control_prd_k) + #control_prd_k.connect('control_is_over', Callable(self, 'on_control_result')) func setup_timer() -> void: @@ -149,7 +155,7 @@ func _enter_tree() -> void: func _exit_tree() -> void: if Engine.is_editor_hint(): return - prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) + #prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) func on_line_changed(unit_pribor: Object) -> void: @@ -159,13 +165,15 @@ func on_line_changed(unit_pribor: Object) -> void: func on_mode_changed(in_tree: bool) -> void: if not in_tree: - mashine_timer.stop() - prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) - signaller.emit_signal('interfer_off_all') + print_debug('Выход из сцены') + #mashine_timer.stop() + #prd_k_module.cmd_array.append([unit_prd_k.CmdCode.WRITE_ISA, [constants_k.ADDR_UG_LITERA_1, ug_work_1, constants_k.ADDR_UG_LITERA_2, ug_work_2, constants_k.ADDR_UG_LITERA_3, ug_work_3]]) + #signaller.emit_signal('interfer_off_all') else: - set_default_state() - control_prd_k.state = control_prd_k.STATE_MASHINE.INIT - mashine_timer.start() + print_debug('Вход в сцену') + #set_default_state() + #control_prd_k.state = control_prd_k.STATE_MASHINE.INIT + #mashine_timer.start() func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: @@ -193,7 +201,7 @@ func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void: mashine_timer.stop() - block_kasseta_y5_prd_config_k = control_prd_k.block_kasseta_y5_config + block_kasseta_y5_prd_config_k = unit_prd_k.block_kasseta_y5_config var nodes_y5: Array = get_tree().get_nodes_in_group('y-5') for node_y5 in nodes_y5: var meta_y5 = node_y5.get_meta('y5') @@ -203,7 +211,7 @@ func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void: break node_y5.state = STATE_VAL.GOOD if block_kasseta_y5_prd_config_k[meta_y5] else STATE_VAL.ERROR - block_ip_config_k = control_prd_k.block_ip_config + block_ip_config_k = unit_prd_k.block_ip_config var node_ip_power_arr: Array = get_tree().get_nodes_in_group('power_supply') for power_supply in node_ip_power_arr: var meta_ip = power_supply.get_meta('ip') @@ -240,13 +248,8 @@ func on_control_result(result_dic: Dictionary, power_dic: Dictionary) -> void: if not device: result = false - var name_prd = control_prd_k.self_name - if result: - $control_result.text = 'Прибор ПРД-%s исправен' % name_prd - $control_result.add_theme_color_override('font_color', Color.GREEN) - else: - $control_result.text = 'Прибор ПРД-%s неисправен' % name_prd - $control_result.add_theme_color_override('font_color', Color.RED) + var name_prd = unit_prd_k.self_name + log.message(Logger.INFO, 'Прибор ПРД-%s %s' % [name_prd, ['неисправен', 'исправен'][int(result)]]) func find_labels(node1: Node): diff --git a/scenes/pribor-prd-n/pribor-prd-n.gd b/scenes/pribor-prd-n/pribor-prd-n.gd index c69b553..ed21bc0 100644 --- a/scenes/pribor-prd-n/pribor-prd-n.gd +++ b/scenes/pribor-prd-n/pribor-prd-n.gd @@ -78,7 +78,10 @@ func on_state_mashine() -> void: func _ready() -> void: if Engine.is_editor_hint(): return + print_debug('В сцене ПРД-Н!') + +func start_control() -> void: initialize_connections() setup_timer() set_default_state() @@ -111,10 +114,11 @@ func initialize_connections() -> void: func setup_timer() -> void: - add_child(mashine_timer) - mashine_timer.connect('timeout', Callable(self, 'on_state_mashine')) - mashine_timer.wait_time = constants_n.STATE_MASHINE_TIMER - mashine_timer.start() + pass + #add_child(mashine_timer) + #mashine_timer.connect('timeout', Callable(self, 'on_state_mashine')) + #mashine_timer.wait_time = constants_n.STATE_MASHINE_TIMER + #mashine_timer.start() func set_default_state() -> void: @@ -140,7 +144,7 @@ func _enter_tree() -> void: func _exit_tree() -> void: if Engine.is_editor_hint(): return - prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) + #prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) func on_line_changed(unit_pribor: Object) -> void: @@ -149,14 +153,15 @@ func on_line_changed(unit_pribor: Object) -> void: func on_mode_changed(in_tree: bool) -> void: - if not in_tree: - mashine_timer.stop() - signaller.emit_signal('interfer_off_all') - prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) - else: - set_default_state() - control_prd_n.state = control_prd_n.STATE_MASHINE.INIT - mashine_timer.start() + print_debug('Выход из сцены') + #if not in_tree: + #mashine_timer.stop() + #signaller.emit_signal('interfer_off_all') + #prd_n_module.cmd_array.append([unit_prd_n.CmdCode.WRITE_ISA, [constants_n.ADDR_UG_LITERA_1, ug_work_1, constants_n.ADDR_UG_LITERA_2, ug_work_2]]) + #else: + #set_default_state() + #control_prd_n.state = control_prd_n.STATE_MASHINE.INIT + #mashine_timer.start() func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: diff --git a/scenes/pribor-prd-v/pribor-prd-v.gd b/scenes/pribor-prd-v/pribor-prd-v.gd index a40768a..1b99101 100644 --- a/scenes/pribor-prd-v/pribor-prd-v.gd +++ b/scenes/pribor-prd-v/pribor-prd-v.gd @@ -79,7 +79,10 @@ func on_state_mashine() -> void: func _ready() -> void: if Engine.is_editor_hint(): return + print_debug('В сцене ПРД-В!') + +func start_control() -> void: initialize_connections() setup_timer() set_default_state() @@ -142,7 +145,7 @@ func _enter_tree() -> void: func _exit_tree() -> void: if Engine.is_editor_hint(): return - prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) + #prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) func on_line_changed(unit_pribor: Object) -> void: @@ -151,14 +154,15 @@ func on_line_changed(unit_pribor: Object) -> void: func on_mode_changed(in_tree: bool) -> void: - if not in_tree: - mashine_timer.stop() - prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) - signaller.emit_signal('interfer_off_all') - else: - set_default_state() - control_prd_v.state = control_prd_v.STATE_MASHINE.INIT - mashine_timer.start() + print_debug('Выход из сцены') + #if not in_tree: + #mashine_timer.stop() + #prd_v_module.cmd_array.append([unit_prd_v.CmdCode.WRITE_ISA, [constants_v.ADDR_UG_LITERA_1, ug_work_1, constants_v.ADDR_UG_LITERA_2, ug_work_2]]) + #signaller.emit_signal('interfer_off_all') + #else: + #set_default_state() + #control_prd_v.state = control_prd_v.STATE_MASHINE.INIT + #mashine_timer.start() func power_fill(pow_dic: Dictionary, fs_result: Dictionary) -> void: diff --git a/scenes/tabs-switch/lbl_ready.gd b/scenes/tabs-switch/lbl_ready.gd index f35d4ed..f421ae1 100644 --- a/scenes/tabs-switch/lbl_ready.gd +++ b/scenes/tabs-switch/lbl_ready.gd @@ -3,7 +3,7 @@ extends Label const STATUS_GOOD := {"text": "Исправно", "color": Color.GREEN, "font_color": Color.BLACK} const STATUS_BAD := {"text": "Отказ", "color": Color.RED, "font_color": Color.WHITE} var _is_uf_status_initialized: bool = false -var is_prd_operational: bool = true +var is_prd_operational: bool = false # true var is_uf_operational: bool = false @@ -11,24 +11,45 @@ func _ready() -> void: tooltip_text = 'Нет связи с приборами комплекса' for prd_module in prd.prd_dict.values(): prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module)) - var unit_uf: = network.get_unit_instance('уарэп-эмс') + var unit_uf = network.get_unit_instance('уарэп-эмс') unit_uf.connect('data_received', Callable(self, 'on_uf_status_receive')) add_theme_color_override("font_color", Color.BLACK) - -func on_serviceability_changed(unit_prd_module: Object) -> void: +#func on_serviceability_changed(unit_prd_module: Object) -> void: +func on_serviceability_changed() -> void: var check_service: bool = true for prd_module in prd.prd_dict.values(): if prd_module.unit_yau07.online: - if not unit_prd_module.serviceability: + #if not unit_prd_module.serviceability: + if not prd_module.serviceability: check_service = false if check_service != is_prd_operational: is_prd_operational = check_service _update_serviceability_display() +## Обработчики кнопок +#func _on_button_test_on() -> void: + #print("[TEST] Оба исправны") + #is_prd_operational = true + #is_uf_operational = true + #_update_serviceability_display() +# +#func _on_button_test_off() -> void: + #print("[TEST] Оба неисправны") + #is_prd_operational = false + #is_uf_operational = false + #_update_serviceability_display() +# +#func _on_button_test_mix() -> void: + #is_prd_operational = !is_prd_operational + #is_uf_operational = !is_uf_operational + #print("[TEST] Смешанный режим → UF:", is_uf_operational, "PRD:", is_prd_operational) + #_update_serviceability_display() + + func _update_serviceability_display() -> void: - var status := STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD + var status = STATUS_GOOD if (is_uf_operational and is_prd_operational) else STATUS_BAD text = status.text modulate = status.color tooltip_text = 'Результаты обобщенного признака работоспособности изделия' @@ -36,9 +57,9 @@ func _update_serviceability_display() -> void: func on_uf_status_receive(unit_uf: Object) -> void: - var KEMS_B = ((unit_uf.status[0] >> 0) & 1) and ((unit_uf.status[0] >> 3) & 1) - var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) and ((unit_uf.status[0] >> 4) & 1) - var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) and ((unit_uf.status[0] >> 5) & 1) + var KEMS_B = ((unit_uf.status[0] >> 0) & 1) & ((unit_uf.status[0] >> 3) & 1) + var EMS_B_1 = ((unit_uf.status[0] >> 1) & 1) & ((unit_uf.status[0] >> 4) & 1) + var EMS_B_2 = ((unit_uf.status[0] >> 2) & 1) & ((unit_uf.status[0] >> 5) & 1) var IP27B = ((unit_uf.status[2] >> 6) & 1) var check_service: bool = KEMS_B and EMS_B_1 and EMS_B_2 and IP27B if not _is_uf_status_initialized or check_service != is_uf_operational: diff --git a/scenes/tabs-switch/tab-switch.tscn b/scenes/tabs-switch/tab-switch.tscn index a148f04..87d344d 100644 --- a/scenes/tabs-switch/tab-switch.tscn +++ b/scenes/tabs-switch/tab-switch.tscn @@ -81,7 +81,7 @@ metadata/_tab_index = 5 [node name="lbl_ready" type="Label" parent="."] layout_mode = 0 -offset_left = 1503.0 +offset_left = 1504.0 offset_right = 1600.0 offset_bottom = 27.0 tooltip_text = "Готовность аппаратуры к работе" @@ -96,8 +96,8 @@ metadata/_edit_lock_ = true [node name="remote_control" type="Label" parent="."] layout_mode = 2 -offset_left = 1244.0 -offset_right = 1401.0 +offset_left = 1242.0 +offset_right = 1402.0 offset_bottom = 27.0 tooltip_text = "Комплекс находится под внешним управлением" mouse_filter = 0 @@ -106,10 +106,11 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_o1r22") text = "Внешнее управление" horizontal_alignment = 1 vertical_alignment = 1 +metadata/_edit_lock_ = true [node name="тренаж_режим" type="Button" parent="."] layout_mode = 0 -offset_left = 1404.0 +offset_left = 1405.0 offset_right = 1501.0 offset_bottom = 27.0 tooltip_text = "Задействовать режим Тренаж" @@ -124,6 +125,37 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_imu1q") toggle_mode = true text = "Тренаж" script = ExtResource("9_41d34") +metadata/_edit_lock_ = true + +[node name="buttontest" type="Button" parent="."] +visible = false +layout_mode = 0 +offset_left = 1408.0 +offset_top = 64.0 +offset_right = 1456.0 +offset_bottom = 88.0 +text = "mix" + +[node name="buttonteston" type="Button" parent="."] +visible = false +layout_mode = 0 +offset_left = 1472.0 +offset_top = 64.0 +offset_right = 1520.0 +offset_bottom = 88.0 +text = "on" + +[node name="buttontestoff" type="Button" parent="."] +visible = false +layout_mode = 0 +offset_left = 1536.0 +offset_top = 64.0 +offset_right = 1584.0 +offset_bottom = 88.0 +text = "off" [connection signal="tab_changed" from="tab_switch" to="tab_switch" method="_on_tab_changed"] [connection signal="toggled" from="тренаж_режим" to="tab_switch" method="_on_button_trenaj_toggled"] +[connection signal="pressed" from="buttontest" to="lbl_ready" method="_on_button_test_mix"] +[connection signal="pressed" from="buttonteston" to="lbl_ready" method="_on_button_test_on"] +[connection signal="pressed" from="buttontestoff" to="lbl_ready" method="_on_button_test_off"] diff --git a/scenes/tilemap/23900.png b/scenes/tilemap/23900.png index b7ca1d1..f8e3ab0 100644 Binary files a/scenes/tilemap/23900.png and b/scenes/tilemap/23900.png differ diff --git a/scenes/tilemap/ship_mark.tscn b/scenes/tilemap/ship_mark.tscn index 888ea82..fbf2558 100644 --- a/scenes/tilemap/ship_mark.tscn +++ b/scenes/tilemap/ship_mark.tscn @@ -3,6 +3,5 @@ [ext_resource type="Texture2D" uid="uid://cj1f2uy6qfvki" path="res://scenes/tilemap/23900.png" id="1_v0nwa"] [node name="23900" type="Sprite2D"] -rotation = 4.71239 scale = Vector2(0.496934, 0.496934) texture = ExtResource("1_v0nwa") diff --git a/scenes/tilemap/tilemap.gd b/scenes/tilemap/tilemap.gd index c638dfe..e970981 100644 --- a/scenes/tilemap/tilemap.gd +++ b/scenes/tilemap/tilemap.gd @@ -367,13 +367,13 @@ func _process(delta) -> void: _queue.erase(tile.i) req.request_completed.connect(_response.bind(req, tile)) - + if req.request(tile.url) != OK: tile.t = now remove_child(req) req.queue_free() _req_count -= 1 - push_error('запрос \"%s\" не отправлен' % tile.url) + if _queue.is_empty(): emit_signal('load_completed') @@ -717,7 +717,7 @@ func set_coordinates(lon: float, lat: float, course: float) -> void: add_mark_from_lon_lat(ship_id, lon, lat, ship_instance, 0.0) else: _marks[ship_id].position = lonlat_to_world(lon, lat) - ship_instance.rotation_degrees = fmod(270.0 + course, 360.0) + ship_instance.rotation_degrees = fmod(course, 360.0) queue_redraw() diff --git a/scenes/контроль/кнопка-прибора.gd b/scenes/контроль/кнопка-прибора.gd index b6adb74..837c5c1 100644 --- a/scenes/контроль/кнопка-прибора.gd +++ b/scenes/контроль/кнопка-прибора.gd @@ -1,16 +1,85 @@ @tool - extends TextureButton +@onready var tween: Tween @export var state_colors: Array -func _on_toggled(toggled_on): $frame.visible = toggled_on -func _enter_tree() -> void: $label.self_modulate = state_colors[state] + +func _ready(): + toggle_mode = true + focus_mode = Control.FOCUS_ALL + connect("focus_entered", _on_focus_entered) + connect("focus_exited", _on_focus_exited) + + +func _enter_tree() -> void: + if has_node("label"): + $label.self_modulate = state_colors[state] + + +func update_progress_bar(target_value) -> void: + if tween: + tween.kill() + tween = create_tween() + tween.tween_property($control_progress, "value", target_value, 0.3) + + +func _on_toggled(toggled_on): + if has_node("frame"): + $frame.visible = toggled_on + + +func _on_focus_entered(): + button_pressed = true + #enter_press() TODO: Пока что без выбора прибора + + +func _on_focus_exited(): + pass + + +func enter_press(): + var enter_event = InputEventAction.new() + enter_event.action = "ui_accept" + enter_event.pressed = true + Input.parse_input_event(enter_event) @export var state: int: set(v): v = 0 if v < 0 else v % state_colors.size() state = v - if is_inside_tree(): + if is_inside_tree() and has_node("label"): $label.self_modulate = state_colors[v] + + +@export var progress_value: float = 0.0: + set(v): + progress_value = v + + if is_inside_tree(): + update_progress_bar(v) + var max_val = $control_progress.get('max_value') + var percentage = (v / max_val) * 100.0 + $control_progress.tooltip_text = 'Процесс контроля %01d%%' % percentage + + +@export var progress_visible: bool: + set(v): + progress_visible = v + if is_inside_tree(): + $control_progress.visible = v + + +@export var progress_max_value: int: + set(v): + progress_max_value = v + if is_inside_tree(): + $control_progress.max_value = v + + +@export var progress_min_value: int: + set(v): + progress_min_value = v + if is_inside_tree(): + $control_progress.min_value = v diff --git a/scenes/контроль/контроль.tscn b/scenes/контроль/контроль.tscn index 10e7779..c60a618 100644 --- a/scenes/контроль/контроль.tscn +++ b/scenes/контроль/контроль.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=18 format=3 uid="uid://lwmw4egynmd1"] +[gd_scene load_steps=20 format=3 uid="uid://lwmw4egynmd1"] [ext_resource type="Texture2D" uid="uid://bar8k5qef7kch" path="res://data/УФ.png" id="2_0nvm1"] [ext_resource type="Script" uid="uid://q3gmpsqspjfp" path="res://scenes/контроль/внешний.gd" id="2_8r80x"] @@ -14,6 +14,8 @@ [ext_resource type="Texture2D" uid="uid://dnreyfh3cd1k2" path="res://data/состояние-исправности-1.png" id="8_isjua"] [ext_resource type="Texture2D" uid="uid://b4isaggma6q3" path="res://data/Грани22.png" id="9_iqgf5"] [ext_resource type="Texture2D" uid="uid://c6booa8753u5t" path="res://data/состояние-исправности-2.png" id="9_ll0vs"] +[ext_resource type="Texture2D" uid="uid://00871pb6moln" path="res://data/прогресс-фон-1.png" id="9_w6m6a"] +[ext_resource type="Texture2D" uid="uid://c1k856fxhrjnh" path="res://data/прогресс-заполнение-1.png" id="10_lbx5w"] [ext_resource type="Script" uid="uid://bncy1x53jp73d" path="res://scenes/контроль/connect_pribor.gd" id="11_u7tym"] [sub_resource type="GDScript" id="GDScript_iqgf5"] @@ -84,6 +86,8 @@ func _ready(): if prd.prd_dict.has(item): var prd_module = prd.prd_dict[item] prd_module.connect('update_serviceability', Callable(self, 'on_serviceability_changed').bind(prd_module, pribor_node)) + prd_module.unit_control.connect('update_progress', Callable(self, 'on_update_progress').bind(pribor_node)) + prd_module.unit_control.connect('update_max_value_progress', Callable(self, 'on_update_max_value_progress').bind(pribor_node)) if item == 'уарэп-эмс': signaller.connect('update_uf_serviceability', Callable(self, 'on_update_uf_serviceability').bind(pribor_node)) # Пиктограммы приборов, которые отображают состояние подключения только @@ -143,8 +147,20 @@ func on_serviceability_changed(prd_module: Object, prd_pribor:Node)-> void: func on_update_uf_serviceability(uf_serviceaability: bool, uf_pribor: Node)-> void: - uf_pribor.state = 1 if uf_serviceaability else 2 + + +func _on_control_prd_pressed() -> void: + signaller.emit_signal('start_contol_device') + + +func on_update_progress(value_progress: float, pribor_node: Node) -> void: + pribor_node.progress_value = value_progress + pribor_node.progress_visible = value_progress > 0 + + +func on_update_max_value_progress(max_value_progress: int, pribor_node: Node) -> void: + pribor_node.progress_max_value = max_value_progress " [sub_resource type="SpriteFrames" id="SpriteFrames_foasq"] @@ -348,9 +364,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1048.0 -offset_top = 193.0 +offset_top = 179.0 offset_right = 1125.0 -offset_bottom = 309.0 +offset_bottom = 295.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -366,9 +382,9 @@ metadata/unit_name = ["уарэп-яу07-1н"] [node name="label" type="Label" parent="pribor_prd_n_1"] layout_mode = 0 offset_left = 8.0 -offset_top = -38.0 +offset_top = -40.0 offset_right = 60.0 -offset_bottom = -19.0 +offset_bottom = -21.0 text = "ПРД Н1" horizontal_alignment = 1 vertical_alignment = 1 @@ -396,13 +412,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_1"] +visible = false +layout_mode = 0 +offset_left = -4.0 +offset_top = 124.0 +offset_right = 89.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_uf" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1183.0 -offset_top = 565.0 +offset_top = 558.0 offset_right = 1294.0 -offset_bottom = 750.0 +offset_bottom = 743.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -419,9 +458,9 @@ metadata/online_proc = "on_line_changed" self_modulate = Color(0, 1, 0, 1) layout_mode = 0 offset_left = 15.0 -offset_top = -34.0 +offset_top = -44.0 offset_right = 91.0 -offset_bottom = -15.0 +offset_bottom = -25.0 text = "УФ" horizontal_alignment = 1 vertical_alignment = 1 @@ -453,9 +492,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1058.0 -offset_top = 595.0 +offset_top = 588.0 offset_right = 1164.0 -offset_bottom = 751.0 +offset_bottom = 744.0 pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 size_flags_vertical = 15 @@ -470,10 +509,10 @@ metadata/online_proc = "online_change_arr" [node name="label" type="Label" parent="pribor_rtr"] layout_mode = 0 -offset_left = 12.0 -offset_top = -54.0 -offset_right = 95.0 -offset_bottom = -35.0 +offset_left = 11.0 +offset_top = -49.0 +offset_right = 94.0 +offset_bottom = -30.0 text = "РТР" horizontal_alignment = 1 vertical_alignment = 1 @@ -493,19 +532,9 @@ patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="label2" type="Label" parent="pribor_rtr"] -layout_mode = 0 -offset_left = 12.0 -offset_top = -54.0 -offset_right = 95.0 -offset_bottom = -35.0 -text = "РТР" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_rtr"] light_mask = 3 -position = Vector2(55, -15) +position = Vector2(53, -15) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 @@ -515,9 +544,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1053.0 -offset_top = 432.0 +offset_top = 425.0 offset_right = 1886.0 -offset_bottom = 1072.0 +offset_bottom = 1065.0 scale = Vector2(0.2, 0.2) pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 @@ -533,9 +562,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_afsp_1"] layout_mode = 0 -offset_left = 165.0 +offset_left = 175.0 offset_top = -245.0 -offset_right = 262.0 +offset_right = 272.0 offset_bottom = -225.0 scale = Vector2(5, 5) text = "АФСП 1" @@ -558,17 +587,6 @@ patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="label2" type="Label" parent="pribor_afsp_1"] -layout_mode = 0 -offset_left = 165.0 -offset_top = -245.0 -offset_right = 262.0 -offset_bottom = -225.0 -scale = Vector2(5, 5) -text = "АФСП 1" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_1"] light_mask = 3 position = Vector2(415, -40) @@ -581,9 +599,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1243.0 -offset_top = 432.0 +offset_top = 425.0 offset_right = 2076.0 -offset_bottom = 1072.0 +offset_bottom = 1065.0 scale = Vector2(0.2, 0.2) pivot_offset = Vector2(-10, -65) size_flags_horizontal = 15 @@ -600,9 +618,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_afsp_2"] layout_mode = 0 -offset_left = 200.0 +offset_left = 175.0 offset_top = -240.0 -offset_right = 297.0 +offset_right = 272.0 offset_bottom = -220.0 scale = Vector2(5, 5) text = "АФСП 2" @@ -625,20 +643,9 @@ patch_margin_top = 16 patch_margin_right = 16 patch_margin_bottom = 16 -[node name="label2" type="Label" parent="pribor_afsp_2"] -layout_mode = 0 -offset_left = 200.0 -offset_top = -240.0 -offset_right = 297.0 -offset_bottom = -220.0 -scale = Vector2(5, 5) -text = "АФСП 2" -horizontal_alignment = 1 -vertical_alignment = 1 - [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_afsp_2"] light_mask = 3 -position = Vector2(425, -40) +position = Vector2(415, -40) scale = Vector2(3, 3) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 @@ -648,9 +655,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1313.0 -offset_top = 565.0 +offset_top = 558.0 offset_right = 1407.0 -offset_bottom = 751.0 +offset_bottom = 744.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -665,9 +672,9 @@ metadata/online_proc = "online_change_arr" [node name="label" type="Label" parent="pribor_uyep"] layout_mode = 0 offset_left = 26.8566 -offset_top = -38.3276 +offset_top = -43.3276 offset_right = 66.8566 -offset_bottom = -19.3276 +offset_bottom = -24.3276 text = "У-ЭП" horizontal_alignment = 1 vertical_alignment = 1 @@ -699,9 +706,9 @@ script = ExtResource("11_u7tym") editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1440.0 -offset_top = 680.0 +offset_top = 687.0 offset_right = 1517.0 -offset_bottom = 796.0 +offset_bottom = 803.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -716,10 +723,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_2"] layout_mode = 0 -offset_left = 14.0 -offset_top = -38.0 -offset_right = 66.0 -offset_bottom = -19.0 +offset_left = 11.0 +offset_top = -42.0 +offset_right = 63.0 +offset_bottom = -23.0 text = "ПРД В2" horizontal_alignment = 1 vertical_alignment = 1 @@ -741,19 +748,42 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_v_2"] light_mask = 3 -position = Vector2(40, -10) +position = Vector2(37, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_2"] +visible = false +layout_mode = 0 +offset_left = -4.0 +offset_top = 124.0 +offset_right = 89.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_n_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1440.0 -offset_top = 345.0 +offset_top = 322.0 offset_right = 1517.0 -offset_bottom = 461.0 +offset_bottom = 438.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -768,10 +798,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_2"] layout_mode = 0 -offset_left = 15.0 -offset_top = -38.0 -offset_right = 67.0 -offset_bottom = -19.0 +offset_left = 11.0 +offset_top = -42.0 +offset_right = 63.0 +offset_bottom = -23.0 theme_override_colors/font_outline_color = Color(0, 0, 0, 1) theme_override_constants/outline_size = 0 text = "ПРД Н2" @@ -795,19 +825,42 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_n_2"] light_mask = 3 -position = Vector2(40, -10) +position = Vector2(37, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_2"] +visible = false +layout_mode = 0 +offset_left = -4.0 +offset_top = 124.0 +offset_right = 89.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_k_2" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1440.0 -offset_top = 515.0 +offset_top = 504.0 offset_right = 1517.0 -offset_bottom = 631.0 +offset_bottom = 620.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -822,10 +875,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_2"] layout_mode = 0 -offset_left = 17.0 -offset_top = -38.0 -offset_right = 69.0 -offset_bottom = -19.0 +offset_left = 11.0 +offset_top = -42.0 +offset_right = 63.0 +offset_bottom = -23.0 text = "ПРД К2" horizontal_alignment = 1 vertical_alignment = 1 @@ -847,19 +900,42 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_k_2"] light_mask = 3 -position = Vector2(43, -10) +position = Vector2(37, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_2"] +visible = false +layout_mode = 0 +offset_left = -4.0 +offset_top = 124.0 +offset_right = 89.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_v_3" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1048.0 -offset_top = 802.0 +offset_top = 803.0 offset_right = 1125.0 -offset_bottom = 918.0 +offset_bottom = 919.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -875,9 +951,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_3"] layout_mode = 0 offset_left = 9.0 -offset_top = -38.0 +offset_top = -41.0 offset_right = 61.0 -offset_bottom = -19.0 +offset_bottom = -22.0 text = "ПРД В3" horizontal_alignment = 1 vertical_alignment = 1 @@ -899,19 +975,42 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_v_3"] light_mask = 3 -position = Vector2(34, -10) +position = Vector2(35, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_3"] +visible = false +layout_mode = 0 +offset_left = -8.0 +offset_top = 124.0 +offset_right = 85.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_n_3" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1323.0 -offset_top = 802.0 +offset_top = 803.0 offset_right = 1400.0 -offset_bottom = 918.0 +offset_bottom = 919.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -927,9 +1026,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_3"] layout_mode = 0 offset_left = 8.0 -offset_top = -38.0 +offset_top = -43.0 offset_right = 60.0 -offset_bottom = -19.0 +offset_bottom = -24.0 text = "ПРД Н3" horizontal_alignment = 1 vertical_alignment = 1 @@ -957,13 +1056,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_3"] +visible = false +layout_mode = 0 +offset_left = -7.0 +offset_top = 124.0 +offset_right = 86.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_k_3" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1188.0 -offset_top = 802.0 +offset_top = 803.0 offset_right = 1265.0 -offset_bottom = 918.0 +offset_bottom = 919.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -979,9 +1101,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_3"] layout_mode = 0 offset_left = 9.0 -offset_top = -38.0 +offset_top = -42.0 offset_right = 61.0 -offset_bottom = -19.0 +offset_bottom = -23.0 text = "ПРД К3" horizontal_alignment = 1 vertical_alignment = 1 @@ -1009,13 +1131,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_3"] +visible = false +layout_mode = 0 +offset_left = -8.0 +offset_top = 124.0 +offset_right = 85.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_v_1" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1328.0 -offset_top = 198.0 +offset_top = 179.0 offset_right = 1405.0 -offset_bottom = 314.0 +offset_bottom = 295.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1031,9 +1176,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_1"] layout_mode = 0 offset_left = 8.0 -offset_top = -38.0 +offset_top = -44.0 offset_right = 60.0 -offset_bottom = -19.0 +offset_bottom = -25.0 text = "ПРД В1" horizontal_alignment = 1 vertical_alignment = 1 @@ -1061,13 +1206,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_1"] +visible = false +layout_mode = 0 +offset_left = -4.0 +offset_top = 124.0 +offset_right = 89.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_k_1" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 1183.0 -offset_top = 193.0 +offset_top = 179.0 offset_right = 1260.0 -offset_bottom = 309.0 +offset_bottom = 295.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1083,9 +1251,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_1"] layout_mode = 0 offset_left = 9.0 -offset_top = -38.0 +offset_top = -44.0 offset_right = 61.0 -offset_bottom = -19.0 +offset_bottom = -25.0 text = "ПРД К1" horizontal_alignment = 1 vertical_alignment = 1 @@ -1113,13 +1281,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_1"] +visible = false +layout_mode = 0 +offset_left = -4.0 +offset_top = 124.0 +offset_right = 89.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_v_4" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 -offset_left = 946.0 -offset_top = 345.0 -offset_right = 1023.0 -offset_bottom = 461.0 +offset_left = 940.0 +offset_top = 322.0 +offset_right = 1017.0 +offset_bottom = 438.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1133,10 +1324,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_v_4"] layout_mode = 0 -offset_left = 17.0 -offset_top = -38.0 -offset_right = 69.0 -offset_bottom = -19.0 +offset_left = 15.0 +offset_top = -41.0 +offset_right = 67.0 +offset_bottom = -22.0 text = "ПРД В4" horizontal_alignment = 1 vertical_alignment = 1 @@ -1164,13 +1355,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_v_4"] +visible = false +layout_mode = 0 +offset_left = -6.0 +offset_top = 124.0 +offset_right = 87.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_n_4" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 offset_left = 941.0 -offset_top = 685.0 +offset_top = 687.0 offset_right = 1018.0 -offset_bottom = 801.0 +offset_bottom = 803.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1185,9 +1399,9 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_n_4"] layout_mode = 0 offset_left = 14.0 -offset_top = -38.0 +offset_top = -41.0 offset_right = 66.0 -offset_bottom = -19.0 +offset_bottom = -22.0 text = "ПРД Н4" horizontal_alignment = 1 vertical_alignment = 1 @@ -1215,13 +1429,36 @@ sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_n_4"] +visible = false +layout_mode = 0 +offset_left = -8.0 +offset_top = 124.0 +offset_right = 85.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="pribor_prd_k_4" type="TextureButton" parent="." groups=["pribor_buttons"]] editor_description = "Кнопка для выбора прибора." layout_mode = 0 -offset_left = 946.0 -offset_top = 515.0 -offset_right = 1023.0 -offset_bottom = 631.0 +offset_left = 941.0 +offset_top = 504.0 +offset_right = 1018.0 +offset_bottom = 620.0 size_flags_horizontal = 15 size_flags_vertical = 15 toggle_mode = true @@ -1235,10 +1472,10 @@ metadata/online_proc = "on_line_changed" [node name="label" type="Label" parent="pribor_prd_k_4"] layout_mode = 0 -offset_left = 17.0 -offset_top = -38.0 -offset_right = 69.0 -offset_bottom = -19.0 +offset_left = 14.0 +offset_top = -40.0 +offset_right = 66.0 +offset_bottom = -21.0 text = "ПРД К4" horizontal_alignment = 1 vertical_alignment = 1 @@ -1260,12 +1497,35 @@ patch_margin_bottom = 16 [node name="connect_pribor" type="AnimatedSprite2D" parent="pribor_prd_k_4"] light_mask = 3 -position = Vector2(42, -10) +position = Vector2(39, -10) scale = Vector2(0.625, 0.625) sprite_frames = SubResource("SpriteFrames_foasq") frame_progress = 0.72355 script = ExtResource("11_u7tym") +[node name="control_progress" type="TextureProgressBar" parent="pribor_prd_k_4"] +visible = false +layout_mode = 0 +offset_left = -8.0 +offset_top = 124.0 +offset_right = 85.0 +offset_bottom = 134.0 +size_flags_horizontal = 3 +size_flags_vertical = 3 +tooltip_text = " +Текущее: 0.00" +mouse_filter = 0 +max_value = 30.0 +nine_patch_stretch = true +stretch_margin_left = 5 +stretch_margin_top = 5 +stretch_margin_right = 5 +stretch_margin_bottom = 5 +texture_under = ExtResource("9_w6m6a") +texture_progress = ExtResource("10_lbx5w") +tint_under = Color(1, 1, 1, 0.419608) +tint_progress = Color(0.890196, 0.486275, 0.196078, 1) + [node name="txr_legend0" type="TextureRect" parent="."] layout_mode = 0 offset_left = 219.0 @@ -1387,6 +1647,15 @@ points = PackedVector2Array(-8, 0, 608, 0) width = 2.0 default_color = Color(1, 1, 1, 0.352941) +[node name="control_prd" type="Button" parent="."] +layout_mode = 0 +offset_left = 1101.0 +offset_top = 64.0 +offset_right = 1326.0 +offset_bottom = 104.0 +focus_mode = 0 +text = "Запуск контроля" + [connection signal="toggled" from="pribor_prd_n_1" to="pribor_prd_n_1" method="_on_toggled"] [connection signal="toggled" from="pribor_uf" to="pribor_uf" method="_on_toggled"] [connection signal="toggled" from="pribor_rtr" to="pribor_rtr" method="_on_toggled"] @@ -1404,3 +1673,4 @@ default_color = Color(1, 1, 1, 0.352941) [connection signal="toggled" from="pribor_prd_v_4" to="pribor_prd_v_4" method="_on_toggled"] [connection signal="toggled" from="pribor_prd_n_4" to="pribor_prd_n_4" method="_on_toggled"] [connection signal="toggled" from="pribor_prd_k_4" to="pribor_prd_k_4" method="_on_toggled"] +[connection signal="pressed" from="control_prd" to="." method="_on_control_prd_pressed"] diff --git a/scenes/эмс2/эмс_тг.gd b/scenes/эмс2/эмс_тг.gd index 242bda1..7919eaf 100644 --- a/scenes/эмс2/эмс_тг.gd +++ b/scenes/эмс2/эмс_тг.gd @@ -29,7 +29,7 @@ func on_trassa_line_changed(unit_trassa): $"СкруглённыйПрямоугольникБелый/Label10".text = '-' -func on_sector_klaster(data, unit_trassa): +func on_sector_klaster(_data, unit_trassa): $"СкруглённыйПрямоугольникБелый/Label6".text = str(unit_trassa.dap) $"СкруглённыйПрямоугольникБелый/Label7".text = str(unit_trassa.daa) $"СкруглённыйПрямоугольникБелый/Label8".text = '1' diff --git a/scripts/prd.gd b/scripts/prd.gd index 46c8e08..7eddaac 100644 --- a/scripts/prd.gd +++ b/scripts/prd.gd @@ -153,6 +153,7 @@ class Fs: class PRD: var prd_name: String ## Имя прибора var unit_yau07 ## Юнит эмс + var unit_control: Object ## Класс проверки прибора ПРД var fs_dic: Dictionary ## Массив блоков ФС var yemsg_board: yemsboards.EmsBoard ## Плата ЭМС-Г var state = PrdState.WORK @@ -162,11 +163,13 @@ class PRD: var set_ug_state: bool = true ## Необходимо ли записать в УГ настройки signal update_serviceability() - func _init(u_name, u_yau07): + func _init(u_name, u_yau07, u_control: Object): prd_name = u_name unit_yau07 = u_yau07 + unit_control = u_control init_ems_g() + func init_ems_g(): var in_tbl: Array = [] var out_tbl: Array = [] @@ -281,7 +284,10 @@ func _ready() -> void: check_dir() for prd_name in PRD_NAMES: var unit_prd = network.get_unit_instance(prd_name) - var new_prd = PRD.new(prd_name, unit_prd) + var control_pribor_prd = preload('res://scripts/pribor-prd.gd') + var unit_control = control_pribor_prd.TestPRD.new({'unit_prd': unit_prd}) + add_child(unit_control) + var new_prd = PRD.new(prd_name, unit_prd, unit_control) prd_dict[prd_name] = new_prd for key in FS_PRD.keys(): var fs = Fs.new(key, FS_PRD[key][0]) diff --git a/scripts/pribor-prd.gd b/scripts/pribor-prd.gd index c717f50..74e97e4 100644 --- a/scripts/pribor-prd.gd +++ b/scripts/pribor-prd.gd @@ -1,4 +1,149 @@ class TestPRD extends Node: + const DEVICE_CONSTANT: Dictionary = { + 'PRD_N': { + CONSTANTS = { + 'POWER_UKP_1': 31, + 'POWER_UKP_2': 63, + 'DKM_BIT_2': 1, + 'DKM_BIT_3': 2, + 'BASE_ADDR_EMS_G': 0x120, + 'ADDR_UG_LITERA_1': 0x106, + 'ADDR_UG_LITERA_2': 0x108, + 'ADDR_UG_LITERA_3': 0x10A, + 'TEMP_THRESHOLD': 70, + 'POWER_THRESHOLD': 40, + 'RAY_DOU_NUM': 0x3, + 'ATT_UM_2': 0x2, + 'ATT_UM_3': 0x3, + 'POWER_UM': 100, + 'TIMER_DELAY': 10.0, + 'STATE_MASHINE_TIMER': 0.3, + }, + PRIBOR_CONFIG = { + '1н': {'angle': 0.0, 'sectors': [4, 8]}, + '2н': {'angle': 90.0, 'sectors': [7, 11]}, + '3н': {'angle': 180.0, 'sectors': [6, 10]}, + '4н': {'angle': 270.0, 'sectors': [5, 9]}, + }, + FS_PARAMS = { + 2: {'freq': 932.0, 'width': 100.0}, + 3: {'freq': 1157.0, 'width': 100.0} + }, + START_LITERA = 2 + }, + 'PRD_V': { + CONSTANTS = { + 'POWER_UKP_1': 31, + 'POWER_UKP_2': 63, + 'DKM_BIT_4': 3, + 'DKM_BIT_5': 4, + 'BASE_ADDR_EMS_G': 0x120, + 'ADDR_UG_LITERA_1': 0x106, + 'ADDR_UG_LITERA_2': 0x108, + 'ADDR_UG_LITERA_3': 0x10A, + 'TEMP_THRESHOLD': 70, + 'POWER_THRESHOLD': 40, + 'RAY_DOU_NUM': 0x3, + 'ATT_UM_4': 0x2, + 'ATT_UM_5': 0x3, + 'POWER_UM': 100, + 'TIMER_DELAY': 10.0, + 'STATE_MASHINE_TIMER': 0.3, + }, + PRIBOR_CONFIG = { + '1в': {'angle': 0.0, 'sectors': [12, 16]}, + '2в': {'angle': 90.0, 'sectors': [15, 19]}, + '3в': {'angle': 180.0, 'sectors': [14, 18]}, + '4в': {'angle': 270.0, 'sectors': [13, 17]}, + }, + FS_PARAMS = { + 4: {'freq': 1227.0, 'width': 100.0}, + 5: {'freq': 1575.0, 'width': 110.0}, + }, + START_LITERA = 4 + }, + 'PRD_K': { + CONSTANTS = { + 'POWER_UKP_1': 31, + 'POWER_UKP_2': 63, + 'DKM_BIT_1': 0, + 'DKM_BIT_6': 5, + 'DKM_BIT_7': 6, + 'BASE_ADDR_EMS_G': 0x120, + 'ADDR_UG_LITERA_1': 0x106, + 'ADDR_UG_LITERA_2': 0x108, + 'ADDR_UG_LITERA_3': 0x10A, + 'TEMP_THRESHOLD': 40, + 'POWER_THRESHOLD': 40, + 'RAY_DOU_NUM': 0x3, + 'ATT_UM_1': 0x0, + 'ATT_UM_6': 0x3, + 'ATT_UM_7': 0x2, + 'POWER_UM': 100, + 'TIMER_DELAY': 10.0, + 'STATE_MASHINE_TIMER': 0.3, + }, + PRIBOR_CONFIG = { # Конфигурация параметров для каждого прибора + '1к': {'angle': 0.0, 'sectors': [0, 20, 24]}, + '2к': {'angle': 90.0, 'sectors': [3, 23, 27]}, + '3к': {'angle': 180.0, 'sectors': [2, 22, 26]}, + '4к': {'angle': 270.0, 'sectors': [1, 21, 25]}, + }, + FS_PARAMS = { # Конфигурация частот и ширин для каждого ФС + 1: {'freq': 450.0, 'width': 80.0}, + 6: {'freq': 2450.0, 'width': 110.0}, + 7: {'freq': 4750.0, 'width': 110.0} + }, + START_LITERA = 1 + } + } + + var block_ip_config_n:= { + 'maa2000_1': [0, false], + 'maa2000_2': [1, false], + 'ip9_50_1': [2, false], + 'ip9_50_2': [3, false], + 'ip12_50_1': [4, false], + 'ip5_25': [7, false], + } + var block_kasseta_y5_prd_config_n: = { + 'yau07': false, + 'ems': false, + 'ug': false, + 'ukp1': false, + 'ukp2': false, + } + + # Результаты контроля + var control_results_n: Dictionary = { + 'block_ip': false, # Проверка касет П1 и ИП МА2000 + 'temperature': true, # Проверка температур УМ + 'dkm_2': false, + 'dkm_3': false, + 'dou_2': false, + 'dou_3': false, + 'fs_2': 2, + 'fs_3': 2, + } +#### + var block_ip_config_v := { + 'maa2000_1': [0, false], + 'maa2000_2': [1, false], + 'ip9_50_1': [2, false], + 'ip9_50_2': [3, false], + 'ip12_50_1': [4, false], + 'ip5_25': [7, false], + } + var block_kasseta_y5_prd_config_v: = { + 'yau07': false, + 'ems': false, + 'ug': false, + 'ukp1': false, + 'ukp2': false, + } + + #### + const RAY_m5:= 'RAY_m5' const RAY_5:= 'RAY_5' const RAY_15:= 'RAY_15' @@ -19,7 +164,7 @@ class TestPRD extends Node: TEMPERATURE_UKP_2 = 79, } - enum STATE_MASHINE { + enum STATE_MACHINE { INIT, FS_TURN_ON, FS_WORK, @@ -72,7 +217,7 @@ class TestPRD extends Node: var block_kasseta_y5_config: Dictionary var control_results: Dictionary var self_name: String - var state: int = STATE_MASHINE.INIT + var state: int = STATE_MACHINE.INIT var current_litera: int var flag_write_isa: bool = false var flag_fs_status_ok: bool = false @@ -81,31 +226,32 @@ class TestPRD extends Node: var unit_prd: Object var module_prd: Object var power_amplify: Array - var control_label: Label + #var control_label: Label var control_timer: Timer = Timer.new() var ems_6666_timer: Timer = Timer.new() - signal control_is_over(control_results, power_result) + var machine_timer: Timer = Timer.new() + signal control_is_over(control_results: Dictionary, power_result: Dictionary) + signal update_progress(progress_value: float) + signal update_max_value_progress(max_progress_value: int) + var cc: int = 0 + + var progress_value: float: + set(v): + if progress_value != v: + progress_value = v + call_deferred('emit_signal', 'update_progress', v) var ecms: Dictionary ## Словарь помеховых воздействий ## Инициализация аргуметнов func _init(init_data: Dictionary) -> void: - control_label = init_data['control_label'] - power_amplify = init_data['power_amplifiers'] unit_prd = init_data['unit_prd'] - module_prd = init_data['module_prd'] - constants = init_data['constants'] - pribor_config = init_data['prd_config'] - fs_parameters = init_data['fs_params'] - block_ip_config = init_data['block_ip_prd_config'] - block_kasseta_y5_config = init_data['block_kasseta_y5_prd_config'] - control_results = init_data['control_results'] - current_litera = init_data['current_litera'] func _ready() -> void: initialize_connections() + _determine_self_name() setup_timer() @@ -157,112 +303,117 @@ class TestPRD extends Node: fs_result = on_fs_state(packet_type_7, fs_mapping, fs_result) control_results[fs_key] = fs_result[fs_key] flag_fs_status_ok = control_results[fs_key] == 1 - - + ## func state_control_machine() -> void: match state: - STATE_MASHINE.INIT: + STATE_MACHINE.INIT: _handle_init_state() - STATE_MASHINE.FS_TURN_ON: + STATE_MACHINE.FS_TURN_ON: _handle_fs_turn_on_state() - state = STATE_MASHINE.FS_WORK - STATE_MASHINE.FS_WORK: + state = STATE_MACHINE.FS_WORK + STATE_MACHINE.FS_WORK: + for key in ecms.keys(): + pass + #print([fs_parameters, current_litera]) + #print('ecms: %s %s' % [ecms[key].kni, ecms[key].params.freq]) if ecms.size() and flag_fs_status_ok: ems_6666_timer.start() _handle_fs_work_state() - STATE_MASHINE.CHEK_KASSETA_Y5: + STATE_MACHINE.CHEK_KASSETA_Y5: if block_kasseta_y5_config['yau07']: - state = STATE_MASHINE.WRITE_ISA - STATE_MASHINE.WRITE_ISA: + state = STATE_MACHINE.WRITE_ISA + STATE_MACHINE.WRITE_ISA: if not flag_write_isa: _handle_ug_set_state(0x6) - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.READ_ISA: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.READ_ISA: if (unit_prd.cmd_state == unit_prd.CmdState.DONE) or (unit_prd.cmd_state == unit_prd.CmdState.FAIL): _handle_read_isa(module_prd, unit_prd, [constants.ADDR_UG_LITERA_1, constants.ADDR_UG_LITERA_2, constants.ADDR_UG_LITERA_3]) flag_write_isa = false - state = STATE_MASHINE.UG_SET_RAY - STATE_MASHINE.UG_SET_RAY: + state = STATE_MACHINE.UG_SET_RAY + STATE_MACHINE.UG_SET_RAY: var addr: int = constants.ADDR_UG_LITERA_1 if current_litera == 3 or current_litera == 5 or current_litera == 7: addr = constants.ADDR_UG_LITERA_2 if unit_prd.isa_ports.has(addr) and (unit_prd.cmd_state == unit_prd.CmdState.DONE): if unit_prd.isa_ports[addr] & 0x07 == 0: - state = STATE_MASHINE.UG_SET_RAY_1 + state = STATE_MACHINE.UG_SET_RAY_1 elif unit_prd.isa_ports[addr] & 0x07 == 1: - state = STATE_MASHINE.UG_SET_RAY_2 + state = STATE_MACHINE.UG_SET_RAY_2 elif unit_prd.isa_ports[addr] & 0x07 == 2: - state = STATE_MASHINE.UG_SET_RAY_3 + state = STATE_MACHINE.UG_SET_RAY_3 elif unit_prd.isa_ports[addr] & 0x07 == 3: - state = STATE_MASHINE.UG_SET_RAY_4 + state = STATE_MACHINE.UG_SET_RAY_4 elif unit_prd.isa_ports[addr] & 0x07 == 4: - state = STATE_MASHINE.UG_SET_RAY_5 + state = STATE_MACHINE.UG_SET_RAY_5 elif unit_prd.isa_ports[addr] & 0x07 == 5: if not current_litera == 1: control_results = check_dou_result(control_results, power_result, self_name, current_litera, constants) - state = STATE_MASHINE.IN_EMS_STOP + state = STATE_MACHINE.IN_EMS_STOP elif unit_prd.isa_ports[addr] & 0x07 == 6: - state = STATE_MASHINE.UG_SET_RAY_0 + state = STATE_MACHINE.UG_SET_RAY_0 - STATE_MASHINE.UG_SET_RAY_0: + STATE_MACHINE.UG_SET_RAY_0: if flag_si_fs_input and not flag_write_isa: control_timer.stop() _handle_ug_set_state(0x0) await get_tree().create_timer(0.5).timeout - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.UG_SET_RAY_1: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.UG_SET_RAY_1: if not flag_write_isa: _handle_ug_set_state(0x1) - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.UG_SET_RAY_2: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.UG_SET_RAY_2: if not flag_write_isa: _handle_ug_set_state(0x2) - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.UG_SET_RAY_3: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.UG_SET_RAY_3: if not flag_write_isa: _handle_ug_set_state(0x3) - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.UG_SET_RAY_4: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.UG_SET_RAY_4: if not flag_write_isa: _handle_ug_set_state(0x4) - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.UG_SET_RAY_5: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.UG_SET_RAY_5: if not flag_write_isa: _handle_ug_set_state(0x5) - state = STATE_MASHINE.READ_ISA - STATE_MASHINE.IN_EMS_STOP: + state = STATE_MACHINE.READ_ISA + STATE_MACHINE.IN_EMS_STOP: ems_6666_timer.stop() - state = STATE_MASHINE.FS_TURN_OFF - STATE_MASHINE.FS_TURN_OFF: + state = STATE_MACHINE.FS_TURN_OFF + STATE_MACHINE.FS_TURN_OFF: ems_6666_timer.stop() _handle_fs_turn_off_state() - state = STATE_MASHINE.STOP_CONTROL - STATE_MASHINE.STOP_CONTROL: + state = STATE_MACHINE.STOP_CONTROL + STATE_MACHINE.STOP_CONTROL: _handle_stop_control_state() + ## В машине состояний вызов изменения состояния контроля + progressbar_status() + ## 'Выполняется инициализация ФС-%s' % current_litera func _handle_init_state() -> void: - control_label.text = 'Выполняется инициализация ФС-%s' % current_litera if current_litera in [1, 2, 3, 4, 5, 6, 7]: if not ecms.size(): - state = STATE_MASHINE.FS_TURN_ON + state = STATE_MACHINE.FS_TURN_ON else: control_results = on_control_result(block_ip_config, control_results) var send_power_pack = prep_power(power_result, self_name) emit_signal('control_is_over', control_results, send_power_pack) - state = STATE_MASHINE.AWAIT + machine_timer.stop() + ##'Выполняется включение ФС-%s' % current_litera func _handle_fs_turn_on_state() -> void: - control_label.text = 'Выполняется включение ФС-%s' % current_litera manage_fs(true, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM) control_timer.wait_time = constants.TIMER_DELAY control_timer.start() + ##'Выполняется проверка ФС-%s' % current_litera func _handle_fs_work_state() -> void: - control_label.text = 'Выполняется проверка ФС-%s' % current_litera if (current_litera == 2 and control_results.fs_2) or \ (current_litera == 3 and control_results.fs_3) or \ (current_litera == 4 and control_results.fs_4) or \ @@ -270,7 +421,7 @@ class TestPRD extends Node: (current_litera == 6 and control_results.fs_6) or \ (current_litera == 7 and control_results.fs_7) or \ (current_litera == 1 and control_results.fs_1): - state = STATE_MASHINE.CHEK_KASSETA_Y5 + state = STATE_MACHINE.CHEK_KASSETA_Y5 func _handle_ug_set_state(RAY_DOU_NUM: int) -> void: @@ -293,28 +444,41 @@ class TestPRD extends Node: dic_att['ATT_UM_1'] = constants.ATT_UM_2 dic_att['ATT_UM_2'] = constants.ATT_UM_3 - var log_text = dic_att.ATT_UM_3 if current_litera == 1 else dic_att.ATT_UM_1 if current_litera in [2, 4, 6] else dic_att.ATT_UM_2 - control_label.text = 'Выполняется настройка угла (%s) и атт (0x0%s)' % [ - dic_att.RAY_DOU_NUM, - log_text - ] + ##var log_text = dic_att.ATT_UM_3 if current_litera == 1 else dic_att.ATT_UM_1 if current_litera in [2, 4, 6] else dic_att.ATT_UM_2 + ## 'Выполняется настройка угла (%s) и атт (0x0%s)' % [dic_att.RAY_DOU_NUM, log_text] flag_write_isa = on_ug_setting(module_prd, unit_prd, dic_att) + ## Таймер отправки команды в ЭМС-Г для модуляции func _on_ems_6666_timer() -> void: module_prd.cmd_array.append([unit_prd.CmdCode.WRITE_ISA, [constants.BASE_ADDR_EMS_G, 6666]]) + + + ## Таймер вызова машины состояний + func on_state_mashine(): + state_control_machine() + + + func progressbar_status() -> void: + match state: + STATE_MACHINE.INIT: + cc += 10 if current_litera in [3, 5, 6, 7] else 0 + if control_timer.get_time_left() > 0: + progress_value = cc + control_timer.get_wait_time() - control_timer.get_time_left() + if current_litera == 0: + progress_value = 0 + ##'Выполняется отключение ФС-%s' % current_litera func _handle_fs_turn_off_state() -> void: - control_label.text = 'Выполняется отключение ФС-%s' % current_litera flag_fs_status_ok = false manage_fs(false, self_name, pribor_config, fs_parameters, current_litera, constants.POWER_UM) + ##'Выполняется завершение проверки ФС-%s' % current_litera func _handle_stop_control_state() -> void: - control_label.text = 'Выполняется завершение проверки ФС-%s' % current_litera _advance_to_next_fs() - state = STATE_MASHINE.INIT + state = STATE_MACHINE.INIT func _advance_to_next_fs() -> void: @@ -330,33 +494,74 @@ class TestPRD extends Node: ###################################### func initialize_connections() -> void: - _determine_self_name() var fs_mapping = _create_fs_mapping(self_name) signaller.conn(signaller.fs_update_state, Callable(self, 'on_fs_update_state').bind(fs_mapping)) + signaller.conn(signaller.start_contol_device, Callable(self, '_on_start_contol_device')) interfer.connect('interfer_resized', Callable(self, 'on_interfer_resized')) unit_prd.connect('data_received', Callable(self, 'on_data_received')) func on_interfer_resized(ecms_dic: Dictionary) -> void: ecms = ecms_dic + + + func _on_start_contol_device()-> void: + _determine_self_name() + machine_timer.wait_time = constants.STATE_MASHINE_TIMER + machine_timer.start() func _determine_self_name() -> void: + cc = 0 + state = STATE_MACHINE.INIT var current_unit = unit_prd.name var parts = current_unit.split('-') self_name = parts[-1] + if self_name == '1н' or self_name == '2н' or self_name == '3н' or self_name == '4н': + progress_value = 0 + call_deferred('emit_signal', 'update_max_value_progress', 20) + constants = DEVICE_CONSTANT.PRD_N.CONSTANTS + pribor_config = DEVICE_CONSTANT.PRD_N.PRIBOR_CONFIG + fs_parameters = DEVICE_CONSTANT.PRD_N.FS_PARAMS + block_ip_config = block_ip_config_n + block_kasseta_y5_config = block_kasseta_y5_prd_config_n + control_results = control_results_n + current_litera = DEVICE_CONSTANT.PRD_N.START_LITERA + if self_name == '1в' or self_name == '2в' or self_name == '3в' or self_name == '4в': + progress_value = 0 + call_deferred('emit_signal', 'update_max_value_progress', 20) + constants = DEVICE_CONSTANT.PRD_V.CONSTANTS + pribor_config = DEVICE_CONSTANT.PRD_V.PRIBOR_CONFIG + fs_parameters = DEVICE_CONSTANT.PRD_V.FS_PARAMS + block_ip_config = block_ip_config_n + block_kasseta_y5_config = block_kasseta_y5_prd_config_v + control_results = control_results_n + current_litera = DEVICE_CONSTANT.PRD_V.START_LITERA + if self_name == '1к' or self_name == '2к' or self_name == '3к' or self_name == '4к': + progress_value = 0 + call_deferred('emit_signal', 'update_max_value_progress', 30) + constants = DEVICE_CONSTANT.PRD_K.CONSTANTS + pribor_config = DEVICE_CONSTANT.PRD_K.PRIBOR_CONFIG + fs_parameters = DEVICE_CONSTANT.PRD_K.FS_PARAMS + block_ip_config = block_ip_config_n + block_kasseta_y5_config = block_kasseta_y5_prd_config_n + control_results = control_results_n + current_litera = DEVICE_CONSTANT.PRD_K.START_LITERA func setup_timer() -> void: add_child(control_timer) control_timer.timeout.connect(on_stop_control) control_timer.one_shot = true - control_timer.wait_time = 15.0 - control_timer.start() + control_timer.wait_time = constants.TIMER_DELAY add_child(ems_6666_timer) ems_6666_timer.timeout.connect(_on_ems_6666_timer) ems_6666_timer.wait_time = 1.0 + + add_child(machine_timer) + machine_timer.connect('timeout', Callable(self, 'on_state_mashine')) + func _process_dkm_status(status: PackedByteArray) -> void: @@ -405,18 +610,18 @@ class TestPRD extends Node: static func _get_ray_key(machine_state: int) -> String: match machine_state: - STATE_MASHINE.UG_SET_RAY_0: return RAY_m5 - STATE_MASHINE.UG_SET_RAY_1: return RAY_5 - STATE_MASHINE.UG_SET_RAY_2: return RAY_15 - STATE_MASHINE.UG_SET_RAY_3: return RAY_25 - STATE_MASHINE.UG_SET_RAY_4: return RAY_35 - STATE_MASHINE.UG_SET_RAY_5: return RAY_45 + STATE_MACHINE.UG_SET_RAY_0: return RAY_m5 + STATE_MACHINE.UG_SET_RAY_1: return RAY_5 + STATE_MACHINE.UG_SET_RAY_2: return RAY_15 + STATE_MACHINE.UG_SET_RAY_3: return RAY_25 + STATE_MACHINE.UG_SET_RAY_4: return RAY_35 + STATE_MACHINE.UG_SET_RAY_5: return RAY_45 _: return '' func on_stop_control() -> void: _handle_fs_turn_off_state() - state = STATE_MASHINE.FS_TURN_OFF + state = STATE_MACHINE.FS_TURN_OFF static func on_control_result(ip_config: Dictionary, ctrl_results: Dictionary) -> Dictionary: @@ -536,6 +741,7 @@ class TestPRD extends Node: all_temp_is_ok = false return all_temp_is_ok + ## Проверка ДКМ static func check_dkm(status_prd: PackedByteArray, bit_dkm: int) -> bool: var dkm: int = 28 diff --git a/scripts/signaller.gd b/scripts/signaller.gd index e584cee..c036181 100644 --- a/scripts/signaller.gd +++ b/scripts/signaller.gd @@ -214,3 +214,7 @@ signal sector_klaster (new_sector_data) signal clear_klaster () + + +## Вызывается при нажатии на кнопку "Запуск контроля".[br] +signal start_contol_device()