From 0a4dc05551e9e7be1f6c109c388b52b005738965 Mon Sep 17 00:00:00 2001 From: Maxim Date: Mon, 14 Oct 2024 15:49:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D1=80=D0=B0=D0=B1=D0=BE=D1=82?= =?UTF-8?q?=D0=BA=D0=B0=20=D0=BF=D0=BE=D0=B4=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D1=8F=20=D0=B8=20=D1=84=D0=BB=D0=B0=D0=B3=D0=B0=20?= =?UTF-8?q?=D1=87=D1=82=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Main.gd | 38 +++++++++++++++++++------------------- Plata-check.tscn | 10 ++++++++++ 2 files changed, 29 insertions(+), 19 deletions(-) diff --git a/Main.gd b/Main.gd index d5f386c..1902d42 100644 --- a/Main.gd +++ b/Main.gd @@ -68,7 +68,9 @@ func _ready(): edit_interval.editable = true edit_interval.placeholder_text = 'Ввод значения' edit_interval.connect('text_submitted', Callable(self, '_on_written_interval')) - + + var node_select2 = $scroll2/table2 + # Привязка для принятия широковещательного канала soc_brodcast = Socket.new() var rc = soc_brodcast.bind(Constants.BROADCAST_PORT, '*') @@ -92,7 +94,6 @@ func draw_tabl(tbl, row: Array, count_row: int): func poll_receive(sock: Socket) -> bool: ## Приёмник - if timeout - last_update_time > 0: while sock.get_available_packet_count() > 0: var rx_data = sock.get_packet() @@ -109,11 +110,6 @@ func poll_receive(sock: Socket) -> bool: ## Приёмник if (address == addr_receive) and (port == port_receive) and flag_online: unit.parse(rx_data) - var line_board_control = node_select.get_node2(0, 1) - line_board_control.modulate = Constants.GREEN - else: - var line_board_control = node_select.get_node2(0, 1) - line_board_control.modulate = Constants.RED else: if sock.get_available_packet_count(): last_update_time = 0.0 @@ -186,26 +182,30 @@ func on_command_done(_unit) -> void: func state_machine() -> void: var fl_done = (unit.cmd_state == unit.CmdState.DONE) or (unit.cmd_state == unit.CmdState.FAIL) if state == Constants.STATE.WAIT and fl_done: + $write_ISA.disabled = false + $read_ISA.disabled = false node_select.set_node_text(3, 1, ' ПРОЧИТАНО ИЗ %x' % port_select) node_select.set_node_text(1, 1, ' ЗАПИСАТЬ В %x' % port_select) - var nubre_from_port = '%x' % unit.isa_ports[port_select] if unit.isa_ports.has(port_select) else 'ffff' + var line_board_control = node_select.get_node2(0, 1) + var nubre_from_port = 'ffff' + if unit.isa_ports.has(port_select): + nubre_from_port = '%x' % unit.isa_ports[port_select] + line_board_control.modulate = Constants.RED if nubre_from_port == 'ffff' else Constants.GREEN node_select.set_node_text(4, 1, nubre_from_port) - $read_ISA.disabled = false - $write_ISA.disabled = false - if flag_read_isa: - state = Constants.STATE.READ - elif flag_write_isa: + if flag_write_isa: + flag_write_isa = false state = Constants.STATE.WRITE + elif flag_read_isa: + flag_read_isa = false + state = Constants.STATE.READ else: state = Constants.STATE.WAIT elif state == Constants.STATE.READ and fl_done: ## Чтение из ИСА unit.send_isa(unit.CmdCode.READ_ISA, [port_select]) - flag_read_isa = false - state = Constants.STATE.WRITE if flag_write_isa else Constants.STATE.WAIT + state = Constants.STATE.WAIT elif state == Constants.STATE.WRITE and fl_done: ## Запись в ИСА unit.send_isa(unit.CmdCode.WRITE_ISA, [port_select, ports_wr[port_select]]) - flag_write_isa = false - state = Constants.STATE.READ + state = Constants.STATE.WAIT ## Выставить адресс для записи @@ -252,13 +252,13 @@ func _on_button_pressed(turn_on) -> void: func _on_button_read() -> void: port_select = node_select.get_node2(0, 2).text.hex_to_int() - state = Constants.STATE.READ + flag_read_isa = true func _on_button_write() -> void: port_select = node_select.get_node2(0, 2).text.hex_to_int() _on_written_text_submitted(node_select.get_node2(2, 1).text) - state = Constants.STATE.WRITE + flag_write_isa = true func save_settings(): diff --git a/Plata-check.tscn b/Plata-check.tscn index 468857f..8ceec7f 100644 --- a/Plata-check.tscn +++ b/Plata-check.tscn @@ -30,6 +30,16 @@ layout_mode = 2 script = ExtResource("2_ri1qb") metadata/_edit_lock_ = true +[node name="scroll2" type="ScrollContainer" parent="."] +offset_left = 34.0 +offset_top = 169.0 +offset_right = 1127.0 +offset_bottom = 232.0 + +[node name="table2" type="GridContainer" parent="scroll2"] +layout_mode = 2 +script = ExtResource("2_ri1qb") + [node name="Turn_on" type="Button" parent="."] offset_left = 963.0 offset_top = 72.0