Files
uarep-ctl/scenes/pribor-prd-v/pribor_prd_v.gd
2025-06-18 12:37:53 +03:00

46 lines
1.3 KiB
GDScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@tool
extends "res://scenes/контроль/прибор.gd"
enum STATE_VAL {
NONE = 0,
GOOD = 1,
ERROR = 2 }
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
var unit_key = settings.get_unit_key(get_meta('unit_name')[0])
var unit_prd = network.units[unit_key]
unit_prd.connect('data_received', Callable(self, 'on_data_received'))
unit_prd.connect('line_changed', Callable(self, 'on_line_changed'))
set_default_state()
func set_default_state():
$um1535_A7.state = STATE_VAL.NONE
$um1535_A8.state = STATE_VAL.NONE
$um1535_A9.state = STATE_VAL.NONE
$um1535_A10.state = STATE_VAL.NONE
$um1535_A11.state = STATE_VAL.NONE
$um1535_A12.state = STATE_VAL.NONE
$um1535_A13.state = STATE_VAL.NONE
$um1535_A14.state = STATE_VAL.NONE
$um1535_A15.state = STATE_VAL.NONE
$um1535_A16.state = STATE_VAL.NONE
$um1535_A17.state = STATE_VAL.NONE
$um1535_A18.state = STATE_VAL.NONE
func on_line_changed(unit_prd):
if not unit_prd.online:
set_default_state()
func on_data_received(unit_prd):
var _ukp1_online = (unit_prd.status[0] >> 2) & 1
var _ukp2_online = (unit_prd.status[0] >> 3) & 1
var ug_online = (unit_prd.status[0] >> 1) & 1
if ug_online:
pass
else:
pass