Доработка ДКМ
This commit is contained in:
31
main.gd
31
main.gd
@@ -14,14 +14,18 @@ func _ready() -> void:
|
|||||||
for soc in sockets:
|
for soc in sockets:
|
||||||
soc.connect('toggled', _on_modify_sockets.bind(soc.get_meta('bit'), soc.get_meta('device'))) ## Мета bit от 0 до 3, мета ПРД
|
soc.connect('toggled', _on_modify_sockets.bind(soc.get_meta('bit'), soc.get_meta('device'))) ## Мета bit от 0 до 3, мета ПРД
|
||||||
|
|
||||||
var power_ukp: Array = get_tree().get_nodes_in_group('power_ukp')
|
var power_ukp_arr_node: Array = get_tree().get_nodes_in_group('power_ukp')
|
||||||
for socket_power in power_ukp:
|
for socket_power in power_ukp_arr_node:
|
||||||
socket_power.connect('text_submitted', _on_ukp_submitted.bind(socket_power.get_meta('device')))
|
socket_power.connect('text_submitted', _on_ukp_submitted.bind(socket_power.get_meta('device')))
|
||||||
|
|
||||||
var temperature_ukp: Array = get_tree().get_nodes_in_group('temperature_ukp')
|
var temperature_ukp_arr_node: Array = get_tree().get_nodes_in_group('temperature_ukp')
|
||||||
for socket_temp in temperature_ukp:
|
for socket_temp in temperature_ukp_arr_node:
|
||||||
socket_temp.connect('text_submitted', _on_ukp_submitted.bind(socket_temp.get_meta('device')))
|
socket_temp.connect('text_submitted', _on_ukp_submitted.bind(socket_temp.get_meta('device')))
|
||||||
|
|
||||||
|
var dkm_arr_node: Array = get_tree().get_nodes_in_group('dkm')
|
||||||
|
for dkm in dkm_arr_node:
|
||||||
|
dkm.connect('toggled', _on_modify_dkm.bind(dkm.get_meta('bit'), dkm.get_meta('device')))
|
||||||
|
|
||||||
|
|
||||||
func _exit_tree():
|
func _exit_tree():
|
||||||
for device in dictionary_yau07:
|
for device in dictionary_yau07:
|
||||||
@@ -39,12 +43,6 @@ func on_modify_device(toggled: bool, name_device: String) -> void:
|
|||||||
dictionary_yau07[name_device].close_udp_unit()
|
dictionary_yau07[name_device].close_udp_unit()
|
||||||
|
|
||||||
|
|
||||||
func _process(_delta: float) -> void:
|
|
||||||
for device in dictionary_yau07.keys():
|
|
||||||
if dictionary_yau07[device]:
|
|
||||||
dictionary_yau07[device].poll_receive()
|
|
||||||
|
|
||||||
|
|
||||||
## Функция для установки статусов ячеек на связи (УГ, ЭМС-Г, УКП)
|
## Функция для установки статусов ячеек на связи (УГ, ЭМС-Г, УКП)
|
||||||
func _on_modify_sockets(toggled: bool, bit: int, device: String)->void:
|
func _on_modify_sockets(toggled: bool, bit: int, device: String)->void:
|
||||||
if dictionary_yau07.has(device):
|
if dictionary_yau07.has(device):
|
||||||
@@ -52,6 +50,19 @@ func _on_modify_sockets(toggled: bool, bit: int, device: String)->void:
|
|||||||
udp_unit.sockets_status_bit = _set_bit(udp_unit.sockets_status_bit, bit, toggled)
|
udp_unit.sockets_status_bit = _set_bit(udp_unit.sockets_status_bit, bit, toggled)
|
||||||
|
|
||||||
|
|
||||||
|
## Функция для установки статусов ДКМ в ПРД
|
||||||
|
func _on_modify_dkm(toggled: bool, bit: int, device: String)->void:
|
||||||
|
if dictionary_yau07.has(device):
|
||||||
|
var udp_unit = dictionary_yau07[device]
|
||||||
|
udp_unit.dkm_status_bit = _set_bit(udp_unit.dkm_status_bit, bit, toggled)
|
||||||
|
|
||||||
|
|
||||||
|
func _process(_delta: float) -> void:
|
||||||
|
for device in dictionary_yau07.keys():
|
||||||
|
if dictionary_yau07[device]:
|
||||||
|
dictionary_yau07[device].poll_receive()
|
||||||
|
|
||||||
|
|
||||||
## Функция для установки значений в ячейках УКП
|
## Функция для установки значений в ячейках УКП
|
||||||
func _on_ukp_submitted(_new_text: String, device: String) -> void:
|
func _on_ukp_submitted(_new_text: String, device: String) -> void:
|
||||||
var prep_temperature_ukp1_array: Array = _on_text_temperature_changed(device, 1)
|
var prep_temperature_ukp1_array: Array = _on_text_temperature_changed(device, 1)
|
||||||
|
|||||||
63
main.tscn
63
main.tscn
@@ -99,7 +99,7 @@ layout_mode = 0
|
|||||||
offset_left = 187.0
|
offset_left = 187.0
|
||||||
offset_top = 19.0
|
offset_top = 19.0
|
||||||
offset_right = 1147.0
|
offset_right = 1147.0
|
||||||
offset_bottom = 338.0
|
offset_bottom = 395.0
|
||||||
current_tab = 0
|
current_tab = 0
|
||||||
use_hidden_tabs_for_min_size = true
|
use_hidden_tabs_for_min_size = true
|
||||||
tab_focus_mode = 0
|
tab_focus_mode = 0
|
||||||
@@ -333,6 +333,25 @@ layout_mode = 2
|
|||||||
placeholder_text = "0"
|
placeholder_text = "0"
|
||||||
metadata/device = "ПРД-Н1"
|
metadata/device = "ПРД-Н1"
|
||||||
|
|
||||||
|
[node name="dkm" type="GridContainer" parent="TabContainer/ПРД-Н1"]
|
||||||
|
layout_mode = 0
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 201.0
|
||||||
|
offset_right = 50.0
|
||||||
|
offset_bottom = 241.0
|
||||||
|
|
||||||
|
[node name="CheckBox" type="CheckBox" parent="TabContainer/ПРД-Н1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 2"
|
||||||
|
metadata/bit = 1
|
||||||
|
metadata/device = "ПРД-Н1"
|
||||||
|
|
||||||
|
[node name="CheckBox2" type="CheckBox" parent="TabContainer/ПРД-Н1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 3"
|
||||||
|
metadata/bit = 2
|
||||||
|
metadata/device = "ПРД-Н1"
|
||||||
|
|
||||||
[node name="ПРД-В1" type="Panel" parent="TabContainer" groups=["prd"]]
|
[node name="ПРД-В1" type="Panel" parent="TabContainer" groups=["prd"]]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -561,6 +580,24 @@ layout_mode = 2
|
|||||||
metadata/place = 13
|
metadata/place = 13
|
||||||
metadata/device = "ПРД-В1"
|
metadata/device = "ПРД-В1"
|
||||||
|
|
||||||
|
[node name="dkm" type="GridContainer" parent="TabContainer/ПРД-В1"]
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 201.0
|
||||||
|
offset_right = 50.0
|
||||||
|
offset_bottom = 241.0
|
||||||
|
|
||||||
|
[node name="CheckBox" type="CheckBox" parent="TabContainer/ПРД-В1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 4"
|
||||||
|
metadata/bit = 3
|
||||||
|
metadata/device = "ПРД-В1"
|
||||||
|
|
||||||
|
[node name="CheckBox2" type="CheckBox" parent="TabContainer/ПРД-В1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 5"
|
||||||
|
metadata/bit = 4
|
||||||
|
metadata/device = "ПРД-В1"
|
||||||
|
|
||||||
[node name="ПРД-К1" type="Panel" parent="TabContainer" groups=["prd"]]
|
[node name="ПРД-К1" type="Panel" parent="TabContainer" groups=["prd"]]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
@@ -820,6 +857,30 @@ layout_mode = 2
|
|||||||
metadata/place = 13
|
metadata/place = 13
|
||||||
metadata/device = "ПРД-К1"
|
metadata/device = "ПРД-К1"
|
||||||
|
|
||||||
|
[node name="dkm" type="GridContainer" parent="TabContainer/ПРД-К1"]
|
||||||
|
offset_left = 10.0
|
||||||
|
offset_top = 201.0
|
||||||
|
offset_right = 50.0
|
||||||
|
offset_bottom = 241.0
|
||||||
|
|
||||||
|
[node name="CheckBox" type="CheckBox" parent="TabContainer/ПРД-К1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 1"
|
||||||
|
metadata/bit = 0
|
||||||
|
metadata/device = "ПРД-К1"
|
||||||
|
|
||||||
|
[node name="CheckBox2" type="CheckBox" parent="TabContainer/ПРД-К1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 6"
|
||||||
|
metadata/bit = 5
|
||||||
|
metadata/device = "ПРД-К1"
|
||||||
|
|
||||||
|
[node name="CheckBox3" type="CheckBox" parent="TabContainer/ПРД-К1/dkm" groups=["dkm"]]
|
||||||
|
layout_mode = 2
|
||||||
|
text = "ДКМ 7"
|
||||||
|
metadata/bit = 6
|
||||||
|
metadata/device = "ПРД-К1"
|
||||||
|
|
||||||
[node name="ПРД-Н2" type="Panel" parent="TabContainer" groups=["prd"]]
|
[node name="ПРД-Н2" type="Panel" parent="TabContainer" groups=["prd"]]
|
||||||
visible = false
|
visible = false
|
||||||
layout_mode = 2
|
layout_mode = 2
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ var _socket: SocketUDP
|
|||||||
var self_name: String
|
var self_name: String
|
||||||
var _timer: Timer
|
var _timer: Timer
|
||||||
var sockets_status_bit: int = 0
|
var sockets_status_bit: int = 0
|
||||||
|
var dkm_status_bit: int = 0
|
||||||
|
|
||||||
var ukp0_data: PackedByteArray:
|
var ukp0_data: PackedByteArray:
|
||||||
set(v):
|
set(v):
|
||||||
ukp0_data = v
|
ukp0_data = v
|
||||||
@@ -122,7 +124,8 @@ func _form_status_packet() -> PackedByteArray:
|
|||||||
buf.encode_u16(9 + i * 2, ems_g_data[i])
|
buf.encode_u16(9 + i * 2, ems_g_data[i])
|
||||||
|
|
||||||
# Данные UG (байты 35-38)
|
# Данные UG (байты 35-38)
|
||||||
buf.encode_u16(35, 0x0000) # 00 00
|
buf.encode_u8(35, 0x00)
|
||||||
|
buf.encode_u8(36, dkm_status_bit)
|
||||||
buf.encode_u16(37, 0x059e) # 9e 05
|
buf.encode_u16(37, 0x059e) # 9e 05
|
||||||
|
|
||||||
# Данные UKP0 (байты 39-70)
|
# Данные UKP0 (байты 39-70)
|
||||||
|
|||||||
Reference in New Issue
Block a user