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

# Conflicts:
#	scripts/control_panel.gd
This commit is contained in:
2025-02-14 15:07:15 +03:00
4 changed files with 62 additions and 59 deletions

View File

@@ -312,11 +312,12 @@ theme_override_styles/tab_selected = SubResource("StyleBoxTexture_k08q3")
theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6") theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6")
theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6") theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6")
tab_alignment = 2 tab_alignment = 2
current_tab = 0 current_tab = 1
tab_focus_mode = 0 tab_focus_mode = 0
metadata/_edit_lock_ = true metadata/_edit_lock_ = true
[node name="PRD" type="Panel" parent="TabContainer"] [node name="PRD" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7") theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7")
metadata/_tab_index = 0 metadata/_tab_index = 0
@@ -460,7 +461,6 @@ script = ExtResource("2_vmbyo")
node_gap = Vector2(100, 50) node_gap = Vector2(100, 50)
[node name="ControlPanel" type="Panel" parent="TabContainer"] [node name="ControlPanel" type="Panel" parent="TabContainer"]
visible = false
layout_mode = 2 layout_mode = 2
theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6") theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6")
script = ExtResource("9_akagi") script = ExtResource("9_akagi")
@@ -682,29 +682,6 @@ self_size = Vector2i(50, 174)
fname = "ИП9-50" fname = "ИП9-50"
rname = "А20" rname = "А20"
[node name="ref_A28" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")]
visible = false
offset_left = 259.0
offset_top = 34.0
offset_right = 309.0
offset_bottom = 208.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП12-50"
rname = "A21"
[node name="ref_A29" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")]
visible = false
offset_left = 309.0
offset_top = 34.0
offset_right = 359.0
offset_bottom = 208.0
textures = Array[Texture]([])
self_size = Vector2i(50, 174)
fname = "ИП9-50"
rname = "А22"
metadata/_edit_lock_ = true
[node name="IP12_50" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")] [node name="IP12_50" parent="TabContainer/ControlPanel/soc_P1" instance=ExtResource("11_fg7ul")]
offset_left = 16.0 offset_left = 16.0
offset_top = 36.0 offset_top = 36.0

View File

@@ -1,6 +1,6 @@
extends Node extends Node
const UNICAST_PORT: int = 50003 const UNICAST_PORT: int = 50014
const UNICAST_ADDRESS: String = '10.1.1.3' const UNICAST_ADDRESS: String = '10.1.1.14'
const BROADCAST_PORT: int = 50000 const BROADCAST_PORT: int = 50000
const DEFAULT_ADDRESS: String = '10.1.1.11' const DEFAULT_ADDRESS: String = '10.1.1.11'
const DEFAULT_PORT: String = '50011' const DEFAULT_PORT: String = '50011'

View File

@@ -9,10 +9,10 @@ var past_pribor: int
func _ready() -> void: func _ready() -> void:
Network.connect('port_fs_opened_1', _on_fs_status_1.bind(Constants.STATE_VAL.GOOD)) 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_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) self.add_child(timer)
timer.connect('timeout', Callable(self, '_on_timer').bind(Network.unit)) timer.connect('timeout', Callable(self, '_on_timer').bind(Network.unit))
@@ -34,7 +34,14 @@ func _ready() -> void:
$soc_P2/IP9_50, $soc_P2/IP9_50,
$soc_P2/IP12_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) count_cell = len(node_cell_ind)
@@ -58,7 +65,7 @@ func _status_cell(status):
var dkm: int = status.decode_u8(Constants.DataIndices.DKM) var dkm: int = status.decode_u8(Constants.DataIndices.DKM)
$DKM.text = str(dkm) $DKM.text = str(dkm)
# status_board # status_board
for i in range(1, count_cell-8): for i in range(1, 5):
if ((status_board >> (i-1)) & 0x1) == 1: if ((status_board >> (i-1)) & 0x1) == 1:
node_cell_ind[i].state = Constants.STATE_VAL.GOOD node_cell_ind[i].state = Constants.STATE_VAL.GOOD
else: else:
@@ -66,37 +73,48 @@ func _status_cell(status):
#dkm #dkm
if Constants.CURRENT_MODE == Constants.MODE.PRD_H: 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 $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: elif Constants.CURRENT_MODE == Constants.MODE.PRD_B:
$soc_DKM/DKM_2.state = (dkm >> 3) & 0x1 $soc_DKM/DKM_2.state = (dkm >> 3) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 4) & 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: elif Constants.CURRENT_MODE == Constants.MODE.PRD_K:
$soc_DKM/DKM_1.state = (dkm >> 0) & 0x1 $soc_DKM/DKM_1.state = (dkm >> 0) & 0x1
$soc_DKM/DKM_2.state = (dkm >> 5) & 0x1 $soc_DKM/DKM_2.state = (dkm >> 5) & 0x1
$soc_DKM/DKM_3.state = (dkm >> 6) & 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 #dry_contact
if (node_cell_ind[2].state == Constants.STATE_VAL.GOOD): 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: if ((dry_contact >> (i-5)) & 0x1) == 0:
node_cell_ind[i].state = Constants.STATE_VAL.GOOD node_cell_ind[i].state = Constants.STATE_VAL.GOOD
else: else:
node_cell_ind[i].state = Constants.STATE_VAL.ERROR node_cell_ind[i].state = Constants.STATE_VAL.ERROR
else: else:
for i in range(5, count_cell): for i in range(5, 13):
node_cell_ind[i].state = Constants.STATE_VAL.NONE node_cell_ind[i].state = Constants.STATE_VAL.NONE
func _status_prd(): func _status_prd():
var status: int = 0 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[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): 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[10].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[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): if (status == count_cell):
$lbl_control.text = 'Прибор исправен' $lbl_control.text = 'Прибор исправен'
$lbl_control.modulate = Color.AQUAMARINE $lbl_control.modulate = Color.AQUAMARINE
@@ -104,7 +122,7 @@ func _status_prd():
$lbl_control.text = 'Прибор неисправен' $lbl_control.text = 'Прибор неисправен'
$lbl_control.modulate = Color.CRIMSON $lbl_control.modulate = Color.CRIMSON
else: else:
if (status == count_cell-2): if (status == count_cell-5):
$lbl_control.text = 'Прибор исправен' $lbl_control.text = 'Прибор исправен'
$lbl_control.modulate = Color.AQUAMARINE $lbl_control.modulate = Color.AQUAMARINE
else: else:
@@ -175,6 +193,10 @@ func _draw_control_panel_prd(pribor):
$soc_P1/MAA_2.rname = 'А23' $soc_P1/MAA_2.rname = 'А23'
# Кассета П-2 # Кассета П-2
$soc_P2.visible = false $soc_P2.visible = false
# ДКМ
$soc_DKM/DKM_1.visible = false
$soc_DKM/DKM_2.fname = 'ДКМ4'
$soc_DKM/DKM_2.fname = 'ДКМ5'
elif pribor == Constants.MODE.PRD_K: elif pribor == Constants.MODE.PRD_K:
# Кассета У5 # Кассета У5
@@ -208,6 +230,10 @@ func _draw_control_panel_prd(pribor):
$soc_P1/MAA_2.rname = 'А28' $soc_P1/MAA_2.rname = 'А28'
# Кассета П-2 # Кассета П-2
$soc_P2.visible = true $soc_P2.visible = true
# ДКМ
$soc_DKM/DKM_1.visible = true
$soc_DKM/DKM_2.fname = 'ДКМ6'
$soc_DKM/DKM_2.fname = 'ДКМ7'
func _on_fs_status_1(_name_port, status_fs_1): func _on_fs_status_1(_name_port, status_fs_1):