Рефактор.

This commit is contained in:
sasha80
2025-12-10 10:28:20 +03:00
parent b3322ee591
commit 788a62505f
3 changed files with 10 additions and 11 deletions

View File

@@ -37,7 +37,7 @@ const INTERFER_NAMES = {
'k1': 'K1',
'svm2': 'СВ-М2',
'ozp1': 'ОЗП-1',
'eprls': 'ЕПРЛС',}
'eprls': 'ЕПРЛС' }
## Индексы колонок

View File

@@ -8,12 +8,12 @@ extends TextureButton
func _ready():
toggle_mode = true
focus_mode = Control.FOCUS_ALL
connect("focus_entered", _on_focus_entered)
connect("focus_exited", _on_focus_exited)
connect('focus_entered', _on_focus_entered)
connect('focus_exited', _on_focus_exited)
func _enter_tree() -> void:
if has_node("label"):
if is_inside_tree():
$label.self_modulate = state_colors[state]
@@ -21,11 +21,11 @@ func update_progress_bar(target_value) -> void:
if tween:
tween.kill()
tween = create_tween()
tween.tween_property($control_progress, "value", target_value, 0.3)
tween.tween_property($control_progress, 'value', target_value, 0.3)
func _on_toggled(toggled_on):
if has_node("frame"):
if has_node('frame'):
$frame.visible = toggled_on
@@ -40,7 +40,7 @@ func _on_focus_exited():
func enter_press():
var enter_event = InputEventAction.new()
enter_event.action = "ui_accept"
enter_event.action = 'ui_accept'
enter_event.pressed = true
Input.parse_input_event(enter_event)
@@ -49,14 +49,13 @@ func enter_press():
set(v):
v = 0 if v < 0 else v % state_colors.size()
state = v
if is_inside_tree() and has_node("label"):
if is_inside_tree():
$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')

View File

@@ -9,7 +9,7 @@ class Unit extends Object:
SEND, ## Буфер готов для отправки.
WAIT, ## Ожидание выполнения.
DONE, ## Команда выполнена.
FAIL, ## Команда не выполнена.
FAIL ## Команда не выполнена.
}
signal line_changed(unit) ## Вызывается при изменении состояния связи
@@ -18,7 +18,7 @@ class Unit extends Object:
signal parse_failed(unit) ## Вызывается при обнаружении ошибки во входных данных
signal data_received(data) ## Вызывается по приёму данных
var cmd_state = CmdState.UNCK ## Состояние выполнения команды
var cmd_state: = CmdState.UNCK ## Состояние выполнения команды
var tx_data: = PackedByteArray() ## Буфер для отправки.
var tx_len: int = 0 ## Длина последнего отправленного пакета.
var tx_tick: int = 0 ## Тик-время отправки буфера