сохранение/загрузка в эмс-г на доработке

This commit is contained in:
2025-03-11 19:18:42 +03:00
parent 228d1dfd19
commit 3c598d9bc6
4 changed files with 37 additions and 31 deletions

View File

@@ -29,7 +29,9 @@ var modul_um: Array = [0, 0, 0, 0]
func _ready() -> void:
$Background/lbl_commit.text = commit.VCS_HEAD
$Background/notice/lbl_commit.text = commit.VCS_HEAD
$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()
@@ -609,10 +611,10 @@ func _save_selected_file(file_path: String):
if file != null:
file.store_string(JSON.stringify(param_ems_g))
file.close()
$Background/switch_panel/save_config/notice.visible = true
$Background/switch_panel/save_config/notice.text = '✅ Файл %s записан успешно!' % file_path
$Background/notice/load_notice.text = '✅ Файл %s записан успешно!' % file_path
$Background/notice/load_notice.visible = true
await get_tree().create_timer(2.0).timeout
$Background/switch_panel/save_config/notice.visible = false
$Background/notice/load_notice.visible = false
func _on_load_config():
@@ -640,11 +642,11 @@ func _load_selected_file():
if error == OK:
var data_received: Dictionary = json.data
if typeof(data_received) == TYPE_DICTIONARY:
$Background/switch_panel/load_config/notice.visible = true
$Background/switch_panel/load_config/notice.text = '✅ Файл %s прочитан успешно' % file_path
await get_tree().create_timer(2.0).timeout
$Background/switch_panel/load_config/notice.visible = false
$Background/notice/load_notice.text = '✅ Файл %s прочитан успешно' % file_path
$Background/notice/load_notice.visible = true
emit_signal('write_ems_g_start', data_received)
await get_tree().create_timer(2.0).timeout
$Background/notice/load_notice.visible = false
else:
print("Несоответствующий тип данных!")
else:

View File

@@ -1,6 +1,6 @@
extends Node
const UNICAST_PORT: int = 50003
const UNICAST_ADDRESS: String = '10.1.1.3'
var UNICAST_PORT: int = 50100
var UNICAST_ADDRESS: String = '10.1.1.100'
const BROADCAST_PORT: int = 50000
const DEFAULT_ADDRESS: String = '10.1.1.11'
const DEFAULT_PORT: String = '50011'
@@ -425,6 +425,12 @@ var FS_ATT: Dictionary = {
func _ready() -> void:
# Считывание аргументов с консоли (путь сохранения)
var args = OS.get_cmdline_user_args()
for i in range(args.size()):
if args[i] == "addr" and i + 1 < args.size():
UNICAST_PORT = 50000 + int(args[i + 1])
UNICAST_ADDRESS = '10.1.1.%s' % args[i + 1]
read_file()