Доработка ДКМ

This commit is contained in:
TotMaxim
2025-11-14 22:53:46 +03:00
parent 98be72fece
commit e1aaa0b39f
3 changed files with 87 additions and 12 deletions

31
main.gd
View File

@@ -14,14 +14,18 @@ func _ready() -> void:
for soc in sockets:
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')
for socket_power in power_ukp:
var power_ukp_arr_node: Array = get_tree().get_nodes_in_group('power_ukp')
for socket_power in power_ukp_arr_node:
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')
for socket_temp in temperature_ukp:
var temperature_ukp_arr_node: Array = get_tree().get_nodes_in_group('temperature_ukp')
for socket_temp in temperature_ukp_arr_node:
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():
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()
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:
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)
## Функция для установки статусов ДКМ в ПРД
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:
var prep_temperature_ukp1_array: Array = _on_text_temperature_changed(device, 1)