diff --git a/PRD.gd b/PRD.gd index 324f6af..96eda2a 100644 --- a/PRD.gd +++ b/PRD.gd @@ -6,13 +6,17 @@ var soc_brodcast: Socket var address: String = Constants.ADDRESSES[0][1] var port: int = Constants.ADDRESSES[0][2] var flag_mode = Constants.ADDRESSES[0][3] -var ports_wr: Dictionary # Словарь с портами для записи +var send_array: Array = [] var broadcast_packet: PackedByteArray var node_select1: Node +var node_select2: Node var timeout: float = Yau07.ONLINE_TIMEOUT var last_update_time: float = 0.0 var flag_yau_control: bool var CONTROL_TABLE: Array +var state = Constants.STATE.WAIT +var flag_read_isa: bool = false + ## Класс для отправки данных в сокет class Socket extends PacketPeerUDP: @@ -30,7 +34,7 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник if (address == addr_receive) and (port == port_receive): $control_dev/control_tbl.get_node2(0, 0).text = 'ЯУ-07Б НА СВЯЗИ' - $control_dev/control_tbl.get_node2(0, 0).modulate = Constants.GREEN + $control_dev/control_tbl.get_node2(0, 0).modulate = Color.GREEN last_update_time = 0.0 unit.parse(broadcast_packet) else: @@ -38,14 +42,24 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник last_update_time = 0.0 else: $control_dev/control_tbl.get_node2(0, 0).text = 'НЕТ СВЯЗИ С ЯУ-07Б' - $control_dev/control_tbl.get_node2(0, 0).modulate = Constants.RED + $control_dev/control_tbl.get_node2(0, 0).modulate = Color.RED return false func _ready() -> void: - # Таблица 1 (temp) + # Таблица УКП_1 node_select1 = $scroll1/table1 draw_tabl(node_select1, Constants.ROWS_REGS_DATA, Constants.ROWS_REGS_DATA.size()) + node_select1.set_columns_min_size([120, 120]) + node_select1.set_node_text(0, 0, 'Мощность') + node_select1.set_node_text(1, 0, 'Температура') + + # Таблица УКП_2 + node_select2 = $scroll2/table2 + draw_tabl(node_select2, Constants.ROWS_UKP2_DATA, Constants.ROWS_UKP2_DATA.size()) + node_select2.set_columns_min_size([120, 120]) + node_select2.set_node_text(0, 0, 'Мощность') + node_select2.set_node_text(1, 0, 'Температура') # Выбор прибора для подключения var node_select_device = $select_dev/select_dev @@ -57,8 +71,8 @@ func _ready() -> void: get_select_device.add_item(Constants.ADDRESSES[i_addr][0]) get_select_device.set_item_metadata(i_addr, Constants.ADDRESSES[i_addr].slice(1,4)) 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([200, 100]) + node_select_device.get_node2(0,0).text = 'ПРИБОР' + node_select_device.set_columns_min_size([100, 100]) # Контроль var node_control_device = $control_dev/control_tbl @@ -80,12 +94,13 @@ func _ready() -> void: if rc != OK: print('Ошибка: неудачная привязка адреса: ', address) + $Zapret.connect('toggled', Callable(self, '_on_zapret').bind($Zapret)) + $Zapret2.connect('toggled', Callable(self, '_on_zapret').bind($Zapret2)) unit.connect('line_changed', Callable(self, 'on_line_changed')) unit.connect('command_fail', Callable(self, 'on_command_fail')) unit.connect('command_done', Callable(self, 'on_command_done')) unit.connect('data_received', Callable(self, 'data_received')) - ## Рисует таблицу func draw_tabl(tbl, row: Array, count_row: int): for i_row in count_row: @@ -95,11 +110,36 @@ func draw_tabl(tbl, row: Array, count_row: int): func _process(delta: float) -> void: last_update_time += delta poll_receive(soc_brodcast) + state_machine() match unit.process(delta): Error.OK: soc_unicast.send_to(address, port, unit.tx_data.slice(0, unit.tx_len)) Error.FAILED: print('Ошибка отправки данных') +func state_machine(): + var fl_done = (unit.cmd_state == unit.CmdState.DONE) + ## Режим ожидания + if state == Constants.STATE.WAIT and fl_done: + + if flag_read_isa: + flag_read_isa = false + state = Constants.STATE.READ_ISA + elif send_array.size(): + state = Constants.STATE.WRITE_ISA + + ## Режим чтения из ИСА + elif state == Constants.STATE.READ_ISA and fl_done: + unit.send_isa(unit.CmdCode.READ_ISA, [0x122, 0x128]) + $ISA.text = 'ISA: ' + str(unit.isa_ports) + state = Constants.STATE.WAIT + ## Режим записи в ИСА + elif state == Constants.STATE.WRITE_ISA and fl_done: + var ports_dict = send_array.pop_front() + var key = ports_dict.keys() + unit.send_isa(unit.CmdCode.WRITE_ISA, [key[0], ports_dict[key[0]]]) + state = Constants.STATE.WAIT + + func data_received(_unit): var data_from_yau_07 = unit.status var status_board = data_from_yau_07.decode_u8(Constants.DataIndices.STATUS_BOARD) @@ -111,19 +151,19 @@ func data_received(_unit): var DKM: int = data_from_yau_07.decode_u16(Constants.DataIndices.DKM) # ДКМ от УГ ## УГ - node_select1.set_node_text(2, 0, '%d' % dry_contact) + #node_select1.set_node_text(2, 0, '%d' % dry_contact) var node_control_device = $control_dev/control_tbl for i in 4: var node_board = node_control_device.get_node2(0, i+2) var j = int(status_board & (1 << i) == 0 and flag_yau_control) node_board.text = Constants.CONTROL_BOARD[i][j] - node_board.modulate = [Constants.GREEN, Constants.RED][j] + node_board.modulate = [Color.GREEN, Color.RED][j] for i in 8: var node_power_supply = node_control_device.get_node2(0, i+6) var j = int(not(dry_contact & (1 << i) == 0 and flag_yau_control)) node_power_supply.text = Constants.CONTROL_POWER_SUPPLY[i][j] - node_power_supply.modulate = [Constants.GREEN, Constants.RED][j] + node_power_supply.modulate = [Color.GREEN, Color.RED][j] ## EMS G var CONTROL_FRAME = [$control_dev/SZI_x, $control_dev/SZI_x2, $control_dev/SZI_x3, $control_dev/SZI_x4, $control_dev/SZI_x5] @@ -178,30 +218,30 @@ func data_received(_unit): frame = Constants.Frame.VARIABLE if i == 4 else Constants.Frame.WORK node_ems_g.text = Constants.EMS_G[i][j] - node_ems_g.modulate = [Constants.RED, Constants.GREEN][j] + node_ems_g.modulate = [Color.RED, Color.GREEN][j] set_frame(frame, CONTROL_FRAME[i]) - node_select1.set_node_text(3, 0, '%d' % DKM) + #node_select1.set_node_text(3, 0, '%d' % DKM) ## УКП for i in range(8): ## Мощность от УКП_1 var power_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_1 + 2 * i) - node_select1.set_node_text(0, i, '%d' % power_ukp_1) + node_select1.set_node_text(0, i+1, '%d' % power_ukp_1) for i in range(8): ## Температура от УКП_1 var temperature_ukp_1 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_1 + 2 * i) var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_1) * Constants.TEMP - node_select1.set_node_text(1, i, '%d' % TMP) + node_select1.set_node_text(1, i+1, '%d' % TMP) for i in range(8): ## Мощность от УКП_2 var power_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.POWER_UKP_2 + 2 * i) - node_select1.set_node_text(0, i + 8, '%d' % power_ukp_2) + node_select2.set_node_text(0, i+1, '%d' % power_ukp_2) - for i in range(8): ## Температура от УКП_2 - if len(data_from_yau_07) > 79 + 2 * i: - var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * i) + for row in range(8): ## Температура от УКП_2 + if len(data_from_yau_07) > 79 + 2 * row: + var temperature_ukp_2 = data_from_yau_07.decode_u16(Constants.DataIndices.TEMPERATURE_UKP_2 + 2 * row) var TMP = Constants.CONST_MIN_TEMP + (Constants.MAXIMUM_CODE_ADC - temperature_ukp_2) * Constants.TEMP - node_select1.set_node_text(1, i+8, '%d' % TMP) + node_select2.set_node_text(1, row+1, '%d' % TMP) func set_frame(val: int, node: Node): node.set_frame(val) @@ -223,7 +263,7 @@ func on_line_changed(_unit) -> void: else: for i in 15: var node_board = $control_dev/control_tbl.get_node2(0, i+1) - node_board.modulate = Constants.RED + node_board.modulate = Color.RED flag_yau_control = false @@ -258,3 +298,18 @@ func fill_item(node, i_column: int, i_row: int, arr: Dictionary, select: int = 0 optionbutton.add_item(item_text) if select < arr.size(): optionbutton.select(select) + + +func _on_zapret(toggled_on: bool, meta) -> void: + var address_port_wr = 0x122 + var ports_wr: Dictionary = {address_port_wr : meta.get_meta('litera')} ## СИ2, СИ4, СИ6 = 0x30, СИ3, СИ5, СИ7 = 0x31, СИ1 = 0x2F + send_array.append(ports_wr) + + ports_wr = {} + address_port_wr = 0x128 + ports_wr[address_port_wr] = 0x4000 if toggled_on else 0x0 + send_array.append(ports_wr) + + +func _on_read_isa_pressed() -> void: + flag_read_isa = true diff --git a/PRDB289.tmp b/PRDB289.tmp new file mode 100644 index 0000000..7618ff4 --- /dev/null +++ b/PRDB289.tmp @@ -0,0 +1,333 @@ +[gd_scene load_steps=26 format=3 uid="uid://cvor2jm4xk3ha"] + +[ext_resource type="Script" path="res://PRD.gd" id="1_v273n"] +[ext_resource type="Script" path="res://table/table.gd" id="2_vmbyo"] +[ext_resource type="Material" uid="uid://s6xe8igevnv2" path="res://Shaders/shader_edu.tres" id="3_3syd3"] +[ext_resource type="Shader" path="res://Shaders/ray.gdshader" id="4_uy5o2"] +[ext_resource type="Texture2D" uid="uid://62v0xejejuwj" path="res://Web.png" id="5_i3nvb"] +[ext_resource type="Texture2D" uid="uid://dkef6xwxwdxi8" path="res://эмс-бланк.png" id="7_hdx0f"] +[ext_resource type="Texture2D" uid="uid://b15flrfytxkop" path="res://эмс-бланк-пост.png" id="8_eaogg"] +[ext_resource type="Texture2D" uid="uid://ijdfo2mml54" path="res://эмс-бланк-перем.png" id="9_nctgk"] + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ewq4n"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0.189, 0.216, 0.261, 1) +border_color = Color(0.147, 0.168, 0.203, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wlyk3"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0.147, 0.168, 0.203, 1) +draw_center = false +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.44, 0.73, 0.98, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2vbj6"] +bg_color = Color(0.388235, 0.227451, 0.290196, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dm3xa"] +bg_color = Color(0.388235, 0.227451, 0.290196, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h7n4k"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0.128625, 0.147, 0.177625, 1) +border_color = Color(0.1155, 0.132, 0.1595, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="Theme" id="Theme_k5ur4"] +Button/styles/disabled = SubResource("StyleBoxFlat_ewq4n") +Button/styles/focus = SubResource("StyleBoxFlat_wlyk3") +Button/styles/hover = SubResource("StyleBoxFlat_2vbj6") +Button/styles/normal = SubResource("StyleBoxFlat_dm3xa") +Button/styles/pressed = SubResource("StyleBoxFlat_h7n4k") + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ovl8a"] +bg_color = Color(0.388235, 0.227451, 0.290196, 1) +corner_detail = 1 +anti_aliasing = false + +[sub_resource type="SpriteFrames" id="SpriteFrames_vex4t"] +animations = [{ +"frames": [{ +"duration": 1.0, +"texture": ExtResource("7_hdx0f") +}, { +"duration": 1.0, +"texture": ExtResource("8_eaogg") +}, { +"duration": 1.0, +"texture": ExtResource("9_nctgk") +}, { +"duration": 1.0, +"texture": null +}], +"loop": true, +"name": &"default", +"speed": 5.0 +}] + +[sub_resource type="PlaceholderTexture2D" id="PlaceholderTexture2D_723du"] +size = Vector2(1600, 1200) + +[sub_resource type="GDScript" id="GDScript_0sobq"] +script/source = "extends Sprite2D + +" + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_o7txs"] + +[sub_resource type="ShaderMaterial" id="ShaderMaterial_dgiai"] +shader = ExtResource("4_uy5o2") +shader_parameter/color_signal = Color(0.690196, 0.776471, 0, 1) +shader_parameter/turn = 0.785 + +[sub_resource type="Gradient" id="Gradient_ki0n7"] + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_0pk2o"] +gradient = SubResource("Gradient_ki0n7") + +[sub_resource type="Gradient" id="Gradient_jlp41"] +colors = PackedColorArray(0, 0.647059, 0, 1, 0, 0.266667, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_u3yy8"] +gradient = SubResource("Gradient_jlp41") +fill = 1 +fill_from = Vector2(0.5, 0.5) +fill_to = Vector2(1.145, 0) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_otisn"] +texture = SubResource("GradientTexture2D_u3yy8") + +[node name="Node2D" type="Node2D"] +script = ExtResource("1_v273n") + +[node name="Background" type="ColorRect" parent="."] +offset_right = 2226.0 +offset_bottom = 1153.0 +color = Color(0.356863, 0.278431, 0.356863, 1) +metadata/_edit_lock_ = true + +[node name="Litera_2_4_6" type="ColorRect" parent="Background"] +offset_top = 54.0 +offset_right = 1788.0 +offset_bottom = 344.0 +color = Color(0.586231, 0.481877, 0.585869, 1) + +[node name="Litera_3_5_7" type="ColorRect" parent="Background"] +offset_top = 352.0 +offset_right = 1788.0 +offset_bottom = 642.0 +color = Color(0.669446, 0.567301, 0.66881, 1) + +[node name="select_dev" type="ScrollContainer" parent="."] +offset_left = 24.0 +offset_top = 22.0 +offset_right = 387.0 +offset_bottom = 54.0 +metadata/_edit_lock_ = true + +[node name="select_dev" type="GridContainer" parent="select_dev"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="control_button" type="Button" parent="."] +offset_left = 24.0 +offset_top = 53.0 +offset_right = 118.0 +offset_bottom = 81.0 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme = SubResource("Theme_k5ur4") +theme_override_font_sizes/font_size = 14 +theme_override_styles/pressed = SubResource("StyleBoxFlat_ovl8a") +toggle_mode = true +button_pressed = true +text = "КОНТРОЛЬ" + +[node name="Controlpanel" type="ColorRect" parent="."] +offset_left = 118.0 +offset_top = 53.0 +offset_right = 465.0 +offset_bottom = 609.0 +color = Color(0.390334, 0.227948, 0.288326, 1) + +[node name="control_dev" type="ScrollContainer" parent="."] +offset_left = 142.0 +offset_top = 63.0 +offset_right = 477.0 +offset_bottom = 647.0 +metadata/_edit_lock_ = true + +[node name="control_tbl" type="GridContainer" parent="control_dev"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="SZI_x" type="AnimatedSprite2D" parent="control_dev"] +position = Vector2(284, 404) +sprite_frames = SubResource("SpriteFrames_vex4t") +metadata/_edit_lock_ = true + +[node name="SZI_x2" type="AnimatedSprite2D" parent="control_dev"] +position = Vector2(284, 432) +sprite_frames = SubResource("SpriteFrames_vex4t") +metadata/_edit_lock_ = true + +[node name="SZI_x3" type="AnimatedSprite2D" parent="control_dev"] +position = Vector2(284, 460) +sprite_frames = SubResource("SpriteFrames_vex4t") +metadata/_edit_lock_ = true + +[node name="SZI_x4" type="AnimatedSprite2D" parent="control_dev"] +position = Vector2(284, 488) +sprite_frames = SubResource("SpriteFrames_vex4t") +metadata/_edit_lock_ = true + +[node name="SZI_x5" type="AnimatedSprite2D" parent="control_dev"] +position = Vector2(284, 517) +sprite_frames = SubResource("SpriteFrames_vex4t") +metadata/_edit_lock_ = true + +[node name="scroll1" type="ScrollContainer" parent="."] +offset_left = 985.0 +offset_top = 63.0 +offset_right = 1348.0 +offset_bottom = 344.0 +metadata/_edit_lock_ = true + +[node name="table1" type="GridContainer" parent="scroll1"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="scroll2" type="ScrollContainer" parent="."] +offset_left = 985.0 +offset_top = 367.0 +offset_right = 1348.0 +offset_bottom = 655.0 +metadata/_edit_lock_ = true + +[node name="table2" type="GridContainer" parent="scroll2"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + +[node name="PSK" type="Sprite2D" parent="."] +material = ExtResource("3_3syd3") +position = Vector2(1388.25, 65) +scale = Vector2(0.247968, 0.234167) +texture = SubResource("PlaceholderTexture2D_723du") +offset = Vector2(800, 600) +script = SubResource("GDScript_0sobq") + +[node name="PSK grad" type="TextureRect" parent="PSK"] +modulate = Color(0, 0, 0, 1) +self_modulate = Color(0, 0, 0, 1) +show_behind_parent = true +material = SubResource("ShaderMaterial_o7txs") +offset_left = 554.954 +offset_top = -30.0 +offset_right = 1290.95 +offset_bottom = 1134.0 +texture = ExtResource("5_i3nvb") +expand_mode = 1 +metadata/_edit_lock_ = true + +[node name="ray" type="Sprite2D" parent="PSK"] +material = SubResource("ShaderMaterial_dgiai") +position = Vector2(549.221, 560.705) +scale = Vector2(21.8765, 21.6782) +texture = SubResource("GradientTexture2D_0pk2o") +metadata/_edit_lock_ = true + +[node name="LABEL" type="Label" parent="."] +offset_left = 594.0 +offset_top = 53.0 +offset_right = 876.0 +offset_bottom = 76.0 +text = "ЛИТЕРА 2! ПРД-Н!" + +[node name="Zapret" type="Button" parent="."] +offset_left = 594.0 +offset_top = 81.0 +offset_right = 712.0 +offset_bottom = 115.0 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true +text = " Запрет СИ2" + +[node name="LABEL2" type="Label" parent="."] +offset_left = 594.0 +offset_top = 365.0 +offset_right = 876.0 +offset_bottom = 388.0 +text = "ЛИТЕРА 3! ПРД-Н!" + +[node name="Zapret2" type="Button" parent="."] +offset_left = 594.0 +offset_top = 393.0 +offset_right = 712.0 +offset_bottom = 427.0 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true +text = " Запрет СИ3" + +[node name="Label_luch" type="Label" parent="."] +offset_left = 594.0 +offset_top = 136.0 +offset_right = 876.0 +offset_bottom = 159.0 +text = "Номер и направление луча" + +[node name="LUCH" type="OptionButton" parent="."] +offset_left = 594.0 +offset_top = 168.0 +offset_right = 712.0 +offset_bottom = 199.0 +item_count = 2 +popup/item_0/text = "Что-то" +popup/item_1/text = "Что-то" +popup/item_1/id = 1 + +[node name="ISA" type="Label" parent="."] +offset_left = 1356.0 +offset_top = 4.0 +offset_right = 1555.0 +offset_bottom = 27.0 + +[connection signal="toggled" from="control_button" to="." method="_on_control_button"] +[connection signal="toggled" from="Zapret" to="." method="_on_zapret_si2"] +[connection signal="toggled" from="Zapret2" to="." method="_on_zapret_si2"] diff --git a/PRD_MP550.tscn b/PRD_MP550.tscn index c39b227..0c4d02e 100644 --- a/PRD_MP550.tscn +++ b/PRD_MP550.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=17 format=3 uid="uid://cvor2jm4xk3ha"] +[gd_scene load_steps=26 format=3 uid="uid://cvor2jm4xk3ha"] [ext_resource type="Script" path="res://PRD.gd" id="1_v273n"] [ext_resource type="Script" path="res://table/table.gd" id="2_vmbyo"] @@ -9,6 +9,66 @@ [ext_resource type="Texture2D" uid="uid://b15flrfytxkop" path="res://эмс-бланк-пост.png" id="8_eaogg"] [ext_resource type="Texture2D" uid="uid://ijdfo2mml54" path="res://эмс-бланк-перем.png" id="9_nctgk"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ewq4n"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0.189, 0.216, 0.261, 1) +border_color = Color(0.147, 0.168, 0.203, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_wlyk3"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0.147, 0.168, 0.203, 1) +draw_center = false +border_width_left = 2 +border_width_top = 2 +border_width_right = 2 +border_width_bottom = 2 +border_color = Color(0.44, 0.73, 0.98, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_2vbj6"] +bg_color = Color(0.388235, 0.227451, 0.290196, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_dm3xa"] +bg_color = Color(0.388235, 0.227451, 0.290196, 1) + +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_h7n4k"] +content_margin_left = 6.0 +content_margin_top = 5.0 +content_margin_right = 6.0 +content_margin_bottom = 5.0 +bg_color = Color(0.128625, 0.147, 0.177625, 1) +border_color = Color(0.1155, 0.132, 0.1595, 1) +corner_radius_top_left = 3 +corner_radius_top_right = 3 +corner_radius_bottom_right = 3 +corner_radius_bottom_left = 3 +corner_detail = 3 +anti_aliasing = false + +[sub_resource type="Theme" id="Theme_k5ur4"] +Button/styles/disabled = SubResource("StyleBoxFlat_ewq4n") +Button/styles/focus = SubResource("StyleBoxFlat_wlyk3") +Button/styles/hover = SubResource("StyleBoxFlat_2vbj6") +Button/styles/normal = SubResource("StyleBoxFlat_dm3xa") +Button/styles/pressed = SubResource("StyleBoxFlat_h7n4k") + [sub_resource type="StyleBoxFlat" id="StyleBoxFlat_ovl8a"] bg_color = Color(0.388235, 0.227451, 0.290196, 1) corner_detail = 1 @@ -54,6 +114,18 @@ shader_parameter/turn = 0.785 [sub_resource type="GradientTexture2D" id="GradientTexture2D_0pk2o"] gradient = SubResource("Gradient_ki0n7") +[sub_resource type="Gradient" id="Gradient_jlp41"] +colors = PackedColorArray(0, 0.647059, 0, 1, 0, 0.266667, 0, 1) + +[sub_resource type="GradientTexture2D" id="GradientTexture2D_u3yy8"] +gradient = SubResource("Gradient_jlp41") +fill = 1 +fill_from = Vector2(0.5, 0.5) +fill_to = Vector2(1.145, 0) + +[sub_resource type="StyleBoxTexture" id="StyleBoxTexture_otisn"] +texture = SubResource("GradientTexture2D_u3yy8") + [node name="Node2D" type="Node2D"] script = ExtResource("1_v273n") @@ -63,6 +135,25 @@ offset_bottom = 1153.0 color = Color(0.356863, 0.278431, 0.356863, 1) metadata/_edit_lock_ = true +[node name="Litera_2_4_6" type="ColorRect" parent="Background"] +offset_top = 54.0 +offset_right = 2182.0 +offset_bottom = 344.0 +color = Color(0.586231, 0.481877, 0.585869, 1) + +[node name="Litera_3_5_7" type="ColorRect" parent="Background"] +offset_top = 352.0 +offset_right = 2182.0 +offset_bottom = 642.0 +color = Color(0.669446, 0.567301, 0.66881, 1) + +[node name="Litera_1" type="ColorRect" parent="Background"] +visible = false +offset_top = 647.0 +offset_right = 2182.0 +offset_bottom = 793.0 +color = Color(0.669446, 0.567301, 0.66881, 1) + [node name="select_dev" type="ScrollContainer" parent="."] offset_left = 24.0 offset_top = 22.0 @@ -81,6 +172,8 @@ offset_top = 53.0 offset_right = 118.0 offset_bottom = 81.0 focus_mode = 0 +mouse_default_cursor_shape = 2 +theme = SubResource("Theme_k5ur4") theme_override_font_sizes/font_size = 14 theme_override_styles/pressed = SubResource("StyleBoxFlat_ovl8a") toggle_mode = true @@ -135,7 +228,7 @@ metadata/_edit_lock_ = true offset_left = 985.0 offset_top = 63.0 offset_right = 1348.0 -offset_bottom = 647.0 +offset_bottom = 344.0 metadata/_edit_lock_ = true [node name="table1" type="GridContainer" parent="scroll1"] @@ -143,10 +236,22 @@ layout_mode = 2 script = ExtResource("2_vmbyo") metadata/_edit_lock_ = true +[node name="scroll2" type="ScrollContainer" parent="."] +offset_left = 985.0 +offset_top = 367.0 +offset_right = 1348.0 +offset_bottom = 655.0 +metadata/_edit_lock_ = true + +[node name="table2" type="GridContainer" parent="scroll2"] +layout_mode = 2 +script = ExtResource("2_vmbyo") +metadata/_edit_lock_ = true + [node name="PSK" type="Sprite2D" parent="."] material = ExtResource("3_3syd3") -position = Vector2(1243, 81) -scale = Vector2(0.340625, 0.321666) +position = Vector2(1388.25, 65) +scale = Vector2(0.247968, 0.234167) texture = SubResource("PlaceholderTexture2D_723du") offset = Vector2(800, 600) script = SubResource("GDScript_0sobq") @@ -171,6 +276,34 @@ scale = Vector2(21.8765, 21.6782) texture = SubResource("GradientTexture2D_0pk2o") metadata/_edit_lock_ = true +[node name="PSK2" type="Sprite2D" parent="."] +material = ExtResource("3_3syd3") +position = Vector2(1388, 362) +scale = Vector2(0.247968, 0.234167) +texture = SubResource("PlaceholderTexture2D_723du") +offset = Vector2(800, 600) +script = SubResource("GDScript_0sobq") + +[node name="PSK grad" type="TextureRect" parent="PSK2"] +modulate = Color(0, 0, 0, 1) +self_modulate = Color(0, 0, 0, 1) +show_behind_parent = true +material = SubResource("ShaderMaterial_o7txs") +offset_left = 554.954 +offset_top = -30.0 +offset_right = 1290.95 +offset_bottom = 1134.0 +texture = ExtResource("5_i3nvb") +expand_mode = 1 +metadata/_edit_lock_ = true + +[node name="ray" type="Sprite2D" parent="PSK2"] +material = SubResource("ShaderMaterial_dgiai") +position = Vector2(549.221, 560.705) +scale = Vector2(21.8765, 21.6782) +texture = SubResource("GradientTexture2D_0pk2o") +metadata/_edit_lock_ = true + [node name="LABEL" type="Label" parent="."] offset_left = 594.0 offset_top = 53.0 @@ -182,8 +315,32 @@ text = "ЛИТЕРА 2! ПРД-Н!" offset_left = 594.0 offset_top = 81.0 offset_right = 712.0 -offset_bottom = 124.0 +offset_bottom = 115.0 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true text = " Запрет СИ2" +metadata/litera = 48 + +[node name="LABEL2" type="Label" parent="."] +offset_left = 594.0 +offset_top = 365.0 +offset_right = 876.0 +offset_bottom = 388.0 +text = "ЛИТЕРА 3! ПРД-Н!" + +[node name="Zapret2" type="Button" parent="."] +offset_left = 594.0 +offset_top = 393.0 +offset_right = 712.0 +offset_bottom = 427.0 +focus_mode = 0 +mouse_default_cursor_shape = 2 +theme_override_styles/pressed = SubResource("StyleBoxTexture_otisn") +toggle_mode = true +text = " Запрет СИ3" +metadata/litera = 49 [node name="Label_luch" type="Label" parent="."] offset_left = 594.0 @@ -202,4 +359,53 @@ popup/item_0/text = "Что-то" popup/item_1/text = "Что-то" popup/item_1/id = 1 +[node name="ISA" type="Label" parent="."] +offset_left = 1492.0 +offset_top = 11.0 +offset_right = 1743.0 +offset_bottom = 34.0 + +[node name="read_isa" type="Button" parent="."] +offset_left = 1360.0 +offset_top = 7.0 +offset_right = 1483.0 +offset_bottom = 38.0 +text = "Прочитать ISA" + +[node name="Modul" type="Label" parent="."] +offset_left = 594.0 +offset_top = 438.0 +offset_right = 738.0 +offset_bottom = 461.0 +text = "Модуляция" + +[node name="DKM2" type="Label" parent="."] +offset_left = 594.0 +offset_top = 219.0 +offset_right = 736.0 +offset_bottom = 242.0 +text = "ДКМ ДОУ 2" + +[node name="DKM3" type="Label" parent="."] +offset_left = 594.0 +offset_top = 467.0 +offset_right = 736.0 +offset_bottom = 490.0 +text = "ДКМ ДОУ 3" + +[node name="FGOZ2" type="Label" parent="."] +offset_left = 594.0 +offset_top = 242.0 +offset_right = 767.0 +offset_bottom = 265.0 +text = "ФГОЗ 2" + +[node name="FGOZ3" type="Label" parent="."] +offset_left = 594.0 +offset_top = 490.0 +offset_right = 767.0 +offset_bottom = 513.0 +text = "ФГОЗ 3" + [connection signal="toggled" from="control_button" to="." method="_on_control_button"] +[connection signal="pressed" from="read_isa" to="." method="_on_read_isa_pressed"] diff --git a/constants.gd b/constants.gd index cc17c0d..f864e8a 100644 --- a/constants.gd +++ b/constants.gd @@ -4,9 +4,6 @@ const UNICAST_ADDRESS: String = '10.1.1.3' const BROADCAST_PORT: int = 50000 const DEFAULT_ADDRESS: String = '10.1.1.11' const DEFAULT_PORT: String = '50011' -const BASE_ADDR: int = 0x100 -const RED = Color(1, 0, 0, 1) -const GREEN = Color(0, 1, 0, 1) const CONST_MIN_TEMP: int = -25 const MAXIMUM_CODE_ADC: int = 3796 const MINIMUM_CODE_AD: int = 2660 @@ -16,22 +13,25 @@ const TableList = preload("res://table/node_list.tscn") const SELECT_DEVICE: Array = [[TableNode, TableList]] const CONTROL_DEVICE: Array = ['ЯЧЕЙКА ЯУ-07Б', 'ФС', 'ЯЧЕЙКА ЭМС-Г', 'ЯЧЕЙКА УГ', 'ЯЧЕЙКА УКП №1', 'ЯЧЕЙКА УКП №2', 'ИП МАА №1', 'ИП МАА №2', 'ИП9-50 №1', 'ИП9-50 №2', 'ИП12-50 №1', '-', '-','ИП5-25', 'Вход Х3:2(СЗИ2)', 'Вход Х3:19(СИ2)', 'Выход Х3:11(СИ2)', 'Выход Х3:14(СИ2)', 'Выход x3:10(ФГОЗ)'] const ROWS_REGS_DATA: Array = [ - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode], - [TableNode, TableNode, TableNode, TableNode]] + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode]] +const ROWS_UKP2_DATA: Array = [ + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode], + [TableNode, TableNode]] const ADDRESSES: Array = [ ['ПРД-Н1', '10.1.1.11', 50011, MODE.PRD_H], ['ПРД-Н2', '10.1.1.21', 50021, MODE.PRD_H], @@ -63,8 +63,8 @@ const EMS_G = [ ['Нет Входа Х3:2(СИ2 от УФ)', 'Вход Х3:2(СИ2 от УФ)'], ['Нет Входа Х3:19(СИ2 от ФС)', 'Вход Х3:19(СИ2 от ФС)'], ['Нет Выхода Х3:2(СИ2 в УФ)', 'Выход Х3:2(СИ2 в УФ)'], - ['Нет Входа Х3:5(Модуляция)', 'Выход Х3:5(Модуляция)'], - ['Нет Входа Х3:10(ФГОЗ)', 'Выход Х3:10(ФГОЗ)']] + ['Нет Выхода Х3:5(Модуляция)', 'Выход Х3:5(Модуляция)'], + ['Нет Выхода Х3:10(ФГОЗ)', 'Выход Х3:10(ФГОЗ)']] enum MODE { PRD_K, PRD_B, @@ -89,3 +89,8 @@ enum DataIndices { POWER_UKP_2 = 63, TEMPERATURE_UKP_2 = 79, } +enum STATE { + WAIT, + READ_ISA, + WRITE_ISA, +} diff --git a/table/node.tscn b/table/node.tscn index a1ffc48..7836d01 100644 --- a/table/node.tscn +++ b/table/node.tscn @@ -1,9 +1,9 @@ [gd_scene load_steps=3 format=3 uid="uid://cef6gtuc60ggg"] -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hrhif"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q1ixs"] bg_color = Color(0, 0, 0, 1) -[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_q1ixs"] +[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_hrhif"] bg_color = Color(0, 0, 0, 1) [node name="Label" type="LineEdit"] @@ -21,10 +21,12 @@ grow_horizontal = 2 grow_vertical = 2 size_flags_horizontal = 3 size_flags_vertical = 3 +focus_mode = 0 +mouse_default_cursor_shape = 0 theme_override_colors/font_uneditable_color = Color(1, 1, 1, 1) theme_override_font_sizes/font_size = 17 -theme_override_styles/normal = SubResource("StyleBoxFlat_hrhif") theme_override_styles/read_only = SubResource("StyleBoxFlat_q1ixs") +theme_override_styles/normal = SubResource("StyleBoxFlat_hrhif") alignment = 1 editable = false caret_blink = true diff --git a/table/node_list.tscn b/table/node_list.tscn index 491c10b..1a73940 100644 --- a/table/node_list.tscn +++ b/table/node_list.tscn @@ -7,5 +7,6 @@ bg_color = Color(0, 0, 0, 1) offset_right = 130.0 offset_bottom = 25.0 focus_mode = 0 +mouse_default_cursor_shape = 2 theme_override_styles/normal = SubResource("StyleBoxFlat_ddnjm") alignment = 1