Доработка. Подключение к событию приёма данных от СПТ-25

This commit is contained in:
sasha80
2024-10-28 11:11:38 +03:00
parent 3760245abe
commit 0279952671

View File

@@ -10,12 +10,18 @@ enum STATE_VAL
}
func _ready() -> void:
func _enter_tree() -> void:
var unit_key = repsettings.get_unit_key(unit_name)
var unit = repnetwork.units[unit_key]
unit.connect('data_received', on_data_received.bind(unit))
func _exit_tree() -> void:
var unit_key = repsettings.get_unit_key(unit_name)
var unit = repnetwork.units[unit_key]
unit.disconnect('data_received', on_data_received)
func on_data_received(data, unit):
# Неисправность, напряжение на выходе меньше номинального
$block_output.state0 = STATE_VAL.GOOD if (data[4] & (1 << 0)) == 0 else STATE_VAL.ERROR