The application freezes during serial connection
-
Hello, I am working on a project where I am using ROS2 Humble and Qt 6.8. In the interface I developed, I wrote a code that scans USB ports and ensures connection only with specific devices. This code periodically scans the devices connected to the ports and automatically closes and reopens the port if a device is disconnected and reconnected. Additionally, I added an auto-connect option to the interface. However, I noticed that when switching to the settings tab, the screen freezes until the connection is established. How can I resolve this issue?
Detail:
this code
This is the section where the serial port automatically connects and general settings are configured.
This is the QML page where the settings are located.Even though I press the settings section, it opens very slowly.
-
Hi,
Why are you sleeping the thread in that class ?
-
@serkan_tr said in The application freezes during serial connection:
To ensure it waits
Why do you need to wait? Qt is assynchronous, there is usually no need to wait for anything.
-
S serkan_tr has marked this topic as solved on
-
@serkan_tr Then use QTimer with a timeout where you send the command.