ДКМ от ДОУ доработан

This commit is contained in:
danil_tim
2025-02-14 11:58:37 +03:00
parent 50b60234d6
commit a77eb98e1a
3 changed files with 49 additions and 32 deletions

View File

@@ -146,7 +146,7 @@ func _ready() -> void:
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)
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'))
@@ -182,7 +182,7 @@ func _ready() -> void:
node_select_fs_2.get_node2(1, 5).get_child(1, false).connect('toggled', Callable(self, '_on_get_status_2'))
node_select_fs_2.get_node2(1, 7).connect('text_submitted', Callable(self, '_on_set_base_can_macro_2'))
node_select_fs_2.get_node2(1, 8).get_child(1, false).connect('toggled', Callable(self, '_on_status_can_macro_2'))
func on_device_selected(selected_index: int) -> void:
var get_select_device = $TabContainer/PRD/select_dev.get_node2(1, 0)
@@ -210,9 +210,9 @@ 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))
$TabContainer/EMS_G/load_boadr/win_load.material.set('shader_parameter/dot_color_end', Color(0.8, 0.5, 1.0, 1.0 - 0.05 * len(Constants.EMS_G_PORT_DATA_HOLDER)))
if isa_data.has(Constants.BASE_PORTS.UG+6):
if (isa_data[Constants.BASE_PORTS.UG+6] & 0x7) < 7:
$TabContainer/PRD/body_grid/litera_2_4_6/yau07b_control.get_node2(1, 3).select(isa_data[Constants.BASE_PORTS.UG+6] & 0x7)
@@ -225,7 +225,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1, 4).select((isa_data[Constants.BASE_PORTS.UG+8] & 0x38)>>3)
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/turn', 0.735 + 0.025 * (isa_data[Constants.BASE_PORTS.UG+8] & 0x7))
$TabContainer/PRD/body_grid/litera_3_5_7/PSK2/ray_2.material.set('shader_parameter/inner_radius', 0.8 - 0.01 * (isa_data[Constants.BASE_PORTS.UG+8] & 0x38))
for index in Constants.EMS_G_PORT_DATA_HOLDER.size():
var tmp_device_mode = Constants.EMS_G_PORT_DATA_HOLDER[index][0]
if tmp_device_mode == 48:
@@ -250,7 +250,7 @@ func _on_read_isa(unit_isa_ports: Dictionary) -> void:
var data_dict = Constants.EMS_G_PORT_DATA_HOLDER[index][1]
if Constants.BASE_PORTS.EMS_G+8 in data_dict:
$TabContainer/PRD/body_grid/litera_3_5_7/yau07b_control.get_node2(1,5).get_child(1).button_pressed = data_dict[Constants.BASE_PORTS.EMS_G+8] >> 13
func _on_data_fs_1(fs_1_data):
var node_select_fs_1: GDTable = $TabContainer/PRD/body_grid/litera_2_4_6/fs_control
@@ -318,7 +318,7 @@ func _on_data_fs_2(fs_2_data):
func draw_tabl(tbl: Node, row: Array, count_row: int):
for i_row in count_row:
tbl.add_row(row[i_row])
func _on_data_received(data_from_yau_07):
## УКП
@@ -598,12 +598,12 @@ func _on_set_ferq_1(freq: String):
return
# Преобразование строки в число
var freq_int = int(freq) * 1_000_000
# Проверка на диапазон
if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
print_debug('Некорректная частота')
return
Network.set_fs_ferq_carrier(freq_int)
@@ -643,7 +643,7 @@ func _on_set_ferq_2(freq: String):
return
# Преобразование строки в число
var freq_int = int(freq) * 1_000_000
# Проверка на диапазон
if freq_int < 370 * 1_000_000 or freq_int > 6100 * 1_000_000:
print_debug('Некорректная частота')

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'

View File

@@ -7,13 +7,13 @@ var past_pribor: int
func _ready() -> void:
Network.connect('port_fs_opened_1', _on_fs_status_1.bind(Constants.STATE_VAL.GOOD))
Network.connect('port_fs_closed_1', _on_fs_status_1.bind(Constants.STATE_VAL.ERROR))
Network.connect('port_fs_closed_1', _on_fs_status_1.bind(Constants.STATE_VAL.NONE))
Network.connect('port_fs_opened_2', _on_fs_status_2.bind(Constants.STATE_VAL.GOOD))
Network.connect('port_fs_closed_2', _on_fs_status_2.bind(Constants.STATE_VAL.ERROR))
Network.connect('port_fs_closed_2', _on_fs_status_2.bind(Constants.STATE_VAL.NONE))
self.add_child(timer)
timer.connect('timeout', Callable(self, '_on_timer').bind(Network.unit))
timer.start(1)
@@ -34,7 +34,14 @@ func _ready() -> void:
$soc_P2/IP9_50,
$soc_P2/IP12_50,
$soc_y5/IP5_25]
$soc_y5/IP5_25,
$Kasseta_FS/ref_A3,
$Kasseta_FS/ref_A1,
$Kasseta_FS/ref_A2,
$Kasseta_FS/ref_A4,
$Kasseta_FS/Block_FS_PRD_K,
$Kasseta_FS/FS_PRD_K]
count_cell = len(node_cell_ind)
@@ -58,45 +65,56 @@ func _status_cell(status):
var dkm: int = status.decode_u8(Constants.DataIndices.DKM)
$DKM.text = str(dkm)
# status_board
for i in range(1, count_cell-8):
for i in range(1, 5):
if ((status_board >> (i-1)) & 0x1) == 1:
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
else:
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
#dkm
if Constants.CURRENT_MODE == Constants.MODE.PRD_H:
$soc_DKM/DKM_2.state = 1 if (dkm >> 1) & 0x1 else 3
$soc_DKM/DKM_2.state = (dkm >> 1) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 2) & 0x1
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 6) & 0x1
$Kasseta_FS/Block_FS_PRD_K.state = $soc_DKM/DKM_1.state
$Kasseta_FS/ref_A3.state = $soc_DKM/DKM_2.state
$Kasseta_FS/ref_A4.state = $soc_DKM/DKM_3.state
#dry_contact
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
for i in range(5, count_cell):
for i in range(5, 13):
if ((dry_contact >> (i-5)) & 0x1) == 0:
node_cell_ind[i].state = Constants.STATE_VAL.GOOD
else:
node_cell_ind[i].state = Constants.STATE_VAL.ERROR
else:
for i in range(5, count_cell):
for i in range(5, 13):
node_cell_ind[i].state = Constants.STATE_VAL.NONE
func _status_prd():
var status: int = 0
for i in range(count_cell-3):
for i in range(10):
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
for i in range(12, count_cell-2):
status += 1 if (node_cell_ind[i].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[count_cell-1].state == Constants.STATE_VAL.GOOD) else 0
if (Constants.CURRENT_MODE == Constants.MODE.PRD_K):
status += 1 if (node_cell_ind[count_cell-3].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[count_cell-2].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[10].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[11].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[12].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[17].state == Constants.STATE_VAL.GOOD) else 0
status += 1 if (node_cell_ind[18].state == Constants.STATE_VAL.GOOD) else 0
if (status == count_cell):
$lbl_control.text = 'Прибор исправен'
$lbl_control.modulate = Color.AQUAMARINE
@@ -104,7 +122,7 @@ func _status_prd():
$lbl_control.text = 'Прибор неисправен'
$lbl_control.modulate = Color.CRIMSON
else:
if (status == count_cell-2):
if (status == count_cell-5):
$lbl_control.text = 'Прибор исправен'
$lbl_control.modulate = Color.AQUAMARINE
else:
@@ -141,12 +159,12 @@ func _draw_control_panel_prd(pribor):
$soc_P1/MAA_2.rname = 'А23'
# Кассета П-2
$soc_P2.visible = false
# ДКМ
$soc_DKM/DKM_1.visible = false
$soc_DKM/DKM_2.fname = 'ДКМ2'
$soc_DKM/DKM_3.fname = 'ДКМ3'
elif pribor == Constants.MODE.PRD_B:
# Кассета У5
$soc_y5/IP5_25.rname = 'А24'
@@ -216,4 +234,3 @@ func _on_fs_status_1(_name_port, status_fs_1):
func _on_fs_status_2(_name_port, status_fs_2):
$Kasseta_FS/ref_A2.state = status_fs_2