diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index 527f690..80d75f1 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -312,11 +312,12 @@ theme_override_styles/tab_selected = SubResource("StyleBoxTexture_k08q3") theme_override_styles/tab_hovered = SubResource("StyleBoxTexture_dklg6") theme_override_styles/tab_unselected = SubResource("StyleBoxTexture_17le6") tab_alignment = 2 -current_tab = 0 +current_tab = 1 tab_focus_mode = 0 metadata/_edit_lock_ = true [node name="PRD" type="Panel" parent="TabContainer"] +visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_7u7p7") metadata/_tab_index = 0 @@ -460,7 +461,6 @@ script = ExtResource("2_vmbyo") node_gap = Vector2(100, 50) [node name="ControlPanel" type="Panel" parent="TabContainer"] -visible = false layout_mode = 2 theme_override_styles/panel = SubResource("StyleBoxTexture_tn8m6") script = ExtResource("9_akagi") @@ -682,29 +682,6 @@ self_size = Vector2i(50, 174) fname = "ИП9-50" 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")] offset_left = 16.0 offset_top = 36.0 diff --git a/scripts/PRD.gd b/scripts/PRD.gd index 88c80c2..7d3d71f 100644 --- a/scripts/PRD.gd +++ b/scripts/PRD.gd @@ -126,7 +126,7 @@ func _ready() -> void: get_select_device.connect('item_selected', Callable(self, 'on_btn_select')) node_select_device.get_node2(0,0).text = 'ПРИБОР' node_select_device.set_columns_min_size([100, 100]) - + # Получение выбранного прибора при загрузке if Constants.ADDRESSES.size() > 0: get_select_device.select(0) @@ -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): ## УКП @@ -451,7 +451,7 @@ func _on_load_config(): func set_tab_and_buttons(tab_index: int, button_name: String) -> void: $TabContainer.current_tab = tab_index var side_panel = $Background/side_panel - + for button in side_panel.get_children(): if button is Button: button.button_pressed = (button.name == button_name) @@ -599,12 +599,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) @@ -644,7 +644,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('Некорректная частота') diff --git a/scripts/constants.gd b/scripts/constants.gd index 72d65fd..7a4ec75 100644 --- a/scripts/constants.gd +++ b/scripts/constants.gd @@ -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' diff --git a/scripts/control_panel.gd b/scripts/control_panel.gd index 3e1b599..4c7ca6c 100644 --- a/scripts/control_panel.gd +++ b/scripts/control_panel.gd @@ -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' @@ -175,6 +193,10 @@ 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 = 'ДКМ4' + $soc_DKM/DKM_2.fname = 'ДКМ5' elif pribor == Constants.MODE.PRD_K: # Кассета У5 @@ -208,6 +230,10 @@ func _draw_control_panel_prd(pribor): $soc_P1/MAA_2.rname = 'А28' # Кассета П-2 $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): @@ -217,6 +243,6 @@ 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 - + func _on_start_super_control(): $Power_array.text = 'Hello'