add buttn fgos and modul um
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=50 format=3 uid="uid://cvor2jm4xk3ha"]
|
||||
[gd_scene load_steps=51 format=3 uid="uid://cvor2jm4xk3ha"]
|
||||
|
||||
[ext_resource type="Script" path="res://scripts/PRD.gd" id="1_v273n"]
|
||||
[ext_resource type="Texture2D" uid="uid://cdxdluvyb5uei" path="res://table/on.png" id="2_dv7xx"]
|
||||
@@ -6,9 +6,10 @@
|
||||
[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://Shaders/shader_edu.tres" id="3_3syd3"]
|
||||
[ext_resource type="Texture2D" uid="uid://cfktmk2rowmul" path="res://table/off.png" id="3_qvuyu"]
|
||||
[ext_resource type="Shader" path="res://Shaders/ray.gdshader" id="4_uy5o2"]
|
||||
[ext_resource type="Texture2D" uid="uid://62v0xejejuwj" path="res://Web.png" id="5_i3nvb"]
|
||||
[ext_resource type="Texture2D" uid="uid://co8dxcd8eckjs" path="res://Web.png" id="5_i3nvb"]
|
||||
[ext_resource type="Shader" path="res://ray_2.gdshader" id="8_12mng"]
|
||||
[ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://nine-patch-round.png" id="9_0r2qk"]
|
||||
[ext_resource type="Script" path="res://scripts/control_panel.gd" id="9_akagi"]
|
||||
[ext_resource type="Script" path="res://scripts/ems_g.gd" id="9_g1wia"]
|
||||
[ext_resource type="Shader" path="res://load.gdshader" id="10_lf1xh"]
|
||||
[ext_resource type="PackedScene" uid="uid://bdb0bhfu7366l" path="res://kasseta-fs-kd.tscn" id="10_tdh2s"]
|
||||
@@ -106,7 +107,7 @@ script/source = "extends Sprite2D
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_dgiai"]
|
||||
shader = ExtResource("4_uy5o2")
|
||||
shader_parameter/color_signal = Color(0.690196, 0.776471, 0, 1)
|
||||
shader_parameter/color_signal = Color(0.588235, 0.466667, 0, 1)
|
||||
shader_parameter/turn = 0.735
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_ki0n7"]
|
||||
@@ -118,7 +119,7 @@ metadata/_snap_enabled = true
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_2pxu2"]
|
||||
shader = ExtResource("8_12mng")
|
||||
shader_parameter/color_signal = Color(1.29351e-07, 0.19544, 0.0177065, 0.574)
|
||||
shader_parameter/color_signal = Color(0.588242, 0.466356, 0, 1)
|
||||
shader_parameter/turn = 0.735
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_jlp41"]
|
||||
@@ -306,9 +307,7 @@ offset = Vector2(800, 600)
|
||||
script = SubResource("GDScript_0sobq")
|
||||
|
||||
[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/PSK"]
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
self_modulate = Color(0, 0, 0, 1)
|
||||
show_behind_parent = true
|
||||
modulate = Color(1, 1, 0.941176, 1)
|
||||
material = SubResource("ShaderMaterial_o7txs")
|
||||
offset_left = 554.954
|
||||
offset_top = -30.0
|
||||
@@ -334,8 +333,7 @@ offset = Vector2(800, 600)
|
||||
script = SubResource("GDScript_0sobq")
|
||||
|
||||
[node name="PSK grad" type="TextureRect" parent="TabContainer/PRD/PSK2"]
|
||||
modulate = Color(0, 0, 0, 1)
|
||||
self_modulate = Color(0, 0, 0, 1)
|
||||
modulate = Color(1, 1, 0.941176, 1)
|
||||
show_behind_parent = true
|
||||
material = SubResource("ShaderMaterial_o7txs")
|
||||
offset_left = 554.954
|
||||
@@ -371,11 +369,16 @@ mouse_default_cursor_shape = 2
|
||||
theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn")
|
||||
toggle_mode = true
|
||||
text = " Запрет СИ2"
|
||||
metadata/litera = 48
|
||||
metadata/dev_num = 48
|
||||
|
||||
[node name="Modul" type="Label" parent="TabContainer/PRD/Grid"]
|
||||
[node name="Modul_um_1" type="Button" parent="TabContainer/PRD/Grid"]
|
||||
layout_mode = 2
|
||||
text = "Модуляция"
|
||||
focus_mode = 0
|
||||
mouse_default_cursor_shape = 2
|
||||
theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn")
|
||||
toggle_mode = true
|
||||
text = " Модуляция УМ 2"
|
||||
metadata/dev_num = 51
|
||||
|
||||
[node name="Label_ray" type="Label" parent="TabContainer/PRD/Grid"]
|
||||
layout_mode = 2
|
||||
@@ -403,11 +406,25 @@ mouse_default_cursor_shape = 2
|
||||
theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn")
|
||||
toggle_mode = true
|
||||
text = " Запрет СИ3"
|
||||
metadata/litera = 49
|
||||
metadata/dev_num = 49
|
||||
|
||||
[node name="FGOZ3" type="Label" parent="TabContainer/PRD/Grid"]
|
||||
[node name="fgos_2" type="Button" parent="TabContainer/PRD/Grid"]
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
mouse_default_cursor_shape = 2
|
||||
theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn")
|
||||
toggle_mode = true
|
||||
text = "ФГОЗ 3"
|
||||
metadata/dev_num = 56
|
||||
|
||||
[node name="Modul_um_2" type="Button" parent="TabContainer/PRD/Grid"]
|
||||
layout_mode = 2
|
||||
focus_mode = 0
|
||||
mouse_default_cursor_shape = 2
|
||||
theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn")
|
||||
toggle_mode = true
|
||||
text = " Модуляция УМ 3"
|
||||
metadata/dev_num = 52
|
||||
|
||||
[node name="DKM3" type="Label" parent="TabContainer/PRD/Grid"]
|
||||
layout_mode = 2
|
||||
@@ -416,19 +433,11 @@ text = "ДКМ ДОУ 3"
|
||||
[node name="Ray_set2" type="OptionButton" parent="TabContainer/PRD/Grid"]
|
||||
layout_mode = 2
|
||||
|
||||
[node name="data_from_dev" type="Label" parent="TabContainer/PRD"]
|
||||
layout_mode = 0
|
||||
offset_left = 48.0
|
||||
offset_top = 658.0
|
||||
offset_right = 1464.0
|
||||
offset_bottom = 810.0
|
||||
text = "From dev: "
|
||||
autowrap_mode = 2
|
||||
|
||||
[node name="ControlPanel" type="Panel" parent="TabContainer"]
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6")
|
||||
script = ExtResource("9_akagi")
|
||||
metadata/_tab_index = 1
|
||||
metadata/_edit_lock_ = true
|
||||
|
||||
@@ -991,6 +1000,13 @@ text = "Темп"
|
||||
[connection signal="pressed" from="Background/side_panel/select_ems_g" to="." method="_on_emsg_select"]
|
||||
[connection signal="pressed" from="Background/side_panel/select_fs" to="." method="_on_mfs_select"]
|
||||
[connection signal="pressed" from="read_isa" to="." method="_on_read_isa_pressed"]
|
||||
[connection signal="toggled" from="TabContainer/PRD/Grid/Zapret" to="." method="_on_zapret1"]
|
||||
[connection signal="toggled" from="TabContainer/PRD/Grid/Modul_um_1" to="." method="_on_modul_um_1"]
|
||||
[connection signal="item_selected" from="TabContainer/PRD/Grid/Ray_set" to="." method="_on_btn_ray"]
|
||||
[connection signal="toggled" from="TabContainer/PRD/Grid/Zapret2" to="." method="_on_zapret2"]
|
||||
[connection signal="toggled" from="TabContainer/PRD/Grid/fgos_2" to="." method="_on_fgos_2"]
|
||||
[connection signal="toggled" from="TabContainer/PRD/Grid/Modul_um_2" to="." method="_on_modul_um_2"]
|
||||
[connection signal="item_selected" from="TabContainer/PRD/Grid/Ray_set2" to="." method="_on_btn_ray2"]
|
||||
[connection signal="pressed" from="TabContainer/Modul_fs/set_space/set_ferq" to="TabContainer/Modul_fs" method="_on_set_ferq"]
|
||||
[connection signal="pressed" from="TabContainer/Modul_fs/set_space/set_att2" to="TabContainer/Modul_fs" method="_on_set_att"]
|
||||
[connection signal="pressed" from="TabContainer/Modul_fs/manage_panel/con" to="TabContainer/Modul_fs" method="_on_start"]
|
||||
|
||||
@@ -3,11 +3,11 @@ shader_type canvas_item;
|
||||
uniform vec4 color_signal: source_color;
|
||||
uniform float turn = 0.785;
|
||||
|
||||
const float outer_radius = 0.309;
|
||||
const float inner_radius = 0.72;
|
||||
const float outer_radius = 0.109;
|
||||
const float inner_radius = 0.82;
|
||||
const float zoom = 100.0;
|
||||
const float speed = 2.1;
|
||||
const float size = 6.0;
|
||||
const float size = 9.0;
|
||||
const float blur = 0.000001;
|
||||
const float fill_ratio = 0.03;
|
||||
|
||||
|
||||
BIN
Web.png
BIN
Web.png
Binary file not shown.
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 21 KiB |
@@ -2,7 +2,7 @@
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://62v0xejejuwj"
|
||||
uid="uid://co8dxcd8eckjs"
|
||||
path="res://.godot/imported/Web.png-c71665e7797af3c541effa7e6a335fc8.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
|
||||
@@ -3,11 +3,11 @@ shader_type canvas_item;
|
||||
uniform vec4 color_signal: source_color;
|
||||
uniform float turn = 0.785;
|
||||
|
||||
const float outer_radius = 0.309;
|
||||
const float inner_radius = 0.72;
|
||||
const float outer_radius = 0.109;
|
||||
const float inner_radius = 0.82;
|
||||
const float zoom = 100.0;
|
||||
const float speed = 2.1;
|
||||
const float size = 6.0;
|
||||
const float size = 9.0;
|
||||
const float blur = 0.000001;
|
||||
const float fill_ratio = 0.03;
|
||||
|
||||
|
||||
172
scripts/PRD.gd
172
scripts/PRD.gd
@@ -47,10 +47,6 @@ func _ready() -> void:
|
||||
|
||||
draw_control_panel_prd(Constants.ADDRESSES[0][3])
|
||||
|
||||
$TabContainer/PRD/Grid/Zapret.connect('toggled', Callable(self, '_on_zapret').bind($TabContainer/PRD/Grid/Zapret))
|
||||
$TabContainer/PRD/Grid/Zapret2.connect('toggled', Callable(self, '_on_zapret').bind($TabContainer/PRD/Grid/Zapret2))
|
||||
$TabContainer/PRD/Grid/Ray_set.connect('item_selected', Callable(self, '_on_btn_ray'))
|
||||
$TabContainer/PRD/Grid/Ray_set2.connect('item_selected', Callable(self, '_on_btn_ray2'))
|
||||
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
|
||||
Network.connect('yau_receive', Callable(self, '_on_data_received'))
|
||||
Network.connect('yau_read_isa', Callable(self, '_on_read_isa'))
|
||||
@@ -70,15 +66,7 @@ func draw_control_panel_prd(mode) -> void:
|
||||
|
||||
## From Network status about yau-07
|
||||
func _on_yau_status(yau_status: bool) -> void:
|
||||
if yau_status:
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A30/light_ind.button_pressed = true
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A30/light_ind.disabled = false
|
||||
flag_yau_control = true
|
||||
else:
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A30/light_ind.button_pressed = false
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A30/light_ind.disabled = true
|
||||
|
||||
flag_yau_control = false
|
||||
flag_yau_control = yau_status
|
||||
|
||||
|
||||
func _on_read_isa(unit_isa_ports: Dictionary) -> void:
|
||||
@@ -120,68 +108,36 @@ func _process(_delta: float) -> void:
|
||||
|
||||
|
||||
func _on_data_received(data_from_yau_07):
|
||||
$TabContainer/PRD/data_from_dev.text = 'From dev: %s' % data_from_yau_07
|
||||
if flag_yau_control:
|
||||
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) # Контроль сухих контактов (УГ)
|
||||
var _DKM: int = data_from_yau_07.decode_u16(Constants.DataIndices.DKM) # ДКМ от УГ
|
||||
if not flag_yau_control:
|
||||
return
|
||||
|
||||
|
||||
## УГ
|
||||
var _DKM: int = data_from_yau_07.decode_u16(Constants.DataIndices.DKM) # ДКМ от УГ
|
||||
#node_select1.set_node_text(2, 0, '%d' % dry_contact)
|
||||
#node_select1.set_node_text(3, 0, '%d' % DKM)
|
||||
|
||||
## УГ
|
||||
#node_select1.set_node_text(2, 0, '%d' % dry_contact)
|
||||
#node_select1.set_node_text(3, 0, '%d' % DKM)
|
||||
|
||||
## SOCKETS BOARDS
|
||||
for i in 4:
|
||||
var sockets_ind = [$TabContainer/ControlPanel/soc_y5/ref_A26/light_ind,
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A27/light_ind,
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A28/light_ind,
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A29/light_ind]
|
||||
var j = int(status_board & (1 << i) == 0 and flag_yau_control)
|
||||
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 node_power_ind = [$TabContainer/ControlPanel/soc_P1/ref_A23/light_ind,
|
||||
$TabContainer/ControlPanel/soc_P1/ref_A24/light_ind,
|
||||
$TabContainer/ControlPanel/soc_P1/ref_A25/light_ind,
|
||||
$TabContainer/ControlPanel/soc_P1/ref_A26/light_ind,
|
||||
$TabContainer/ControlPanel/soc_P1/ref_A27/light_ind,
|
||||
$TabContainer/ControlPanel/soc_P1/ref_A28/light_ind,
|
||||
$TabContainer/ControlPanel/soc_P1/ref_A29/light_ind,
|
||||
$TabContainer/ControlPanel/soc_y5/ref_A24/light_ind]
|
||||
var j = int(not(dry_contact & (1 << i) == 0 and flag_yau_control))
|
||||
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
|
||||
|
||||
## УКП
|
||||
for i in range(8): ## Мощность от УКП_1
|
||||
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
|
||||
node_select1.set_node_text(0, i+1, '%d' % power_ukp_1)
|
||||
|
||||
for i in range(8): ## Температура от УКП_1
|
||||
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP
|
||||
node_select1.set_node_text(1, i+1, '%d' % TMP)
|
||||
|
||||
for i_pow in range(8): ## Мощность от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.POWER_UKP_2 + 2 * i_pow:
|
||||
var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i_pow)
|
||||
node_select2.set_node_text(0, i_pow+1, '%d' % power_ukp_2)
|
||||
|
||||
for row in range(8): ## Температура от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row:
|
||||
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP
|
||||
node_select2.set_node_text(1, row+1, '%d' % TMP)
|
||||
|
||||
## УКП
|
||||
for i in range(8): ## Мощность от УКП_1
|
||||
var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i)
|
||||
node_select1.set_node_text(0, i+1, '%d' % power_ukp_1)
|
||||
|
||||
for i in range(8): ## Температура от УКП_1
|
||||
var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP
|
||||
node_select1.set_node_text(1, i+1, '%d' % TMP)
|
||||
|
||||
for i_pow in range(8): ## Мощность от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.POWER_UKP_2 + 2 * i_pow:
|
||||
var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i_pow)
|
||||
node_select2.set_node_text(0, i_pow+1, '%d' % power_ukp_2)
|
||||
|
||||
for row in range(8): ## Температура от УКП_2
|
||||
if len(data_from_yau_07) > Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row:
|
||||
var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row)
|
||||
var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP
|
||||
node_select2.set_node_text(1, row+1, '%d' % TMP)
|
||||
|
||||
|
||||
func set_frame(node: Node, val: int): node.set_frame(val)
|
||||
@@ -231,21 +187,67 @@ func fill_item(node: Node, i_column: int, i_row: int, arr: Dictionary, select: i
|
||||
optionbutton.select(select)
|
||||
|
||||
|
||||
func _on_zapret(toggled_on: bool, meta) -> void:
|
||||
Network.write_port_isa(Constants.EMS_G_BASE_ADDR+2, meta.get_meta('litera'))
|
||||
func _on_zapret1(toggled_on: bool) -> void:
|
||||
var meta = $TabContainer/PRD/Grid/Zapret.get_meta('dev_num')
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
var zapret_mode = 0x4000 if toggled_on else 0x0
|
||||
Network.write_port_isa(Constants.EMS_G_BASE_ADDR+8, zapret_mode)
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode)
|
||||
|
||||
|
||||
func _on_zapret2(toggled_on: bool) -> void:
|
||||
var meta = $TabContainer/PRD/Grid/Zapret2.get_meta('dev_num')
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
var zapret_mode = 0x4000 if toggled_on else 0x0
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, zapret_mode)
|
||||
|
||||
|
||||
func _on_modul_um_1(toggled_on: bool):
|
||||
var meta = $TabContainer/PRD/Grid/Modul_um_1.get_meta('dev_num')
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
var modul_um = 0x2000 if toggled_on else 0x0
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
|
||||
|
||||
|
||||
func _on_modul_um_2(toggled_on: bool):
|
||||
var meta = $TabContainer/PRD/Grid/Modul_um_2.get_meta('dev_num')
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
var modul_um = 0x2000 if toggled_on else 0x0
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
|
||||
|
||||
|
||||
func _on_fgos_2(toggled_on: bool):
|
||||
var meta = $TabContainer/PRD/Grid/fgos_2.get_meta('dev_num')
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
var modul_um = 0x2000 if toggled_on else 0x0
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
|
||||
|
||||
|
||||
#func _on_fgos_2(toggled_on: bool):
|
||||
#var meta = $TabContainer/PRD/Grid/Modul_um_2.get_meta('dev_num')
|
||||
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
|
||||
#var modul_um = 0x2000 if toggled_on else 0x0
|
||||
#Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
|
||||
|
||||
## Регулировка положением луча 1
|
||||
func _on_btn_ray(item_from_ray: int) -> void:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+6, item_from_ray)
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+6])
|
||||
|
||||
|
||||
## Регулировка положением луча 2
|
||||
func _on_btn_ray2(item_from_ray: int) -> void:
|
||||
Network.write_port_isa(Constants.BASE_PORTS.UG+8, item_from_ray)
|
||||
Network.read_port_isa([Constants.BASE_PORTS.UG+8])
|
||||
|
||||
|
||||
func _on_read_isa_pressed() -> void:
|
||||
Network.read_port_isa([0x122, 0x124, 0x128])
|
||||
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+2, Constants.BASE_PORTS.EMS_G+4, Constants.BASE_PORTS.EMS_G+8])
|
||||
|
||||
|
||||
## Регулировка положением луча
|
||||
func _on_btn_ray(item_from_ray: int) -> void:
|
||||
Network.write_port_isa(0x106, item_from_ray)
|
||||
Network.read_port_isa([0x106])
|
||||
|
||||
func _on_btn_ray2(item_from_ray: int) -> void:
|
||||
Network.write_port_isa(0x108, item_from_ray)
|
||||
Network.read_port_isa([0x108])
|
||||
## Устанавливает биты в соответствии с маской
|
||||
## [param v] - Прежние значения бит
|
||||
## [param a] - Новые значения бит
|
||||
## [param m] - Маска изменяемых бит
|
||||
func set_bits(v, a, m):
|
||||
return (~m) & v | a & m
|
||||
|
||||
@@ -6,8 +6,7 @@ const DEFAULT_ADDRESS: String = '10.1.1.11'
|
||||
const DEFAULT_PORT: String = '50011'
|
||||
const CONST_MIN_TEMP: int = -25
|
||||
const MAXIMUM_CODE_ADC: int = 3796
|
||||
const MINIMUM_CODE_AD: int = 2660
|
||||
const EMS_G_BASE_ADDR: int = 0x120
|
||||
const MINIMUM_CODE_AD: int = 2660
|
||||
const TEMP: float = 115.0 / (MAXIMUM_CODE_ADC - MINIMUM_CODE_AD)
|
||||
const TableNode = preload("res://table/node.tscn")
|
||||
const TableList = preload("res://table/node_list.tscn")
|
||||
@@ -38,7 +37,7 @@ const ADDRESSES: Array = [
|
||||
['ПРД-Н1', '10.1.1.11', 50011, MODE.PRD_H, '10.1.2.18', '10.1.2.19', ''],
|
||||
['ПРД-Н2', '10.1.1.21', 50021, MODE.PRD_H, '10.1.2.34', '10.1.2.35', ''],
|
||||
['ПРД-Н3', '10.1.1.31', 50031, MODE.PRD_H, '10.1.2.50', '10.1.2.51', ''],
|
||||
['ПРД-Н4', '10.1.1.41', 50041, MODE.PRD_H, '10.1.2.66', '10.1.2.67', ''],
|
||||
['ПРД-Н4', '10.1.1.41', 50041, MODE.PRD_H, '10.1.2.67', '10.1.2.67', ''],
|
||||
['ПРД-В1', '10.1.1.12', 50012, MODE.PRD_B, '10.1.2.20', '10.1.2.21', ''],
|
||||
['ПРД-В2', '10.1.1.22', 50022, MODE.PRD_B, '10.1.2.36', '10.1.2.37', ''],
|
||||
['ПРД-В3', '10.1.1.32', 50032, MODE.PRD_B, '10.1.2.52', '10.1.2.53', ''],
|
||||
@@ -199,6 +198,13 @@ var NODE_MAP = {
|
||||
'TabContainer/ControlPanel/soc_P1/ref_A29': 21,
|
||||
'TabContainer/ControlPanel/soc_P1/ref_A30': 22,
|
||||
}
|
||||
enum BASE_PORTS {
|
||||
UG = 0x100,
|
||||
EMS_G = 0x120,
|
||||
UKP_1 = 0x130,
|
||||
UKP_2 = 0x140,
|
||||
}
|
||||
|
||||
enum MODE {
|
||||
PRD_K,
|
||||
PRD_B,
|
||||
@@ -234,7 +240,6 @@ enum STATE {
|
||||
|
||||
var EMS_G_PORT_DATA_HOLDER: Array = []
|
||||
|
||||
|
||||
# Таблица CRC-32 для модуля ФС
|
||||
const CRC32_TABLE: Array = [
|
||||
0x00000000, 0x77073096, 0xEE0E612C, 0x990951BA, 0x076DC419, 0x706AF48F, 0xE963A535, 0x9E6495A3,
|
||||
|
||||
73
scripts/control_panel.gd
Normal file
73
scripts/control_panel.gd
Normal file
@@ -0,0 +1,73 @@
|
||||
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, '_on_yau_status'))
|
||||
|
||||
|
||||
func lose_connect_yau():
|
||||
for i in 4:
|
||||
var sockets_ind = [$soc_y5/ref_A26/light_ind,
|
||||
$soc_y5/ref_A27/light_ind,
|
||||
$soc_y5/ref_A28/light_ind,
|
||||
$soc_y5/ref_A29/light_ind]
|
||||
sockets_ind[i].button_pressed = false
|
||||
sockets_ind[i].disabled = true
|
||||
|
||||
for i in 8:
|
||||
var node_power_ind = [$soc_P1/ref_A23/light_ind,
|
||||
$soc_P1/ref_A24/light_ind,
|
||||
$soc_P1/ref_A25/light_ind,
|
||||
$soc_P1/ref_A26/light_ind,
|
||||
$soc_P1/ref_A27/light_ind,
|
||||
$soc_P1/ref_A28/light_ind,
|
||||
$soc_P1/ref_A29/light_ind,
|
||||
$soc_y5/ref_A24/light_ind]
|
||||
node_power_ind[i].button_pressed = false
|
||||
node_power_ind[i].disabled = true
|
||||
|
||||
|
||||
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 sockets_ind = [$soc_y5/ref_A26/light_ind,
|
||||
$soc_y5/ref_A27/light_ind,
|
||||
$soc_y5/ref_A28/light_ind,
|
||||
$soc_y5/ref_A29/light_ind]
|
||||
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 node_power_ind = [$soc_P1/ref_A23/light_ind,
|
||||
$soc_P1/ref_A24/light_ind,
|
||||
$soc_P1/ref_A25/light_ind,
|
||||
$soc_P1/ref_A26/light_ind,
|
||||
$soc_P1/ref_A27/light_ind,
|
||||
$soc_P1/ref_A28/light_ind,
|
||||
$soc_P1/ref_A29/light_ind,
|
||||
$soc_y5/ref_A24/light_ind]
|
||||
var j = int(not(dry_contact & (1 << i) == 0))
|
||||
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:
|
||||
$soc_y5/ref_A30/light_ind.button_pressed = yau_status
|
||||
$soc_y5/ref_A30/light_ind.disabled = not yau_status
|
||||
@@ -8,12 +8,12 @@ func _on_read_ems_g():
|
||||
$load_boadr.visible = true
|
||||
Constants.EMS_G_PORT_DATA_HOLDER.clear()
|
||||
for i_input in 16:
|
||||
Network.write_port_isa(Constants.EMS_G_BASE_ADDR+2, 1+i_input)
|
||||
Network.read_port_isa([Constants.EMS_G_BASE_ADDR+0xA])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 1+i_input)
|
||||
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+0xA])
|
||||
|
||||
for i_output in range(46, 62):
|
||||
Network.write_port_isa(Constants.EMS_G_BASE_ADDR+2, 1+i_output)
|
||||
Network.read_port_isa([Constants.EMS_G_BASE_ADDR+4, Constants.EMS_G_BASE_ADDR+8])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 1+i_output)
|
||||
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+4, Constants.BASE_PORTS.EMS_G+8])
|
||||
|
||||
|
||||
func _on_sync():
|
||||
@@ -98,7 +98,7 @@ func _on_data_received(data_from_yau_07):
|
||||
var parent_node2 = get_parent().get_parent()
|
||||
|
||||
process_sockets_vert(in_blank, in_imp, 16, 1, parent_node2)
|
||||
#process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2)
|
||||
process_sockets_horizon(out_blank, out_imp, 16, 2, parent_node2)
|
||||
|
||||
|
||||
func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_node2: Node):
|
||||
@@ -207,11 +207,11 @@ func on_mouse_entered(meta_area):
|
||||
func on_mode_link(mode, list):
|
||||
## Формирование команды для выбора устройства
|
||||
var meta = list.get_meta('device')
|
||||
var address_port_wr = Constants.EMS_G_BASE_ADDR+2
|
||||
var address_port_wr = Constants.BASE_PORTS.EMS_G+2
|
||||
Network.write_port_isa(address_port_wr, meta) # Отправка команды
|
||||
|
||||
## Формирование команды для отправкы команды на устройство
|
||||
address_port_wr = Constants.EMS_G_BASE_ADDR+8
|
||||
address_port_wr = Constants.BASE_PORTS.EMS_G+8
|
||||
var set_mode = 0x0000 if mode == 0 else 0x2000 if mode == 1 else 0x4000 if mode == 2 else 0x8000
|
||||
Network.write_port_isa(address_port_wr, set_mode)
|
||||
|
||||
@@ -219,11 +219,11 @@ func on_mode_link(mode, list):
|
||||
func _on_btn_connect(toggled_on: bool, chk_btn: Node):
|
||||
## Формирование команды для выбора устройства
|
||||
var meta = chk_btn.get_meta('device')
|
||||
Network.write_port_isa(Constants.EMS_G_BASE_ADDR+2, meta[1]) # Отправка команды
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta[1]) # Отправка команды
|
||||
## Формирование команды для отправкы команды на устройство
|
||||
if toggled_on:
|
||||
button_link_meta[meta[1]] += 1 << meta[0]-1
|
||||
else:
|
||||
button_link_meta[meta[1]] -= 1 << meta[0]-1
|
||||
|
||||
Network.write_port_isa(Constants.EMS_G_BASE_ADDR+4, button_link_meta[meta[1]])
|
||||
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+4, button_link_meta[meta[1]])
|
||||
|
||||
Reference in New Issue
Block a user