морда контроля

This commit is contained in:
danil_tim
2025-02-10 13:02:26 +03:00
parent 3524937a90
commit 2e8082a26a
13 changed files with 245 additions and 138 deletions

View File

@@ -458,61 +458,48 @@ offset_left = 9.0
offset_top = 34.0
offset_right = 59.0
offset_bottom = 184.0
textures = Array[Texture]([])
fname = "ИП5-25"
rname = "A24"
metadata/_edit_lock_ = true
[node name="ay07" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")]
offset_left = 59.0
offset_top = 34.0
offset_right = 109.0
offset_bottom = 184.0
textures = Array[Texture]([])
fname = "ЯУ-07"
rname = "A30"
metadata/_edit_lock_ = true
[node name="ems_g" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")]
offset_left = 109.0
offset_top = 34.0
offset_right = 159.0
offset_bottom = 184.0
textures = Array[Texture]([])
fname = "ЭМС-Г"
rname = "A26"
metadata/_edit_lock_ = true
[node name="ug" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")]
offset_left = 159.0
offset_top = 34.0
offset_right = 209.0
offset_bottom = 184.0
textures = Array[Texture]([])
fname = "УГ"
rname = "A27"
metadata/_edit_lock_ = true
[node name="ukp_1" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")]
offset_left = 209.0
offset_top = 34.0
offset_right = 259.0
offset_bottom = 183.0
textures = Array[Texture]([])
self_size = Vector2i(50, 149)
fname = "УКП-1"
rname = "A28"
metadata/_edit_lock_ = true
[node name="ukp_2" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")]
offset_left = 259.0
offset_top = 34.0
offset_right = 309.0
offset_bottom = 184.0
textures = Array[Texture]([])
fname = "УКП-2"
rname = "A29"
metadata/_edit_lock_ = true
[node name="ukp_1" parent="TabContainer/ControlPanel/soc_y5" instance=ExtResource("11_fg7ul")]
offset_left = 210.0
offset_top = 35.0
offset_right = 260.0
offset_bottom = 185.0
fname = "УКП-1"
rname = "A28"
[node name="Kasseta" type="Label" parent="TabContainer/ControlPanel/soc_y5"]
self_modulate = Color(1, 1, 1, 0.62)
@@ -543,14 +530,12 @@ offset_bottom = 33.0
text = "Кассета ФС-НД"
horizontal_alignment = 1
vertical_alignment = 1
metadata/_edit_lock_ = true
[node name="ref_A3" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")]
offset_left = 109.0
offset_top = 41.0
offset_right = 159.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 170)
fname = "БЛОК ФС-2"
rname = "A3"
@@ -560,7 +545,6 @@ offset_left = 159.0
offset_top = 41.0
offset_right = 209.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 170)
fname = "Модуль ФС"
rname = "A1"
@@ -570,7 +554,6 @@ offset_left = 209.0
offset_top = 41.0
offset_right = 259.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 170)
fname = "Модуль ФС"
rname = "A2"
@@ -580,17 +563,15 @@ offset_left = 259.0
offset_top = 41.0
offset_right = 309.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 170)
fname = "БЛОК ФС-3"
rname = "A4"
[node name="Block_FS_PRD_K" parent="TabContainer/ControlPanel/Kasseta_FS" instance=ExtResource("11_fg7ul")]
offset_left = 12.0
offset_top = 41.0
offset_top = 40.0
offset_right = 62.0
offset_bottom = 211.0
textures = Array[Texture]([])
offset_bottom = 210.0
self_size = Vector2i(50, 170)
fname = "БЛОК ФС-1"
rname = "A4"
@@ -600,7 +581,6 @@ offset_left = 61.0
offset_top = 41.0
offset_right = 111.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 170)
fname = "Модуль ФС"
rname = "A1"
@@ -633,7 +613,6 @@ offset_left = -64.0
offset_top = 37.0
offset_right = -14.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "МАА2000"
rname = "А22"
@@ -643,7 +622,6 @@ offset_left = 203.0
offset_top = 36.0
offset_right = 253.0
offset_bottom = 210.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "МАА2000"
rname = "А23"
@@ -653,7 +631,6 @@ offset_left = 129.0
offset_top = 37.0
offset_right = 179.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП9-50"
rname = "А19"
@@ -663,7 +640,6 @@ offset_left = 73.0
offset_top = 37.0
offset_right = 123.0
offset_bottom = 211.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП9-50"
rname = "А20"
@@ -696,7 +672,6 @@ offset_left = 16.0
offset_top = 36.0
offset_right = 66.0
offset_bottom = 210.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП12-50"
rname = "А21"
@@ -729,7 +704,6 @@ offset_left = 81.0
offset_top = 36.0
offset_right = 131.0
offset_bottom = 210.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП12-50"
rname = "A25"
@@ -739,7 +713,6 @@ offset_left = 24.0
offset_top = 36.0
offset_right = 74.0
offset_bottom = 210.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП9-50"
rname = "A22"

View File

@@ -131,7 +131,7 @@ func _ready() -> void:
node_select_yau_07b.get_node2(1, 4).add_item(key)
node_select_yau_07b_2.get_node2(1, 4).add_item(key)
draw_control_panel_prd(Constants.ADDRESSES[0][3])
#draw_control_panel_prd(Constants.ADDRESSES[0][3])
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
Network.connect('yau_receive', Callable(self, '_on_data_received'))
@@ -490,8 +490,6 @@ func on_btn_select(intem_from_sector: int) -> void:
var get_select_device = node_select_device.get_node2(1, 0)
var meta = get_select_device.get_item_metadata(intem_from_sector)
Network.on_command_change_device(meta)
flag_mode = meta[2]
draw_control_panel_prd(flag_mode)
_on_start_fs_1()
Constants.CURRENT_MODE = meta[2]
draw_control_panel_prd(Constants.CURRENT_MODE)

View File

@@ -1,6 +1,6 @@
extends Node
const UNICAST_PORT: int = 50003
const UNICAST_ADDRESS: String = '10.1.1.3'
const UNICAST_PORT: int = 50014
const UNICAST_ADDRESS: String = '10.1.1.14'
const BROADCAST_PORT: int = 50000
const DEFAULT_ADDRESS: String = '10.1.1.11'
const DEFAULT_PORT: String = '50011'
@@ -162,6 +162,11 @@ enum STATE {
SEND,
}
enum STATE_VAL {
NONE = 0,
GOOD = 1,
ERROR = 2 }
var EMS_G_PORT_DATA_HOLDER: Array = []
# Таблица CRC-32 для модуля ФС

View File

@@ -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

View File

@@ -46,7 +46,7 @@ func poll_receive_yau07(sock: Socket) -> bool: ## Приёмник
broadcast_packet = sock.get_packet()
var addr_receive = sock.get_packet_ip()
var port_receive = sock.get_packet_port()
if (ip_address_yau == addr_receive) and (ip_port_yau == port_receive):
last_update_time_yau07 = 0.0
unit.parse(broadcast_packet)
@@ -69,7 +69,7 @@ func poll_receive_fs(client: StreamPeerTCP):
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
emit_signal("port_closed", ip_fs_1)
return
if peer.get_available_bytes() > 0:
var rx_data: PackedByteArray
rx_data.append_array(peer.get_data(peer.get_available_bytes())[1])
@@ -85,11 +85,11 @@ func _ready() -> void:
var rc = soc_brodcast.bind(Constants.BROADCAST_PORT, '*')
if rc != OK:
print_debug('Ошибка: Неудачная привязка широковещательного адреса')
soc_unicast = Socket.new()
rc = soc_unicast.bind(Constants.UNICAST_PORT, Constants.UNICAST_ADDRESS)
if rc != OK:
print_debug('Ошибка: неудачная привязка адреса: ', ip_address_yau)
print_debug('Ошибка: неудачная привязка адреса: ', ip_address_yau)
unit.connect('line_changed', Callable(self, 'on_line_changed'))
unit.connect('command_fail', Callable(self, 'on_command_fail'))
@@ -101,16 +101,16 @@ func _process(delta: float) -> void:
last_update_time_yau07 += delta
last_update_time_fs += delta
if client_fs_1:
poll_receive_fs(client_fs_1)
poll_receive_yau07(soc_brodcast)
poll_receive_yau07(soc_unicast)
state_machine_yau07()
state_machine_fs()
match unit.process(delta):
Error.OK: soc_unicast.send_to(ip_address_yau, ip_port_yau, unit.tx_data.slice(0, unit.tx_len))
Error.FAILED: print_debug('Ошибка отправки данных')
@@ -142,12 +142,12 @@ func state_machine_yau07():
state = Constants.STATE.WAIT
# Записать команду в ИСА
# Записать команду в ИСА
func read_port_isa(read_ports: Array) -> void:
send_array.append(['rd', read_ports])
# Прочитать данные из порта от ИСА
# Прочитать данные из порта от ИСА
func write_port_isa(port_isa: int, data_isa: int) -> void:
var write_data: Dictionary = {port_isa: data_isa}
send_array.append(['wr', write_data])
@@ -185,7 +185,7 @@ func state_machine_fs():
func connect_fs():
if client_fs_1:
disconnect_fs(client_fs_1)
client_fs_1 = StreamPeerTCP.new()
peerstream_fs_1 = PacketPeerStream.new()
var rc = client_fs_1.connect_to_host(ip_fs_1, Constants.PORT_FS)
@@ -201,7 +201,7 @@ func send_data(data_to_sand: PackedByteArray):
var peer = peerstream_fs_1.get_stream_peer()
if peer:
peer.put_data(data_to_sand)
emit_signal("data_send")
emit_signal("data_send")
# Разорвать соединение с ФС

View File

@@ -0,0 +1,86 @@
@tool
extends PanelContainer
func set_text(val: String): $button.set_text(val)
func set_pressed(val: bool): $button.set_pressed(val)
func set_disabled(val: bool): disabled = val
func get_text(): return $button.get_text()
func is_pressed(): return $button.is_pressed()
func is_toggle_mode(): return $button.is_toggle_mode()
@export var texture_state0: Texture2D = preload('res://table/элемент-в.tscn::GradientTexture2D_d3qtt'):
set(val): $state.set_texture(val)
@export var texture_state1: Texture2D = preload('res://table/элемент-в.tscn::GradientTexture2D_k8o6s'):
set(val): $state.set_texture(val)
@export var strips_rotation: float = 0.0:
set(val):
strips_rotation = val
$back.strips_rotation = deg_to_rad(val)
get: return strips_rotation
@export var text: String = '':
set(val): $button.set_text(val)
get: return $button.get_text()
@export var disabled: bool = false:
set(val):
disabled = val
$button.set_disabled(val)
$back.disabled = val
$state.modulate.a = 0.5 if val else 1.0
get: return disabled
@export var pressed: bool = false:
set(val):
pressed = val
$button.set_pressed(val)
get:
return pressed
@export var toggle_mode: bool = false:
set(val):
toggle_mode = val
$button.set_toggle_mode(val)
get:
return toggle_mode
func button_connect(button_signal: String, proc: Callable):
var rc = $button.connect(button_signal, proc)
if rc != Error.OK:
push_error('возникла ошибка \"%s\" при подключении сигнала \"%s\" к обработчику \"%s\"' % [error_string(rc), button_signal, proc])
func _on_resized() -> void:
$back.scale = size
$back.material.set('shader_parameter/scale', size / Vector2(20.0, 20.0))
func _enter_tree() -> void:
$back.scale = size
$back.material.set('shader_parameter/scale', size / Vector2(20.0, 20.0))
$button.set_toggle_mode(true)
$button.connect('toggled', _on_button_toggled)
func _exit_tree() -> void:
$button.disconnect('toggled', _on_button_toggled)
func set_toggle_mode(val: bool):
$button.set_toggle_mode(val)
func _on_button_toggled(val: bool):
if val: $state.set_texture(texture_state1)
else: $state.set_texture(texture_state0)

View File

@@ -1,8 +1,11 @@
[gd_scene load_steps=15 format=3 uid="uid://p2suppildvq0"]
[gd_scene load_steps=12 format=3 uid="uid://p2suppildvq0"]
[ext_resource type="Texture2D" uid="uid://ce3qpf070wgd2" path="res://состояние-исправности-0.png" id="1_2n7he"]
[ext_resource type="Texture2D" uid="uid://cgtg4gbqnuxrc" path="res://nine-patch-round.png" id="2_4b43i"]
[ext_resource type="Texture2D" uid="uid://byweg7pgt8o4h" path="res://состояние-исправности-1.png" id="2_38t58"]
[ext_resource type="Shader" path="res://opt_btn.gdshader" id="2_ecsml"]
[ext_resource type="Texture2D" uid="uid://dkef6xwxwdxi8" path="res://эмс-бланк.png" id="3_4kmgr"]
[ext_resource type="Texture2D" uid="uid://bvikuv0lbvou8" path="res://состояние-исправности-2.png" id="3_i2t3v"]
[ext_resource type="Texture2D" uid="uid://b15flrfytxkop" path="res://эмс-бланк-пост.png" id="4_omove"]
[ext_resource type="Texture2D" uid="uid://ijdfo2mml54" path="res://эмс-бланк-перем.png" id="5_jia67"]
@@ -44,8 +47,8 @@ func _resize_children() -> void:
$lbl_rname.position.y = margins[0]
$lbl_fname.size.y = size.x
$lbl_fname.position.y = size.y / 2 + $lbl_fname.size.x / 2
$light_ind.position.x = size.x / 2 - ($light_ind.size.x * $light_ind.scale.x) / 2
$light_ind.position.y = size.y - $light_ind.size.y * $light_ind.scale.x - margins[2]
$txr_state.position.x = size.x / 2 - ($txr_state.size.x * $txr_state.scale.x) / 2
$txr_state.position.y = size.y - $txr_state.size.y * $txr_state.scale.x - margins[2]
func _on_nine_patch_rect_resized() -> void:
@@ -75,37 +78,6 @@ shader = ExtResource("2_ecsml")
shader_parameter/range = 0.4
shader_parameter/color = Color(0.764706, 0.764706, 0.764706, 1)
[sub_resource type="Gradient" id="Gradient_x8k3w"]
colors = PackedColorArray(1, 1, 1, 1, 0.393086, 0.393086, 0.393085, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_cgu2r"]
gradient = SubResource("Gradient_x8k3w")
width = 25
height = 25
fill = 1
fill_from = Vector2(0.5, 0.5)
fill_to = Vector2(1.125, 0)
[sub_resource type="Gradient" id="Gradient_1tk1g"]
colors = PackedColorArray(0.1, 1, 0.1, 1, 0.124744, 0.328804, 0.202483, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_d3qtt"]
gradient = SubResource("Gradient_1tk1g")
width = 25
height = 25
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="Gradient" id="Gradient_6e32x"]
colors = PackedColorArray(1, 0.1, 0.1, 1, 0.329, 0.125, 0.202, 1)
[sub_resource type="GradientTexture2D" id="GradientTexture2D_k8o6s"]
gradient = SubResource("Gradient_6e32x")
width = 25
height = 25
fill = 1
fill_from = Vector2(0.5, 0.5)
[sub_resource type="SpriteFrames" id="SpriteFrames_nofpw"]
animations = [{
"frames": [{
@@ -133,7 +105,7 @@ anchors_preset = 0
offset_right = 50.0
offset_bottom = 150.0
script = SubResource("GDScript_fbktk")
textures = Array[Texture]([ExtResource("2_4b43i"), ExtResource("2_4b43i"), ExtResource("2_4b43i")])
textures = Array[Texture]([ExtResource("1_2n7he"), ExtResource("2_38t58"), ExtResource("3_i2t3v")])
metadata/ref_des = ""
metadata/dec_num = ""
@@ -160,19 +132,16 @@ text = "Ячейка"
horizontal_alignment = 1
vertical_alignment = 1
[node name="light_ind" type="TextureButton" parent="."]
[node name="txr_state" type="TextureRect" parent="."]
material = SubResource("ShaderMaterial_45ast")
layout_mode = 0
offset_left = 13.0
offset_top = 114.0
offset_right = 38.0
offset_bottom = 139.0
offset_left = 14.0
offset_top = 116.0
offset_right = 238.0
offset_bottom = 340.0
scale = Vector2(0.1, 0.1)
size_flags_vertical = 6
toggle_mode = true
button_mask = 0
texture_normal = SubResource("GradientTexture2D_cgu2r")
texture_pressed = SubResource("GradientTexture2D_d3qtt")
texture_disabled = SubResource("GradientTexture2D_k8o6s")
texture = ExtResource("1_2n7he")
[node name="np_rect" type="NinePatchRect" parent="."]
layout_mode = 0

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ce3qpf070wgd2"
path="res://.godot/imported/состояние-исправности-0.png-5c54b931fdcaaeea20ccd26e18d4b7de.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://состояние-исправности-0.png"
dest_files=["res://.godot/imported/состояние-исправности-0.png-5c54b931fdcaaeea20ccd26e18d4b7de.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://byweg7pgt8o4h"
path="res://.godot/imported/состояние-исправности-1.png-3675cd90cab151ef6fac9b2e3babeb44.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://состояние-исправности-1.png"
dest_files=["res://.godot/imported/состояние-исправности-1.png-3675cd90cab151ef6fac9b2e3babeb44.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://bvikuv0lbvou8"
path="res://.godot/imported/состояние-исправности-2.png-deccaddb215e53d76d5a2f5971888569.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://состояние-исправности-2.png"
dest_files=["res://.godot/imported/состояние-исправности-2.png-deccaddb215e53d76d5a2f5971888569.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1