Merge remote-tracking branch 'origin/master' into dev_danil

# Conflicts:
#	scripts/PRD.gd
This commit is contained in:
danil_tim
2025-02-10 13:41:54 +03:00
6 changed files with 49 additions and 70 deletions

View File

@@ -232,22 +232,6 @@ theme_override_font_sizes/font_size = 14
theme_override_styles/pressed = SubResource("StyleBoxFlat_p247y")
text = "Загрузить"
[node name="Litera_3_5_7" type="ColorRect" parent="Background"]
visible = false
layout_mode = 0
offset_top = 48.0
offset_right = 1941.0
offset_bottom = 352.0
color = Color(0.669446, 0.567301, 0.66881, 1)
[node name="Litera_1" type="ColorRect" parent="Background"]
visible = false
layout_mode = 0
offset_top = 359.0
offset_right = 2182.0
offset_bottom = 638.0
color = Color(0.669446, 0.567301, 0.66881, 1)
[node name="ISA" type="Label" parent="."]
offset_left = 225.0
offset_top = 11.0
@@ -280,12 +264,11 @@ theme_override_styles/tab_selected = SubResource("StyleBoxTexture_k08q3")
theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6")
theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6")
tab_alignment = 2
current_tab = 1
current_tab = 0
tab_focus_mode = 0
metadata/_edit_lock_ = true
[node name="PRD" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7")
metadata/_tab_index = 0
@@ -429,6 +412,7 @@ script = ExtResource("2_vmbyo")
node_gap = Vector2(100, 50)
[node name="ControlPanel" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6")
script = ExtResource("9_akagi")

View File

@@ -119,8 +119,6 @@ class FGOS:
var peer = peerstream_fs.get_stream_peer()
if peer:
peer.put_data(data_to_sand)
else:
print_debug('client_fs.get_status != 2 !!!')
#func _parse(rx_data: PackedByteArray):

View File

@@ -116,29 +116,31 @@ func _ready() -> void:
if Constants.ADDRESSES.size() > 0:
get_select_device.select(0)
status_pribor = get_select_device.get_item_text(0).strip_edges().substr(4)
## Заполненение списка модуляции УМ
for key in Constants.OUT_x128:
node_select_yau_07b.get_node2(1, 2).add_item(key)
node_select_yau_07b_2.get_node2(1, 2).add_item(key)
## Заполненение списка направления луча
for key in Constants.RAY_DICT:
node_select_yau_07b.get_node2(1, 3).add_item(key)
node_select_yau_07b_2.get_node2(1, 3).add_item(key)
## Заполненение списка аттенюатора
for key in Constants.ATT_DICT:
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'))
Network.connect('yau_read_isa', Callable(self, '_on_read_isa'))
Network.connect('port_fs_opened_1', _on_port_changed_fs_1.bind(Color.GREEN))
Network.connect('port_fs_opened_2', _on_port_changed_fs_2.bind(Color.GREEN))
Network.connect('port_fs_opened_1', _on_port_changed_fs_1.bind(Color.AQUAMARINE))
Network.connect('port_fs_closed_1', _on_port_changed_fs_1.bind(Color.CRIMSON))
Network.connect('port_fs_opened_2', _on_port_changed_fs_2.bind(Color.AQUAMARINE))
Network.connect('port_fs_closed_2', _on_port_changed_fs_2.bind(Color.CRIMSON))
Network.connect('data_from_fs_1', _on_data_fs_1)
Network.connect('data_from_fs_2', _on_data_fs_2)
@@ -146,13 +148,13 @@ func _ready() -> void:
node_select_yau_07b.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_1'))
node_select_yau_07b.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_1'))
node_select_yau_07b.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_1'))
node_select_yau_07b_2.get_node2(1, 1).get_child(1, false).connect('toggled', Callable(self, '_on_zapret2'))
node_select_yau_07b_2.get_node2(1, 2).connect('item_selected', Callable(self, '_on_modul_um_2'))
node_select_yau_07b_2.get_node2(1, 3).connect('item_selected', Callable(self, '_on_btn_ray_2'))
node_select_yau_07b_2.get_node2(1, 4).connect('item_selected', Callable(self, '_on_attenuator_2'))
node_select_yau_07b_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_fgos_2'))
node_select_fs_1.get_node2(1, 4).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_1'))
node_select_fs_1.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_1'))
node_select_fs_1.get_node2(1, 2).connect('text_submitted', Callable(self, '_on_set_ferq_1'))
@@ -265,7 +267,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
var isa_data: Dictionary = {}
for key in unit_isa_ports.keys():
isa_data[key] = unit_isa_ports[key]
if isa_data.has(Constants.BASE_PORTS.EMS_G+2):
var tmp = isa_data[Constants.BASE_PORTS.EMS_G+2]
isa_data.erase(Constants.BASE_PORTS.EMS_G+2)
@@ -281,7 +283,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
if len(Constants.EMS_G_PORT_DATA_HOLDER) == 32:
emit_signal('read_ems_g_finish')
$ISA.text = 'ISA: ' + str(len(Constants.EMS_G_PORT_DATA_HOLDER))
if isa_data.has(Constants.BASE_PORTS.UG+6):
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[0x106] & 0x7)
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 4).select((isa_data[0x106] & 0x38)>> 3)
@@ -316,6 +318,7 @@ func _on_data_fs_1(fs_1_data):
Constants.CMD.BASE_GET_CURRENT_TEMP:
if GRP == Constants.GROUP.BASE:
node_select_fs_1.set_node_text(1, 5, '%.2f' % fs_1_data.decode_float(0xC) + ' °C')
#$read.text = str(fs_1_data.hex_encode())
func _on_data_fs_2(fs_2_data):
@@ -531,7 +534,7 @@ func _on_modul_um_1(item_from_ray_1: int):
2: 0x4000,
3: 0x8000
}
var modul_um = modul_um_values.get(item_from_ray_1, 0)
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
@@ -548,7 +551,7 @@ func _on_modul_um_2(item_from_ray_1: int):
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+8, modul_um)
## Включение/отключение сигнала ФГОЗ
## Включение/отключение сигнала ФГОЗ
func _on_fgos_2(toggled_on: bool):
var meta = 56
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, meta)
@@ -609,8 +612,9 @@ func set_bits(v, a, m):
## 1 ФС
func _on_port_changed_fs_1(port_name: String, _color: Color) -> void:
func _on_port_changed_fs_1(port_name: String, color: Color) -> void:
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.set_node_text(1, 1, port_name)
$TabContainer/PRD/body_grid/litera_2_4_6/fs_control.get_node2(1,1).modulate = color
func _on_start_fs_1():
@@ -631,8 +635,10 @@ func _on_set_att_1(att: String):
## 2 ФС
func _on_port_changed_fs_2(port_name: String, _color: Color) -> void:
func _on_port_changed_fs_2(port_name: String, color: Color) -> void:
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.set_node_text(1, 1, port_name)
$TabContainer/PRD/body_grid/litera_3_5_7/fs_control.get_node2(1, 1).modulate = color
func _on_start_fs_2():
Network.start_work_fs_2()

View File

@@ -7,11 +7,6 @@ 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,
@@ -32,11 +27,11 @@ 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) # Контроль сухих контактов (УГ)
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:
func _control_pribor(_yau_status:bool) -> void:
#$device.text = str(Constants.CURRENT_MODE)
$soc_y5/ay07.state = Constants.STATE_VAL.GOOD

View File

@@ -97,8 +97,8 @@ func _on_data_received(data_from_yau_07):
var out_imp: int = data_from_yau_07.decode_u16(Constants.DataIndices.OUT_IMPULS_PRD)
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_vert(in_blank, in_imp, 16, 1, 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):
@@ -113,20 +113,18 @@ func process_sockets_horizon(blank: int, imp: int, count: int, col: int, parent_
set_frame(socket_status, frame_type)
if i == 1:
set_frame(get_specific_node(parent_node2, 5), frame_type)
if i == 1: # СИ_2_в_УФ
var CI_2_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(2).get_node2(1, 6).get_child(1)
set_frame(CI_2_UF, frame_type)
if i == 2:
set_frame(get_specific_node(parent_node2, 6), frame_type)
if i == 2: # СИ_3_в_УФ
var CI_3_UF = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(2).get_node2(1, 6).get_child(1)
set_frame(CI_3_UF, frame_type)
if i == 4:
set_frame(get_specific_node(parent_node2, 7), frame_type)
if i == 5:
set_frame(get_specific_node(parent_node2, 8), frame_type)
if i == 9:
set_frame(get_specific_node(parent_node2, 9), frame_type)
if i == 4: # Модуляция_УМ_2
pass
if i == 5: # Модуляция_УМ_3
pass
if i == 9: # ФГОЗ_3
pass
func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_node2: Node):
@@ -141,24 +139,18 @@ func process_sockets_vert(blank: int, imp: int, count: int, col: int, parent_nod
set_frame(socket_status, frame_type)
if i == 1:
set_frame(get_specific_node(parent_node2, 1), frame_type)
if i == 2:
set_frame(get_specific_node(parent_node2, 2), frame_type)
if i == 9:
set_frame(get_specific_node(parent_node2, 3), frame_type)
if i == 1: # СЗИ_2_от_УФ
pass
if i == 2: # СЗИ_3_от_УФ
pass
if i == 9: # СИ_2_от_ФС
var CI_2_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(0).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_2_FS, frame_type)
if i == 10:
set_frame(get_specific_node(parent_node2, 4), frame_type)
if i == 10: # СИ_3_от_ФС
var CI_3_FS = parent_node2.get_child(3).get_child(0).get_child(0).get_child(1).get_child(0).get_node2(1, 6).get_child(1)
set_frame(CI_3_FS, frame_type)
func get_specific_node(parent_node2: Node, child_index: int)-> Node:
return parent_node2.get_child(3, false).get_child(1).get_child(4).get_child(child_index).get_child(3)
func set_frame(node: Node, val: int): node.set_frame(val)

View File

@@ -40,7 +40,8 @@ signal data_from_fs_1(data:PackedByteArray)
signal data_from_fs_2(data:PackedByteArray)
signal port_fs_opened_1(port_name: String)
signal port_fs_opened_2(port_name: String)
signal port_closed(port_name: String)
signal port_fs_closed_1(port_name: String)
signal port_fs_closed_2(port_name: String)
signal port_error(error_str: String)
@@ -78,7 +79,10 @@ func poll_receive_fs(client: StreamPeerTCP, peerstream: PacketPeer, ip_fs: Strin
return
# Проверяем состояние подключения
if client.get_status() != StreamPeerTCP.STATUS_CONNECTED:
emit_signal("port_closed", ip_fs)
if client == client_fs_1:
emit_signal("port_fs_closed_1", ip_fs)
elif client == client_fs_2:
emit_signal("port_fs_closed_2", ip_fs)
return
if peer.get_available_bytes() > 0:
@@ -275,7 +279,7 @@ func set_fs_attenuation(attenuation: float):
func connect_fs_2():
if client_fs_2:
disconnect_fs_2(client_fs_2)
client_fs_2 = StreamPeerTCP.new()
peerstream_fs_2 = PacketPeerStream.new()
var rc = client_fs_2.connect_to_host(ip_fs_2, Constants.PORT_FS)