отладка ДКМ

This commit is contained in:
2025-02-12 00:31:25 +03:00
parent ba047d4c71
commit f682733cfd
11 changed files with 152 additions and 39 deletions

View File

@@ -86,6 +86,7 @@ func _ready() -> void:
node_select_fs_1.set_node_text(0, 7, 'Фильтр CAN')
node_select_fs_1.get_node2(1, 7).placeholder_text = 'в МГц'
node_select_fs_1.get_node2(1, 7).editable = true
node_select_fs_1.set_node_text(0, 8, 'Статус CAN')
var node_select_fs_2 = $TabContainer/PRD/body_grid/litera_3_5_7/fs_control
draw_tabl(node_select_fs_2, Constants.ROWS_FS, Constants.ROWS_FS.size())
@@ -105,6 +106,7 @@ func _ready() -> void:
node_select_fs_2.set_node_text(0, 7, 'Фильтр CAN')
node_select_fs_2.get_node2(1, 7).placeholder_text = 'в МГц'
node_select_fs_2.get_node2(1, 7).editable = true
node_select_fs_2.set_node_text(0, 8, 'Статус CAN')
# Выбор прибора для подключения
var node_select_device = $TabContainer/PRD/select_dev
@@ -139,17 +141,6 @@ 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.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 48)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8])
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 49)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8])
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 51)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8])
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 52)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8])
Network.write_port_isa(Constants.BASE_PORTS.EMS_G+2, 56)
Network.read_port_isa([Constants.BASE_PORTS.EMS_G+8])
Network.connect('yau_status_line', Callable(self, '_on_yau_status'))
Network.connect('yau_receive', Callable(self, '_on_data_received'))
@@ -184,9 +175,6 @@ func _ready() -> void:
node_select_fs_2.get_node2(1, 3).connect('text_submitted', Callable(self, '_on_set_att_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'))
Network.connect_fs_1()
Network.connect_fs_2()
func on_device_selected(selected_index: int) -> void:

View File

@@ -147,7 +147,7 @@ enum DataIndices {
OUT_BLANK_PRD = 13,
OUT_IMPULS_PRD = 19,
DRY_CONTACT = 27,
DKM = 29,
DKM = 28,
POWER_UKP_1 = 31,
TEMPERATURE_UKP_1 = 47,
POWER_UKP_2 = 63,

View File

@@ -47,14 +47,27 @@ func _on_timer(pribor_prd):
func _status_cell(status):
var status_board: int = status.decode_u8(Constants.DataIndices.STATUS_BOARD)
var dry_contact: int = status.decode_u8(Constants.DataIndices.DRY_CONTACT)
var dkm: int = status.decode_u8(Constants.DataIndices.DKM)
$DKM.text = str(dkm)
# status_board
for i in range(1, count_cell-8):
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 = (dkm >> 1) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 2) & 0x1
elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 4) & 0x1
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
#dry_contact
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD):
for i in range(5, count_cell):
@@ -77,17 +90,18 @@ func _status_prd():
status += 1 if (node_cell_ind[count_cell-2].state == Constants.STATE_VAL.GOOD) else 0
if (status == count_cell):
$lbl_control.text = 'Прибор исправен'
$lbl_control.modulate = Color(0,1,0,1)
$lbl_control.modulate = Color.AQUAMARINE
else:
$lbl_control.text = 'Прибор не исправен'
$lbl_control.modulate = Color(1,0,0,1)
$lbl_control.modulate = Color.CRIMSON
else:
if (status == count_cell-2):
$lbl_control.text = 'Прибор исправен'
$lbl_control.modulate = Color(0,1,0,1)
$lbl_control.modulate = Color.AQUAMARINE
else:
$lbl_control.text = 'Прибор не исправен'
$lbl_control.modulate = Color(1,0,0,1)
$lbl_control.modulate = Color.CRIMSON
func _draw_control_panel_prd(pribor):
if pribor == Constants.MODE.PRD_H:
@@ -118,7 +132,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'

View File

@@ -113,8 +113,21 @@ func _ready() -> void:
unit.connect('line_changed', Callable(self, 'on_line_changed'))
unit.connect('command_fail', Callable(self, 'on_command_fail'))
read_port_isa([Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+8, Constants.BASE_PORTS.EMS_G+8])
write_port_isa(Constants.BASE_PORTS.EMS_G+2, 48)
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
write_port_isa(Constants.BASE_PORTS.EMS_G+2, 49)
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
write_port_isa(Constants.BASE_PORTS.EMS_G+2, 51)
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
write_port_isa(Constants.BASE_PORTS.EMS_G+2, 52)
read_port_isa([Constants.BASE_PORTS.EMS_G+8])
write_port_isa(Constants.BASE_PORTS.EMS_G+2, 56)
read_port_isa([Constants.BASE_PORTS.EMS_G+8, Constants.BASE_PORTS.UG+6, Constants.BASE_PORTS.UG+8])
connect_fs_1()
start_work_fs()
connect_fs_2()
start_work_fs_2()
func _process(delta: float) -> void:
@@ -300,8 +313,7 @@ func connect_fs_2():
peerstream_fs_2 = PacketPeerStream.new()
var rc = client_fs_2.connect_to_host(ip_fs_2, Constants.PORT_FS)
if rc!= Error.OK:
print_debug('Port error %s' % ip_fs_2)
#emit_signal("port_error", ip_fs_2)
emit_signal("port_error", ip_fs_2)
else:
peerstream_fs_2.set_stream_peer(client_fs_2)