Files
PRD_TU_MP550/scripts/control_panel.gd
2025-02-10 13:02:26 +03:00

43 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.

extends Panel
var unit_yau07 = Yau07.YaU07.new('ЯУ07')
func _ready() -> void:
Network.connect('yau_receive', Callable(self, '_on_data_received'))
Network.connect('yau_status_line', Callable(self, '_control_pribor'))
var timer = Timer.new()
self.add_child(timer)
timer.connect('timeout', Callable(self, 'on_timer'))
timer.start(1)
'''sockets_ind = [
$soc_y5/ems_g/light_ind,
$soc_y5/ug/light_ind,
$soc_y5/ukp_1/light_ind,
$soc_y5/ukp_2/light_ind]
node_power_ind = [
$soc_P1/MAA_1/light_ind,
$soc_P1/MAA_2/light_ind,
$soc_P1/IP9_50_2/light_ind,
$soc_P1/IP9_50_1/light_ind,
$soc_P1/IP12_50/light_ind,
$soc_P2/IP9_50/light_ind,
$soc_P2/IP12_50/light_ind,
$soc_y5/IP5_25/light_ind]'''
func on_timer(unit):
print(unit)
func _on_data_received(data_from_yau_07):
var status_board = data_from_yau_07.decode_u8(Constants.DataIndices.STATUS_BOARD)
var dry_contact: int = data_from_yau_07.decode_u16(Constants.DataIndices.DRY_CONTACT) # Контроль сухих контактов (УГ)
## From Network status about yau-07
func _control_pribor(yau_status:bool) -> void:
#$device.text = str(Constants.CURRENT_MODE)
$soc_y5/ay07.state = Constants.STATE_VAL.GOOD