Доработка. Режим внешнего управления. Освобождение uart-портов
This commit is contained in:
@@ -43,6 +43,17 @@ func on_line_changed_sch3(unit_sch3):
|
||||
$margin/vbox/grid/state.texture = textures[STATE_VAL.NONE]
|
||||
|
||||
|
||||
func on_settings_changed():
|
||||
var external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false)
|
||||
if not external_ctl:
|
||||
return
|
||||
var items = get_tree().get_nodes_in_group('bits_items_switch')
|
||||
for item in items:
|
||||
item.disabled = external_ctl
|
||||
items = get_tree().get_nodes_in_group('bits_items_good')
|
||||
for item in items:
|
||||
item.texture = textures[STATE_VAL.NONE]
|
||||
|
||||
## Вызывается при изменении состояния выключателя[br]
|
||||
## [param val] - Состояние выключателя[br]
|
||||
## [param meta] - Адреса регистров и индексы битов назначенных выключателю[br]
|
||||
@@ -62,11 +73,6 @@ func _enter_tree() -> void:
|
||||
if Engine.is_editor_hint(): return
|
||||
var unit_key = settings.get_unit_key(unit_name)
|
||||
var unit_sch3 = network.units[unit_key]
|
||||
var items = get_tree().get_nodes_in_group('bits_items_switch')
|
||||
for item in items:
|
||||
var meta = item.get_meta('bits')
|
||||
item.connect('toggled', on_toggled_switch.bind(meta, unit_sch3))
|
||||
item.disabled = true
|
||||
unit_sch3.base_holding_address = base_holding_address
|
||||
unit_sch3.regs_holding_count = regs_holding_count
|
||||
unit_sch3.base_input_address = base_input_address
|
||||
@@ -79,6 +85,16 @@ func _enter_tree() -> void:
|
||||
unit_sch3.connect('line_changed', on_line_changed_sch3)
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var unit_key = settings.get_unit_key(unit_name)
|
||||
var unit_sch3 = network.units[unit_key]
|
||||
var items = get_tree().get_nodes_in_group('bits_items_switch')
|
||||
for item in items:
|
||||
var meta = item.get_meta('bits')
|
||||
item.connect('toggled', on_toggled_switch.bind(meta, unit_sch3))
|
||||
item.disabled = true
|
||||
|
||||
|
||||
func _exit_tree() -> void:
|
||||
if Engine.is_editor_hint(): return
|
||||
var unit_key = settings.get_unit_key(unit_name)
|
||||
|
||||
@@ -136,7 +136,7 @@ theme_override_font_sizes/font_size = 17
|
||||
text = "УФ"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="switch0" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch"]]
|
||||
[node name="switch0" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch", "c111"]]
|
||||
editor_description = "Питание УФ"
|
||||
material = SubResource("ShaderMaterial_c1mqk")
|
||||
layout_mode = 2
|
||||
@@ -165,7 +165,7 @@ theme_override_font_sizes/font_size = 17
|
||||
text = "РТР"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="switch1" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch"]]
|
||||
[node name="switch1" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch", "c111"]]
|
||||
editor_description = "РТР"
|
||||
material = SubResource("ShaderMaterial_c1mqk")
|
||||
layout_mode = 2
|
||||
@@ -193,7 +193,7 @@ theme_override_font_sizes/font_size = 17
|
||||
text = "ПРД-Н.1"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="switch2" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch"]]
|
||||
[node name="switch2" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch", "c111"]]
|
||||
editor_description = "ПРД-Н.1"
|
||||
material = SubResource("ShaderMaterial_c1mqk")
|
||||
layout_mode = 2
|
||||
@@ -222,7 +222,7 @@ theme_override_font_sizes/font_size = 17
|
||||
text = "ПРД-Н.2"
|
||||
vertical_alignment = 1
|
||||
|
||||
[node name="switch3" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch"]]
|
||||
[node name="switch3" type="CheckButton" parent="margin/vbox/table" groups=["bits_items_switch", "c111"]]
|
||||
editor_description = "Питание ПРД-Н.2"
|
||||
material = SubResource("ShaderMaterial_c1mqk")
|
||||
layout_mode = 2
|
||||
|
||||
@@ -3,20 +3,30 @@
|
||||
extends "res://scenes/контроль/элемент-я.gd"
|
||||
|
||||
|
||||
func on_line_changed(unit):
|
||||
if not unit.online:
|
||||
state = STATE_VAL.NONE
|
||||
$block_output.state0 = STATE_VAL.NONE
|
||||
$block_output.state1 = STATE_VAL.NONE
|
||||
$block_output.state2 = STATE_VAL.NONE
|
||||
$block_input1.state = STATE_VAL.NONE
|
||||
$block_input1.state0 = STATE_VAL.NONE
|
||||
$block_input1.state1 = STATE_VAL.NONE
|
||||
$block_input1.state2 = STATE_VAL.NONE
|
||||
$block_input2.state = STATE_VAL.NONE
|
||||
$block_input2.state0 = STATE_VAL.NONE
|
||||
$block_input2.state1 = STATE_VAL.NONE
|
||||
$block_input2.state2 = STATE_VAL.NONE
|
||||
func on_line_changed(unit0):
|
||||
if not unit0.online:
|
||||
disable_all()
|
||||
|
||||
|
||||
func on_settings_changed():
|
||||
var external_ctl = ProjectSettings.get_setting('application/config/Внешнее управление', false)
|
||||
if external_ctl:
|
||||
disable_all()
|
||||
|
||||
|
||||
func disable_all():
|
||||
state = STATE_VAL.NONE
|
||||
$block_output.state0 = STATE_VAL.NONE
|
||||
$block_output.state1 = STATE_VAL.NONE
|
||||
$block_output.state2 = STATE_VAL.NONE
|
||||
$block_input1.state = STATE_VAL.NONE
|
||||
$block_input1.state0 = STATE_VAL.NONE
|
||||
$block_input1.state1 = STATE_VAL.NONE
|
||||
$block_input1.state2 = STATE_VAL.NONE
|
||||
$block_input2.state = STATE_VAL.NONE
|
||||
$block_input2.state0 = STATE_VAL.NONE
|
||||
$block_input2.state1 = STATE_VAL.NONE
|
||||
$block_input2.state2 = STATE_VAL.NONE
|
||||
|
||||
|
||||
func on_data_received(data: PackedByteArray):
|
||||
|
||||
Reference in New Issue
Block a user