Доработка подключения и флага чтения записи
This commit is contained in:
38
Main.gd
38
Main.gd
@@ -68,7 +68,9 @@ func _ready():
|
|||||||
edit_interval.editable = true
|
edit_interval.editable = true
|
||||||
edit_interval.placeholder_text = 'Ввод значения'
|
edit_interval.placeholder_text = 'Ввод значения'
|
||||||
edit_interval.connect('text_submitted', Callable(self, '_on_written_interval'))
|
edit_interval.connect('text_submitted', Callable(self, '_on_written_interval'))
|
||||||
|
|
||||||
|
var node_select2 = $scroll2/table2
|
||||||
|
|
||||||
# Привязка для принятия широковещательного канала
|
# Привязка для принятия широковещательного канала
|
||||||
soc_brodcast = Socket.new()
|
soc_brodcast = Socket.new()
|
||||||
var rc = soc_brodcast.bind(Constants.BROADCAST_PORT, '*')
|
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: ## Приёмник
|
func poll_receive(sock: Socket) -> bool: ## Приёмник
|
||||||
|
|
||||||
if timeout - last_update_time > 0:
|
if timeout - last_update_time > 0:
|
||||||
while sock.get_available_packet_count() > 0:
|
while sock.get_available_packet_count() > 0:
|
||||||
var rx_data = sock.get_packet()
|
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:
|
if (address == addr_receive) and (port == port_receive) and flag_online:
|
||||||
unit.parse(rx_data)
|
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:
|
else:
|
||||||
if sock.get_available_packet_count():
|
if sock.get_available_packet_count():
|
||||||
last_update_time = 0.0
|
last_update_time = 0.0
|
||||||
@@ -186,26 +182,30 @@ func on_command_done(_unit) -> void:
|
|||||||
func state_machine() -> void:
|
func state_machine() -> void:
|
||||||
var fl_done = (unit.cmd_state == unit.CmdState.DONE) or (unit.cmd_state == unit.CmdState.FAIL)
|
var fl_done = (unit.cmd_state == unit.CmdState.DONE) or (unit.cmd_state == unit.CmdState.FAIL)
|
||||||
if state == Constants.STATE.WAIT and fl_done:
|
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(3, 1, ' ПРОЧИТАНО ИЗ %x' % port_select)
|
||||||
node_select.set_node_text(1, 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)
|
node_select.set_node_text(4, 1, nubre_from_port)
|
||||||
$read_ISA.disabled = false
|
if flag_write_isa:
|
||||||
$write_ISA.disabled = false
|
flag_write_isa = false
|
||||||
if flag_read_isa:
|
|
||||||
state = Constants.STATE.READ
|
|
||||||
elif flag_write_isa:
|
|
||||||
state = Constants.STATE.WRITE
|
state = Constants.STATE.WRITE
|
||||||
|
elif flag_read_isa:
|
||||||
|
flag_read_isa = false
|
||||||
|
state = Constants.STATE.READ
|
||||||
else:
|
else:
|
||||||
state = Constants.STATE.WAIT
|
state = Constants.STATE.WAIT
|
||||||
elif state == Constants.STATE.READ and fl_done: ## Чтение из ИСА
|
elif state == Constants.STATE.READ and fl_done: ## Чтение из ИСА
|
||||||
unit.send_isa(unit.CmdCode.READ_ISA, [port_select])
|
unit.send_isa(unit.CmdCode.READ_ISA, [port_select])
|
||||||
flag_read_isa = false
|
state = Constants.STATE.WAIT
|
||||||
state = Constants.STATE.WRITE if flag_write_isa else Constants.STATE.WAIT
|
|
||||||
elif state == Constants.STATE.WRITE and fl_done: ## Запись в ИСА
|
elif state == Constants.STATE.WRITE and fl_done: ## Запись в ИСА
|
||||||
unit.send_isa(unit.CmdCode.WRITE_ISA, [port_select, ports_wr[port_select]])
|
unit.send_isa(unit.CmdCode.WRITE_ISA, [port_select, ports_wr[port_select]])
|
||||||
flag_write_isa = false
|
state = Constants.STATE.WAIT
|
||||||
state = Constants.STATE.READ
|
|
||||||
|
|
||||||
|
|
||||||
## Выставить адресс для записи
|
## Выставить адресс для записи
|
||||||
@@ -252,13 +252,13 @@ func _on_button_pressed(turn_on) -> void:
|
|||||||
|
|
||||||
func _on_button_read() -> void:
|
func _on_button_read() -> void:
|
||||||
port_select = node_select.get_node2(0, 2).text.hex_to_int()
|
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:
|
func _on_button_write() -> void:
|
||||||
port_select = node_select.get_node2(0, 2).text.hex_to_int()
|
port_select = node_select.get_node2(0, 2).text.hex_to_int()
|
||||||
_on_written_text_submitted(node_select.get_node2(2, 1).text)
|
_on_written_text_submitted(node_select.get_node2(2, 1).text)
|
||||||
state = Constants.STATE.WRITE
|
flag_write_isa = true
|
||||||
|
|
||||||
|
|
||||||
func save_settings():
|
func save_settings():
|
||||||
|
|||||||
@@ -30,6 +30,16 @@ layout_mode = 2
|
|||||||
script = ExtResource("2_ri1qb")
|
script = ExtResource("2_ri1qb")
|
||||||
metadata/_edit_lock_ = true
|
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="."]
|
[node name="Turn_on" type="Button" parent="."]
|
||||||
offset_left = 963.0
|
offset_left = 963.0
|
||||||
offset_top = 72.0
|
offset_top = 72.0
|
||||||
|
|||||||
Reference in New Issue
Block a user