морда контроля
This commit is contained in:
@@ -1,15 +1,18 @@
|
||||
extends Panel
|
||||
|
||||
var unit_yau07 = Yau07.YaU07.new('ЯУ07')
|
||||
var sockets_ind: Array
|
||||
var node_power_ind: Array
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
|
||||
Network.connect('yau_status_line', Callable(self, '_control_pribor'))
|
||||
|
||||
sockets_ind = [
|
||||
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,
|
||||
@@ -23,46 +26,17 @@ func _ready() -> void:
|
||||
$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 lose_connect_yau():
|
||||
for i in 4:
|
||||
sockets_ind[i].button_pressed = false
|
||||
sockets_ind[i].disabled = true
|
||||
for i in 8:
|
||||
node_power_ind[i].button_pressed = false
|
||||
node_power_ind[i].disabled = true
|
||||
$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) # Контроль сухих контактов (УГ)
|
||||
|
||||
## SOCKETS BOARDS
|
||||
for i in 4:
|
||||
var j = int(status_board & (1 << i) == 0)
|
||||
if j == 0:
|
||||
sockets_ind[i].button_pressed = true
|
||||
sockets_ind[i].disabled = false
|
||||
else:
|
||||
sockets_ind[i].button_pressed = false
|
||||
sockets_ind[i].disabled = true
|
||||
|
||||
## Блок ИП
|
||||
for i in 8:
|
||||
var j = int(not(dry_contact & (1 << i) == 0))
|
||||
var a = node_power_ind[i]
|
||||
if j == 0:
|
||||
node_power_ind[i].button_pressed = true
|
||||
node_power_ind[i].disabled = false
|
||||
else:
|
||||
node_power_ind[i].button_pressed = false
|
||||
node_power_ind[i].disabled = true
|
||||
|
||||
|
||||
## From Network status about yau-07
|
||||
func _on_yau_status(yau_status:bool) -> void:
|
||||
$device.text = str(Constants.CURRENT_MODE)
|
||||
$soc_y5/ay07/light_ind.button_pressed = yau_status
|
||||
$soc_y5/ay07/light_ind.disabled = not yau_status
|
||||
func _control_pribor(yau_status:bool) -> void:
|
||||
#$device.text = str(Constants.CURRENT_MODE)
|
||||
$soc_y5/ay07.state = Constants.STATE_VAL.GOOD
|
||||
|
||||
Reference in New Issue
Block a user