Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. The application freezes during serial connection
Forum Updated to NodeBB v4.3 + New Features

The application freezes during serial connection

Scheduled Pinned Locked Moved Solved QML and Qt Quick
7 Posts 3 Posters 512 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • serkan_trS Offline
    serkan_trS Offline
    serkan_tr
    wrote on last edited by
    #1

    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.

    this video

    Even though I press the settings section, it opens very slowly.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Why are you sleeping the thread in that class ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • serkan_trS Offline
        serkan_trS Offline
        serkan_tr
        wrote on last edited by
        #3

        @SGaist To ensure it waits a bit during connection, but if this stops the system, I need to add another wait in that section

        jsulmJ 1 Reply Last reply
        0
        • serkan_trS serkan_tr

          @SGaist To ensure it waits a bit during connection, but if this stops the system, I need to add another wait in that section

          jsulmJ Online
          jsulmJ Online
          jsulm
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @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.

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • serkan_trS Offline
            serkan_trS Offline
            serkan_tr
            wrote on last edited by
            #5

            @jsulm After the Arduino is connected, when a command is sent immediately, it leaves itself in boot mode. Therefore, a short delay is needed

            jsulmJ 1 Reply Last reply
            0
            • serkan_trS serkan_tr has marked this topic as solved on
            • serkan_trS serkan_tr

              @jsulm After the Arduino is connected, when a command is sent immediately, it leaves itself in boot mode. Therefore, a short delay is needed

              jsulmJ Online
              jsulmJ Online
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @serkan_tr Then use QTimer with a timeout where you send the command.

              https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • serkan_trS Offline
                serkan_trS Offline
                serkan_tr
                wrote on last edited by
                #7

                @jsulm Thank you

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved