доработка индикации
This commit is contained in:
1391
PRD2B03.tmp
Normal file
1391
PRD2B03.tmp
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=77 format=3 uid="uid://cvor2jm4xk3ha"]
|
||||
[gd_scene load_steps=76 format=3 uid="uid://cvor2jm4xk3ha"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/PRD.gd" id="1_v273n"]
|
||||
[ext_resource type="Texture2D" uid="uid://cdxdluvyb5uei" path="res://table/on.png" id="2_dv7xx"]
|
||||
@@ -133,7 +133,7 @@ size = Vector2(1600, 1200)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dgiai"]
|
||||
shader = ExtResource("4_uy5o2")
|
||||
shader_parameter/color_signal = Color(0.588235, 0.466667, 0, 1)
|
||||
shader_parameter/color_signal = Color(1, 1, 0, 1)
|
||||
shader_parameter/turn = 0.785
|
||||
shader_parameter/inner_radius = 0.32
|
||||
shader_parameter/speed = 0.0
|
||||
@@ -244,9 +244,6 @@ shader_parameter/color4 = Color(0, 0, 0, 0)
|
||||
shader_parameter/opacity = 0.218
|
||||
shader_parameter/turn = 0.785
|
||||
|
||||
[sub_resource type="Theme" id="Theme_yblys"]
|
||||
CheckBox/font_sizes/font_size = 14
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ei3d4"]
|
||||
bg_color = Color(0.362983, 0.685867, 0.396516, 1)
|
||||
corner_radius_top_left = 5
|
||||
@@ -469,9 +466,9 @@ stretch_mode = 0
|
||||
|
||||
[node name="notice" type="GridContainer" parent="Background"]
|
||||
layout_mode = 0
|
||||
offset_left = 1098.0
|
||||
offset_left = 986.0
|
||||
offset_top = 937.0
|
||||
offset_right = 1832.0
|
||||
offset_right = 1720.0
|
||||
offset_bottom = 1000.0
|
||||
columns = 3
|
||||
|
||||
@@ -711,6 +708,14 @@ theme_override_styles/normal = SubResource("StyleBoxFlat_eleyh")
|
||||
text = "Подключение"
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
[node name="status_yau" type="Label" parent="TabContainer/PRD"]
|
||||
layout_mode = 0
|
||||
offset_left = 56.0
|
||||
offset_top = 91.0
|
||||
offset_right = 111.0
|
||||
offset_bottom = 114.0
|
||||
text = "ЯУ-07Б"
|
||||
|
||||
[node name="ControlPanel" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
@@ -1351,15 +1356,6 @@ offset_right = 1102.0
|
||||
offset_bottom = 226.0
|
||||
text = "Темп"
|
||||
|
||||
[node name="save_other" type="CheckBox" parent="."]
|
||||
visible = false
|
||||
offset_left = 2.0
|
||||
offset_top = 799.0
|
||||
offset_right = 215.0
|
||||
offset_bottom = 827.0
|
||||
theme = SubResource("Theme_yblys")
|
||||
text = "Сохранить все настройки"
|
||||
|
||||
[node name="load_status_yau" type="ProgressBar" parent="."]
|
||||
offset_left = 490.0
|
||||
offset_top = 19.0
|
||||
@@ -1377,14 +1373,14 @@ metadata/_edit_lock_ = true
|
||||
[connection signal="pressed" from="Background/switch_panel/select_ems_g" to="." method="_on_emsg_select"]
|
||||
[connection signal="pressed" from="Background/switch_panel/select_fs" to="." method="_on_mfs_select"]
|
||||
[connection signal="pressed" from="Background/switch_panel/save_config" to="." method="_on_save_config"]
|
||||
[connection signal="pressed" from="Background/switch_panel/load_config" to="." method="_load_selected_file"]
|
||||
[connection signal="pressed" from="Background/switch_panel/load_config" to="." method="_on_load_config"]
|
||||
[connection signal="toggled" from="Background/switch_panel/burgerButton" to="." method="_on_burger_button"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_prd" to="." method="_on_prd_select"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_control" to="." method="_on_control_button"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_ems_g" to="." method="_on_emsg_select"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_fs" to="." method="_on_mfs_select"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_save_config" to="." method="_on_save_config"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_load_config" to="." method="_load_selected_file"]
|
||||
[connection signal="pressed" from="Background/switch_panel/texture_load_config" to="." method="_on_load_config"]
|
||||
[connection signal="pressed" from="TabContainer/PRD/Connect_prd" to="." method="_on_connect_prd_pressed"]
|
||||
[connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/con" to="TabContainer/Modul_fs" method="_on_start"]
|
||||
[connection signal="text_submitted" from="TabContainer/Modul_fs/manage_panel/addres_fs" to="TabContainer/Modul_fs" method="_on_addres_fs"]
|
||||
|
||||
@@ -9,7 +9,7 @@ custom_features=""
|
||||
export_filter="all_resources"
|
||||
include_filter=""
|
||||
exclude_filter=""
|
||||
export_path="./testPRD_2.0.exe"
|
||||
export_path="bin/testPRD.exe"
|
||||
encryption_include_filters=""
|
||||
encryption_exclude_filters=""
|
||||
encrypt_pck=false
|
||||
|
||||
52
icon.svg
52
icon.svg
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 949 B After Width: | Height: | Size: 12 KiB |
@@ -13,6 +13,7 @@ config_version=5
|
||||
config/name="ПРД_для_МП-550"
|
||||
run/main_scene="res://PRD_MP550.tscn"
|
||||
config/features=PackedStringArray("4.3", "GL Compatibility")
|
||||
boot_splash/bg_color=Color(0.356863, 0.278431, 0.356863, 1)
|
||||
config/icon="res://icon.svg"
|
||||
|
||||
[autoload]
|
||||
@@ -29,9 +30,9 @@ gdscript/warnings/unused_signal=0
|
||||
|
||||
[display]
|
||||
|
||||
window/size/viewport_width=1910
|
||||
window/size/viewport_width=1900
|
||||
window/size/viewport_height=1000
|
||||
window/size/initial_position_type=0
|
||||
window/size/extend_to_title=true
|
||||
|
||||
[editor]
|
||||
|
||||
|
||||
BIN
saves/fs_setting
BIN
saves/fs_setting
Binary file not shown.
@@ -1 +0,0 @@
|
||||
{"1":{"290":1,"292":0,"296":0,"298":32768},"2":{"290":2,"292":0,"296":0,"298":32768},"3":{"290":3,"292":0,"296":0,"298":32768},"4":{"290":4,"292":0,"296":0,"298":32768},"5":{"290":5,"292":0,"296":0,"298":32768},"6":{"290":6,"292":0,"296":0,"298":32768},"7":{"290":7,"292":0,"296":0,"298":32768},"8":{"290":8,"292":0,"296":0,"298":32768},"9":{"290":9,"292":0,"296":0,"298":32768},"10":{"290":10,"292":0,"296":0,"298":32768},"11":{"290":11,"292":0,"296":0,"298":0},"12":{"290":12,"292":0,"296":0,"298":0},"13":{"290":13,"292":0,"296":0,"298":32768},"14":{"290":14,"292":0,"296":0,"298":32768},"15":{"290":15,"292":0,"296":0,"298":32768},"16":{"290":16,"292":0,"296":0,"298":32768},"47":{"290":47,"292":0,"296":0,"298":32768},"48":{"290":48,"292":2048,"296":0,"298":32768},"49":{"290":49,"292":4096,"296":0,"298":32768},"50":{"290":50,"292":0,"296":16384,"298":32768},"51":{"290":51,"292":0,"296":16384,"298":32768},"52":{"290":52,"292":0,"296":16384,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":0,"296":16384,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
@@ -1 +0,0 @@
|
||||
{"1":{"290":1,"292":0,"296":8192,"298":32768},"2":{"290":2,"292":0,"296":8192,"298":0},"3":{"290":3,"292":0,"296":8192,"298":32768},"4":{"290":4,"292":0,"296":8192,"298":32768},"5":{"290":5,"292":0,"296":8192,"298":32768},"6":{"290":6,"292":0,"296":8192,"298":32768},"7":{"290":7,"292":0,"296":8192,"298":32768},"8":{"290":8,"292":0,"296":8192,"298":32768},"9":{"290":9,"292":0,"296":8192,"298":32768},"10":{"290":10,"292":0,"296":8192,"298":32768},"11":{"290":11,"292":0,"296":8192,"298":0},"12":{"290":12,"292":0,"296":8192,"298":32768},"13":{"290":13,"292":0,"296":8192,"298":0},"14":{"290":14,"292":0,"296":8192,"298":0},"15":{"290":15,"292":0,"296":8192,"298":0},"16":{"290":16,"292":0,"296":8192,"298":32768},"47":{"290":47,"292":256,"296":0,"298":32768},"48":{"290":48,"292":8192,"296":0,"298":32768},"49":{"290":49,"292":16384,"296":0,"298":32768},"50":{"290":50,"292":0,"296":8192,"298":32768},"51":{"290":51,"292":0,"296":16384,"298":32768},"52":{"290":52,"292":0,"296":16384,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":0,"296":8192,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
@@ -1 +0,0 @@
|
||||
{"1":{"290":1,"292":2,"296":0,"298":0},"2":{"290":2,"292":2,"296":0,"298":32768},"3":{"290":3,"292":2,"296":0,"298":32768},"4":{"290":4,"292":2,"296":0,"298":32768},"5":{"290":5,"292":2,"296":0,"298":32768},"6":{"290":6,"292":2,"296":0,"298":32768},"7":{"290":7,"292":2,"296":0,"298":0},"8":{"290":8,"292":2,"296":0,"298":32768},"9":{"290":9,"292":2,"296":0,"298":32768},"10":{"290":10,"292":2,"296":0,"298":0},"11":{"290":11,"292":2,"296":0,"298":32768},"12":{"290":12,"292":2,"296":0,"298":32768},"13":{"290":13,"292":2,"296":0,"298":32768},"14":{"290":14,"292":2,"296":0,"298":32768},"15":{"290":15,"292":2,"296":0,"298":32768},"16":{"290":16,"292":2,"296":0,"298":32768},"47":{"290":47,"292":1,"296":0,"298":32768},"48":{"290":48,"292":2,"296":0,"298":32768},"49":{"290":49,"292":0,"296":0,"298":32768},"50":{"290":50,"292":0,"296":0,"298":32768},"51":{"290":51,"292":0,"296":0,"298":32768},"52":{"290":52,"292":0,"296":0,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":0,"296":0,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
@@ -1 +0,0 @@
|
||||
{"1":{"290":1,"292":0,"296":0,"298":32768},"2":{"290":2,"292":0,"296":0,"298":32768},"3":{"290":3,"292":0,"296":0,"298":32768},"4":{"290":4,"292":0,"296":0,"298":32768},"5":{"290":5,"292":0,"296":0,"298":32768},"6":{"290":6,"292":0,"296":0,"298":0},"7":{"290":7,"292":0,"296":0,"298":32768},"8":{"290":8,"292":0,"296":0,"298":32768},"9":{"290":9,"292":0,"296":0,"298":0},"10":{"290":10,"292":0,"296":0,"298":32768},"11":{"290":11,"292":0,"296":0,"298":0},"12":{"290":12,"292":0,"296":0,"298":32768},"13":{"290":13,"292":0,"296":0,"298":32768},"14":{"290":14,"292":0,"296":0,"298":32768},"15":{"290":15,"292":0,"296":0,"298":32768},"16":{"290":16,"292":0,"296":0,"298":32768},"47":{"290":47,"292":0,"296":0,"298":32768},"48":{"290":48,"292":512,"296":0,"298":32768},"49":{"290":49,"292":1024,"296":0,"298":32768},"50":{"290":50,"292":0,"296":16384,"298":32768},"51":{"290":51,"292":0,"296":16384,"298":32768},"52":{"290":52,"292":0,"296":16384,"298":32768},"53":{"290":53,"292":0,"296":0,"298":32768},"54":{"290":54,"292":0,"296":0,"298":32768},"55":{"290":55,"292":0,"296":0,"298":32768},"56":{"290":56,"292":0,"296":0,"298":32768},"57":{"290":57,"292":0,"296":16384,"298":32768},"58":{"290":58,"292":0,"296":0,"298":32768},"59":{"290":59,"292":0,"296":0,"298":32768},"60":{"290":60,"292":0,"296":0,"298":32768},"61":{"290":61,"292":0,"296":0,"298":32768},"62":{"290":62,"292":0,"296":0,"298":32768}}
|
||||
@@ -33,13 +33,6 @@ func _ready() -> void:
|
||||
$Background/notice/bind_addr.text = '/Базовый адресс: %s' % Constants.UNICAST_ADDRESS
|
||||
$Background/notice/bind_port.text = '/Базовый порт: %s ' % Constants.UNICAST_PORT
|
||||
|
||||
# Считывание аргументов с консоли (путь сохранения)
|
||||
#var args = OS.get_cmdline_user_args()
|
||||
#for i in range(args.size()):
|
||||
#if args[i] == "testsave-path" and i + 1 < args.size():
|
||||
#save_path = args[i + 1]
|
||||
#break
|
||||
|
||||
# Таблица 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())
|
||||
@@ -325,6 +318,17 @@ func add_signs_scene():
|
||||
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
|
||||
|
||||
|
||||
func _on_yau_status(addr: String):
|
||||
if addr != '':
|
||||
$TabContainer/PRD/status_yau.modulate = Color.AQUAMARINE
|
||||
for check in Constants.ADDRESSES:
|
||||
if check[1] == addr:
|
||||
$TabContainer/PRD/status_yau.text = 'ЯУ-07Б: ' + check[0]
|
||||
else:
|
||||
$TabContainer/PRD/status_yau.modulate = Color.CRIMSON
|
||||
$TabContainer/PRD/status_yau.text = 'ЯУ-07Б: нет связи'
|
||||
|
||||
|
||||
func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
isa_from_yau07b = unit_isa_ports
|
||||
var isa_data: Dictionary = {}
|
||||
@@ -382,21 +386,33 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,1).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 14
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_1:
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_1: ## Синхронизация с Модуляцией УМ лиетры 1
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
var select = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 if data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 < 3 else 3
|
||||
$TabContainer/PRD/body_grid/litera_1/yau07b_control.get_node2(1,2).select(select)
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_2:
|
||||
if select == 1:
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/color_signal', Color.RED)
|
||||
else:
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/color_signal', Color.DARK_ORANGE)
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_2: ## Синхронизация с Модуляцией УМ лиетры 2, 4, 6
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
var select = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 if data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 < 3 else 3
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1,2).select(select)
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_3:
|
||||
if select == 3:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/color_signal', Color.RED)
|
||||
else:
|
||||
$TabContainer/PRD/body_grid/litera_2_4_6/PSK/ray_1.material.set('shader_parameter/color_signal', Color.DARK_ORANGE)
|
||||
if tmp_device_mode == Constants.META.MODUL_UM_3: ## Синхронизация с Модуляцией УМ лиетры 3, 5, 7
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
var select = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 if data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13 < 3 else 3
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,2).select(select)
|
||||
if select == 3:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/color_signal', Color.RED)
|
||||
else:
|
||||
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/color_signal', Color.DARK_ORANGE)
|
||||
if tmp_device_mode == Constants.META.FGOZ_4:
|
||||
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
|
||||
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
|
||||
@@ -489,12 +505,12 @@ func _on_data_fs_3(fs_3_data):
|
||||
node_select_fs_3.set_node_text(2, 5, 'Включен')
|
||||
node_select_fs_3.get_node2(2, 5).modulate = Color.AQUAMARINE
|
||||
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = true
|
||||
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 2.5)
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 2.5)
|
||||
else:
|
||||
node_select_fs_3.set_node_text(2, 5, 'Отключен')
|
||||
node_select_fs_3.get_node2(2, 5).modulate = Color.CRIMSON
|
||||
node_select_fs_3.get_node2(1, 5).get_child(1).button_pressed = false
|
||||
#$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/speed', 0.0)
|
||||
$TabContainer/PRD/body_grid/litera_1/PSK3/ray_litera_1.material.set('shader_parameter/speed', 0.0)
|
||||
Constants.CMD.BASE_GET_CURRENT_TEMP:
|
||||
if GRP == Constants.GROUP.BASE:
|
||||
node_select_fs_3.set_node_text(2, 0, '%.2f' % fs_3_data.decode_float(0xC) + ' °C')
|
||||
@@ -581,18 +597,12 @@ func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
|
||||
|
||||
func _on_save_config():
|
||||
var da = DirAccess.open(save_path)
|
||||
if da == null:
|
||||
return
|
||||
else:
|
||||
da.dir_exists(save_path)
|
||||
da.make_dir_recursive(save_path)
|
||||
var file_dialog = FileDialog.new()
|
||||
file_dialog.access = FileDialog.ACCESS_USERDATA
|
||||
file_dialog.title = "Сохранить файл как"
|
||||
file_dialog.set_size(Vector2(600, 400))
|
||||
file_dialog.mode = FileDialog.FILE_MODE_SAVE_FILE
|
||||
file_dialog.current_dir = save_path
|
||||
file_dialog.set_current_file("ЭМС-Г")
|
||||
file_dialog.current_dir = 'user://saves'
|
||||
file_dialog.connect("file_selected", Callable(self, "_save_selected_file"))
|
||||
add_child(file_dialog)
|
||||
file_dialog.popup_centered()
|
||||
@@ -608,14 +618,13 @@ func _save_selected_file(file_path: String):
|
||||
for key in item[1]:
|
||||
if key in need_port:
|
||||
regist[key] = item[1][key]
|
||||
print(regist)
|
||||
param_ems_g[item[0]] = regist
|
||||
# Сохранение данных ЭМС-Г
|
||||
var file = FileAccess.open(file_path, FileAccess.WRITE)
|
||||
if file != null:
|
||||
file.store_string(JSON.stringify(param_ems_g))
|
||||
file.close()
|
||||
$Background/notice/load_notice.text = '✅ Файл %s записан успешно!' % file_path
|
||||
$Background/notice/load_notice.text = '✅ Файл %s записан успешно!' % ProjectSettings.globalize_path(file_path)
|
||||
$Background/notice/load_notice.visible = true
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
$Background/notice/load_notice.visible = false
|
||||
@@ -623,17 +632,18 @@ func _save_selected_file(file_path: String):
|
||||
|
||||
func _on_load_config():
|
||||
var file_dialog = FileDialog.new()
|
||||
file_dialog.access = FileDialog.ACCESS_USERDATA
|
||||
file_dialog.set_title("Выберите файл")
|
||||
file_dialog.set_size(Vector2(600, 400))
|
||||
file_dialog.mode = FileDialog.FILE_MODE_OPEN_FILE
|
||||
file_dialog.current_dir = save_path
|
||||
|
||||
file_dialog.current_dir = 'user://saves'
|
||||
file_dialog.connect("file_selected", Callable(self, "_load_selected_file"))
|
||||
add_child(file_dialog)
|
||||
file_dialog.popup_centered()
|
||||
|
||||
|
||||
func _load_selected_file():
|
||||
var file_path: String = 'res://saves/%s' % Constants.ADDRESSES[$TabContainer/PRD/select_dev.get_node2(1, 0).get_selected_id()][0]
|
||||
func _load_selected_file(file_path: String):
|
||||
var file = FileAccess.open(file_path, FileAccess.READ)
|
||||
# Проверка на открытие/чтение файла
|
||||
if file == null:
|
||||
@@ -652,29 +662,20 @@ func _load_selected_file():
|
||||
await get_tree().create_timer(2.0).timeout
|
||||
$Background/notice/load_notice.visible = false
|
||||
else:
|
||||
print("Несоответствующий тип данных!")
|
||||
print_debug("Несоответствующий тип данных!")
|
||||
else:
|
||||
print("JSON Parse Error: ", json.get_error_message(), " in ", file_content, " at line ", json.get_error_line())
|
||||
|
||||
print_debug("JSON Parse Error: ", json.get_error_message(), " in ", file_content, " at line ", json.get_error_line())
|
||||
|
||||
|
||||
func _on_write_ems_g(data_to_ems_g: Dictionary):
|
||||
for key in data_to_ems_g.keys():
|
||||
#if int(key) < 17:
|
||||
#print('Constants.BASE_PORTS.EMS_G+2: ', data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x2)])
|
||||
#print('Constants.BASE_PORTS.EMS_G+0xA: ', data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0xA)])
|
||||
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x2)])
|
||||
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+0xA, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0xA)])
|
||||
#Network.read_port_isa([Constants.BASE_PORTS.EMS_G+0xA])
|
||||
if int(key) > 46:
|
||||
print('Constants.BASE_PORTS.EMS_G+2: ', data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x2)])
|
||||
#print('Constants.BASE_PORTS.EMS_G+8', data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x8)])
|
||||
print('Constants.BASE_PORTS.EMS_G+4: ', data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x4)])
|
||||
if int(key) < 17:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x2)])
|
||||
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+4, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x8)])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+0xA, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0xA)])
|
||||
if int(key) > 46:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x2)])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+4, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x8)])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+4, data_to_ems_g[key][str(Constants.BASE_PORTS.EMS_G+0x4)])
|
||||
#Network.read_port_isa([Constants.BASE_PORTS.EMS_G+4, Constants.BASE_PORTS.EMS_G+8])
|
||||
|
||||
|
||||
|
||||
func on_mode_select(intem_from_sector: int) -> void:
|
||||
@@ -735,6 +736,7 @@ func _on_modul_um(item_from_ray_1: int, node: Node):
|
||||
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 2, current_meta[index])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G + 8, modul_um[index])
|
||||
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8])
|
||||
else:
|
||||
return
|
||||
|
||||
@@ -1067,7 +1069,7 @@ func save_settings(to_att_change: float, mode: int):
|
||||
Constants.FS_ATT[Constants.ADDRESSES[$TabContainer/PRD/select_dev.get_node2(1, 0).get_selected_id()][0]] = read_temp
|
||||
else:
|
||||
return
|
||||
var file = FileAccess.open("res://saves/fs_setting", FileAccess.WRITE)
|
||||
var file = FileAccess.open("user://saves/fs_setting", FileAccess.WRITE)
|
||||
if file:
|
||||
file.store_var(Constants.FS_ATT)
|
||||
file.close()
|
||||
|
||||
@@ -435,7 +435,33 @@ func _ready() -> void:
|
||||
|
||||
|
||||
func read_file():
|
||||
var file = FileAccess.open("res://saves/fs_setting", FileAccess.READ)
|
||||
if file.get_length() > 0:
|
||||
FS_ATT = file.get_var()
|
||||
file.close()
|
||||
var file_path = "user://saves/fs_setting"
|
||||
var dir_path = "user://saves"
|
||||
|
||||
# Проверяем и создаем папку, если она не существует
|
||||
var dir = DirAccess.open(dir_path)
|
||||
if not dir:
|
||||
create_dir(dir_path)
|
||||
|
||||
var file = FileAccess.open(file_path, FileAccess.READ)
|
||||
if file:
|
||||
# Файл существует, читаем его содержимое
|
||||
if file.get_length() > 0:
|
||||
FS_ATT = file.get_var()
|
||||
file.close()
|
||||
else:
|
||||
# Файл не существует, создаем его
|
||||
create_file(file_path)
|
||||
|
||||
|
||||
func create_dir(dir_path: String):
|
||||
DirAccess.make_dir_absolute(dir_path)
|
||||
|
||||
|
||||
func create_file(file_path: String):
|
||||
var file = FileAccess.open(file_path, FileAccess.WRITE)
|
||||
if file:
|
||||
file.close()
|
||||
print("Файл создан: ", file_path)
|
||||
else:
|
||||
print("Не удалось создать файл по пути:", file_path)
|
||||
|
||||
@@ -717,7 +717,7 @@ func _on_start_timer_03():
|
||||
count_packet = 0
|
||||
flag_start = false
|
||||
flag_control_add = true
|
||||
timer_03.wait_time = 0.3
|
||||
timer_03.wait_time = 0.4
|
||||
timer_03.one_shot = true
|
||||
timer_03.start()
|
||||
|
||||
@@ -752,7 +752,7 @@ func _on_contol_err():
|
||||
logger.warning('❌❌❌')
|
||||
flag_continue_control = false
|
||||
_status_prd()
|
||||
timer.wait_time = 5.0
|
||||
timer.wait_time = 15.0
|
||||
timer.one_shot = true
|
||||
timer.start()
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ var soc_unicast: Socket
|
||||
var soc_brodcast: Socket
|
||||
var ip_address_yau: String = Constants.ADDRESSES[0][1]
|
||||
var ip_port_yau: int = Constants.ADDRESSES[0][2]
|
||||
var timeout: float = Yau07.ONLINE_TIMEOUT
|
||||
var timeout: float = 10.0
|
||||
var last_update_time_yau07: float = 0.0
|
||||
var last_update_time_fs: float = 0.0
|
||||
var broadcast_packet: PackedByteArray
|
||||
@@ -39,10 +39,10 @@ var command_stack_3: Array
|
||||
var counter_fs_3: int = 0
|
||||
|
||||
# Яу-07б
|
||||
signal yau_status_line(_status) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
signal yau_receive(_data_from_yau)
|
||||
signal yau_feedback_receive(_data_from_yau)
|
||||
signal yau_read_isa(_unit_isa_ports)
|
||||
signal yau_status_line(status, addr) ## Вызывается когда меняется состояние связи с ячейкой
|
||||
signal yau_receive(data_from_yau)
|
||||
signal yau_feedback_receive(data_from_yau)
|
||||
signal yau_read_isa(unit_isa_ports)
|
||||
# ФС модуль
|
||||
signal data_from_fs_1(data:PackedByteArray)
|
||||
signal data_from_fs_2(data:PackedByteArray)
|
||||
@@ -65,7 +65,6 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
broadcast_packet = sock.get_packet()
|
||||
var addr_receive = sock.get_packet_ip()
|
||||
var port_receive = sock.get_packet_port()
|
||||
|
||||
if (ip_address_yau == addr_receive) and (ip_port_yau == port_receive):
|
||||
last_update_time_yau07 = 0.0
|
||||
unit.parse(broadcast_packet)
|
||||
@@ -73,9 +72,12 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
|
||||
emit_signal('yau_receive', data_from_yau_07)
|
||||
if sock == soc_unicast:
|
||||
emit_signal('yau_feedback_receive', data_from_yau_07)
|
||||
emit_signal('yau_status_line', addr_receive)
|
||||
else:
|
||||
if sock.get_available_packet_count():
|
||||
last_update_time_yau07 = 0.0
|
||||
else:
|
||||
emit_signal('yau_status_line', '')
|
||||
return false
|
||||
|
||||
|
||||
@@ -124,7 +126,6 @@ func _ready() -> void:
|
||||
if rc != OK:
|
||||
print_debug('Ошибка: неудачная привязка адреса: ', Constants.UNICAST_ADDRESS)
|
||||
|
||||
unit.connect('line_changed', Callable(self, 'on_line_changed'))
|
||||
unit.connect('command_fail', Callable(self, 'on_command_fail'))
|
||||
set_config()
|
||||
|
||||
@@ -170,7 +171,7 @@ func _process(delta: float) -> void:
|
||||
|
||||
match unit.process(delta):
|
||||
Error.OK: soc_unicast.send_to(ip_address_yau, ip_port_yau, unit.tx_data.slice(0, unit.tx_len))
|
||||
Error.FAILED: print_debug('Ошибка отправки данных')
|
||||
#Error.FAILED: print_debug('Ошибка отправки данных')
|
||||
|
||||
|
||||
func state_machine_yau07():
|
||||
@@ -211,9 +212,6 @@ func write_port_isa(port_isa: int, data_isa: int) -> void:
|
||||
send_array.append(['wr', write_data])
|
||||
|
||||
|
||||
func on_line_changed(_unit) -> void:
|
||||
emit_signal('yau_status_line', unit.online)
|
||||
|
||||
|
||||
## Ессли отсутствует подключение к ячейке ЯУ-07Б
|
||||
func on_command_fail(_unit) -> void:
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
[gd_scene format=3 uid="uid://mxm8nthir8h4"]
|
||||
[gd_scene load_steps=2 format=3 uid="uid://mxm8nthir8h4"]
|
||||
|
||||
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_i3io3"]
|
||||
bg_color = Color(0, 0, 0, 0.490196)
|
||||
|
||||
[node name="OptionButton" type="OptionButton"]
|
||||
offset_right = 130.0
|
||||
offset_bottom = 25.0
|
||||
focus_mode = 0
|
||||
mouse_default_cursor_shape = 2
|
||||
theme_override_styles/normal = SubResource("StyleBoxFlat_i3io3")
|
||||
alignment = 1
|
||||
expand_icon = true
|
||||
|
||||
BIN
testPRD_2.0.exe
BIN
testPRD_2.0.exe
Binary file not shown.
Reference in New Issue
Block a user