Доработка. Скорость запроса при ожидании прибора и во время работы

This commit is contained in:
sasha80
2025-03-19 09:30:07 +03:00
parent fffd0c8de3
commit ad03ab0537

View File

@@ -45,6 +45,7 @@ func on_data_received(_data: PackedByteArray): pass
func _on_timeout(unit_sch3, mbc: ModbusClientRtu) -> void:
push_warning(step_fsm)
if step_fsm == Sch3Fsm.WRITE:
timer.wait_time = request_period
if write_stack.size():
var ad = write_stack.pop_front()
mbc.write(ad.addr, ad.data)
@@ -54,6 +55,7 @@ func _on_timeout(unit_sch3, mbc: ModbusClientRtu) -> void:
elif step_fsm == Sch3Fsm.READ_HOLDING:
unit_sch3.read_holding(base_holding_address, regs_holding_count)
elif step_fsm == Sch3Fsm.CONNECT:
timer.wait_time = reconnect_period
mbc.queue_clear()
mbc.flush()
mbc.try_reconnect()
@@ -113,7 +115,6 @@ func on_line_changed(unit_sch3: sch_3.Sch3):
for item in get_tree().get_nodes_in_group('bits_items_good'):
item.texture = textures[STATE_VAL.NONE]
if not unit_sch3.online:
timer.wait_time = reconnect_period
for item in get_tree().get_nodes_in_group('bits_items_switch'):
item.disabled = true
regs_holding.clear()
@@ -123,7 +124,6 @@ func on_line_changed(unit_sch3: sch_3.Sch3):
$margin/vbox/grid1/lbl_freq.text = '<нет данных>'
$margin/vbox/grid1/state_freq.texture = textures[STATE_VAL.NONE]
$margin/vbox/grid/state.texture = textures[STATE_VAL.NONE]
timer.wait_time = reconnect_period
step_fsm = Sch3Fsm.CONNECT
else:
timer.wait_time = request_period