Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Running two interval timers on QT
Forum Updated to NodeBB v4.3 + New Features

Running two interval timers on QT

Scheduled Pinned Locked Moved Solved Installation and Deployment
14 Posts 2 Posters 2.1k Views 2 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.
  • K-StrK Offline
    K-StrK Offline
    K-Str
    wrote on last edited by K-Str
    #2

    Hello, here I'm again!
    I think this is a problem using the timer function.
    I tried to make it with QTimer it works but it can handle only milli seconds. But I need an interval of 200 micro seconds. The second interval is 15 minutes.
    So I still need a solution using POSIX timer. And here is my problem.
    My configuration is :
    UBUNTU 18 running as Hyper-v machine on Windows 10
    QT-Creator:
    0_1565604212648_Screenshot from 2019-08-12 12-01-17.png

    It was installed using this Description:
    installation guide in german
    It seems there is something missing.
    Please could somebody give me a tip
    Thanks a lot in advance.
    Kurt

    K 1 Reply Last reply
    0
    • K-StrK K-Str

      Hello, here I'm again!
      I think this is a problem using the timer function.
      I tried to make it with QTimer it works but it can handle only milli seconds. But I need an interval of 200 micro seconds. The second interval is 15 minutes.
      So I still need a solution using POSIX timer. And here is my problem.
      My configuration is :
      UBUNTU 18 running as Hyper-v machine on Windows 10
      QT-Creator:
      0_1565604212648_Screenshot from 2019-08-12 12-01-17.png

      It was installed using this Description:
      installation guide in german
      It seems there is something missing.
      Please could somebody give me a tip
      Thanks a lot in advance.
      Kurt

      K Offline
      K Offline
      koahnig
      wrote on last edited by
      #3

      @k-str

      The "problem" is not with Qt creator, but the actual Qt libs you are using for your application.

      Qt creator is an IDE (Integrated Development Environment) which happens to be based on Qt libs as well. Creator 4.9.2 is using Qt 5.12.4, but you may use any other Qt libs version as installed on your machine. The version may be higher or lower or the exactly the same. However, those are strictly separated.

      Under projects on the left pane in creator you will find Build & run, whzere you can see the actual version used for compilation. Also lower you will find an icon with the project. When you click on this you see the actual version being used and if it is release or debug mode.

      Finally to your question. AFAIK QTimer is not meant for what you are trying to do. As you found out it has only granularity of 1 ms, but you cannot rely on this. https://doc.qt.io/qt-5/qtimer.html#accuracy-and-timer-resolution
      Timer events might be blocked during other events running in the event loop. Timer events will be executed when they are encountered in the event loop.

      Vote the answer(s) that helped you to solve your issue(s)

      1 Reply Last reply
      4
      • K-StrK Offline
        K-StrK Offline
        K-Str
        wrote on last edited by
        #4

        Hi @koahnig ,
        thanks for your answer.
        I checked some on my configs.
        It seems I have on my raspberry Qt version 5.7.1
        on the UBUNTU toolchain I have Qt version 5.12.3
        This means I have to install QT-Creator and the toolchain completely new?
        Kurt

        K 1 Reply Last reply
        0
        • K-StrK K-Str

          Hi @koahnig ,
          thanks for your answer.
          I checked some on my configs.
          It seems I have on my raspberry Qt version 5.7.1
          on the UBUNTU toolchain I have Qt version 5.12.3
          This means I have to install QT-Creator and the toolchain completely new?
          Kurt

          K Offline
          K Offline
          koahnig
          wrote on last edited by koahnig
          #5

          @k-str

          Not necessarily. It depends on your intentions. This might be perfectly fine. However, I tend to have same versions everywhere. IMHO otherwise one gets confused.

          When you use the Ubuntu install to do a cross-compile for RPi, it is recommended to have the same kit/toolchain for both. I do not know if there is a place to get RPi pre-compiled versions. You might have to cross-compile a newer Qt lib version for RPi or the other way around you need to downgrade on Ubuntu to Qt 5.7.1.

          Vote the answer(s) that helped you to solve your issue(s)

          1 Reply Last reply
          0
          • K-StrK Offline
            K-StrK Offline
            K-Str
            wrote on last edited by
            #6

            @koahnig
            Thanks for your answer.
            I think I install everything completely new.
            This means I have to install the following Items:

            • QT-Creator
            • qt-everywhere
            • a rpi image raspbian stretch which fits to qt-everywhere

            What are the actual versions of this items?
            Kurt

            K 1 Reply Last reply
            0
            • K-StrK K-Str

              @koahnig
              Thanks for your answer.
              I think I install everything completely new.
              This means I have to install the following Items:

              • QT-Creator
              • qt-everywhere
              • a rpi image raspbian stretch which fits to qt-everywhere

              What are the actual versions of this items?
              Kurt

              K Offline
              K Offline
              koahnig
              wrote on last edited by
              #7

              @k-str

              It depends how you have installed the components before. The easiest is IMHO the online installer found on https://www.qt.io/download e.g. the open-source version on the right.

              Potentially you have used in the past and you have already maintenance tool available. This is typically updating for the newest Qt creator anyway.

              When you have already a prebuilt rpi Qt lib version you can try to match this version by installing it on your linux desktop. Otherwise you can download the linux open source archive and build the rpi Qt lib version based on https://wiki.qt.io/Raspberry_Pi_Beginners_Guide . There are also other tutorials available based on different Qt versions. I expect that a fairly new tutorial would work also with latest Qt lib code.

              As indicated above I suggest to install the same version on linux desktop and use it also for rpi. Typically it is a matter of taste what people prefer. However, using Qt 5.12.4 seem to be good choice because it is relatively new and has long-term support.

              Vote the answer(s) that helped you to solve your issue(s)

              1 Reply Last reply
              1
              • K-StrK Offline
                K-StrK Offline
                K-Str
                wrote on last edited by K-Str
                #8

                @koahnig ,
                hello, thanks for your tip.
                It*s quiet confusing, because whatever you do you run in some problems.
                I followed the beginners guide described here but I runned into some problems:

                • the mount command
                sudo mount -o loop,offset=62914560 2015-05-05-raspbian-wheezy.img /mnt/rasp-pi-rootfs
                

                does not work

                • has to be something like this
                sudo mount -v -o offset=62914560 -t ext4 2015-05-05-raspbian-wheezy.img /mnt/rasp-pi-rootfs
                

                finaly I'm stuck on this point

                sudo apt-get install ia32-libs
                

                ther is no way to install lib32bz2-1.0
                maybe this causes this failure
                You don't seem to have 'make' or 'gmake' inyour PATH
                when I run this command

                ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
                

                the command

                sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
                

                reports usage ./cmd targt-rootfs
                So what can I do?

                K 1 Reply Last reply
                0
                • K-StrK K-Str

                  @koahnig ,
                  hello, thanks for your tip.
                  It*s quiet confusing, because whatever you do you run in some problems.
                  I followed the beginners guide described here but I runned into some problems:

                  • the mount command
                  sudo mount -o loop,offset=62914560 2015-05-05-raspbian-wheezy.img /mnt/rasp-pi-rootfs
                  

                  does not work

                  • has to be something like this
                  sudo mount -v -o offset=62914560 -t ext4 2015-05-05-raspbian-wheezy.img /mnt/rasp-pi-rootfs
                  

                  finaly I'm stuck on this point

                  sudo apt-get install ia32-libs
                  

                  ther is no way to install lib32bz2-1.0
                  maybe this causes this failure
                  You don't seem to have 'make' or 'gmake' inyour PATH
                  when I run this command

                  ./configure -opengl es2 -device linux-rasp-pi-g++ -device-option CROSS_COMPILE=~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf- -sysroot /mnt/rasp-pi-rootfs -opensource -confirm-license -optimized-qmake -reduce-exports -release -make libs -prefix /usr/local/qt5pi -hostprefix /usr/local/qt5pi
                  

                  the command

                  sudo ./fixQualifiedLibraryPaths /mnt/rasp-pi-rootfs/ ~/opt/gcc-4.7-linaro-rpi-gnueabihf/bin/arm-linux-gnueabihf-gcc
                  

                  reports usage ./cmd targt-rootfs
                  So what can I do?

                  K Offline
                  K Offline
                  koahnig
                  wrote on last edited by
                  #9

                  @k-str

                  I am not really a linux guy. Therefore I am struggling as well.

                  However, can you run everywhere on your Ubuntu machine

                  make -v
                  

                  or

                  gmake -v
                  

                  otherwise you may to install either command. You need for configure and the cross-compilation anyhow.

                  Vote the answer(s) that helped you to solve your issue(s)

                  1 Reply Last reply
                  0
                  • K-StrK Offline
                    K-StrK Offline
                    K-Str
                    wrote on last edited by
                    #10

                    @koahnig
                    the outputs are :

                    make -v
                    
                    Command 'make' not found, but can be installed with:
                    
                    sudo apt install make      
                    sudo apt install make-guileth
                    

                    and

                    gmake -v
                    
                    Command 'gmake' not found, but there are 14 similar ones.
                    

                    This means I must install make?

                    K 1 Reply Last reply
                    0
                    • K-StrK K-Str

                      @koahnig
                      the outputs are :

                      make -v
                      
                      Command 'make' not found, but can be installed with:
                      
                      sudo apt install make      
                      sudo apt install make-guileth
                      

                      and

                      gmake -v
                      
                      Command 'gmake' not found, but there are 14 similar ones.
                      

                      This means I must install make?

                      K Offline
                      K Offline
                      koahnig
                      wrote on last edited by
                      #11

                      @k-str

                      Yes, try to install either make or gmake. Not sure if there is a difference, but you need one.

                      Vote the answer(s) that helped you to solve your issue(s)

                      1 Reply Last reply
                      0
                      • K-StrK Offline
                        K-StrK Offline
                        K-Str
                        wrote on last edited by K-Str
                        #12

                        @koahnig
                        Thanks for your answer!
                        I have a question about the versions of gcc linearo and raspbian. It's quiet confusing.
                        Is it correct, that the version of gcc-linearo and gcc of the raspbian has to be equal?
                        gcc-4.7-linearo has version 7.4.0
                        gcc on 2019-04-08-raspbian-stretch has version 8.3
                        gcc on 2018-11-13-raspbian-stretch has version 6.3

                        K 1 Reply Last reply
                        0
                        • K-StrK K-Str

                          @koahnig
                          Thanks for your answer!
                          I have a question about the versions of gcc linearo and raspbian. It's quiet confusing.
                          Is it correct, that the version of gcc-linearo and gcc of the raspbian has to be equal?
                          gcc-4.7-linearo has version 7.4.0
                          gcc on 2019-04-08-raspbian-stretch has version 8.3
                          gcc on 2018-11-13-raspbian-stretch has version 6.3

                          K Offline
                          K Offline
                          koahnig
                          wrote on last edited by
                          #13

                          @k-str said in Running two interval timers on QT:

                          @koahnig
                          Thanks for your answer!
                          I have a question about the versions of gcc linearo and raspbian. It's quiet confusing.
                          Is it correct, that the version of gcc-linearo and gcc of the raspbian has to be equal?
                          gcc-4.7-linearo has version 7.4.0
                          gcc on 2019-04-08-raspbian-stretch has version 8.3
                          gcc on 2018-11-13-raspbian-stretch has version 6.3

                          Not necessarily. However, there are a couple of possible issues.

                          The different versions of gcc have to be compatible on object level, when you want to mix object files resp libraries. AFAIK are most gcc compilers compatible on object level, but I know there some which are not. In general I would recommend staying with the same version everywhere, at least where you intend to mix.

                          The other thing are Qt libs. If you are using pre-compiled versions as delivered with an OS, it would be better to have same versions ( see recommendation above). Not sure if there are already Qt dynamic libs included with raspbian. If so, you have also a possible version issue with those libs. Some time it works without issue, but personally I recommend staying with same versions.

                          The linaro compiler is on desktop for cross-compilation. The other two are on RPi. If you intend to cross-compile on desktop, you would need to use always the same compiler there. If you intend to compile on RPi, try to get everything on RPi and do compilation there. That will make live easier.

                          When you do all on desktop, you have to cross-compile Qt libs and deploy the libraries for Qt also to RPi. For this you may use also a pretty old compiler as long as it support the required C++ standards.

                          Vote the answer(s) that helped you to solve your issue(s)

                          1 Reply Last reply
                          0
                          • K-StrK Offline
                            K-StrK Offline
                            K-Str
                            wrote on last edited by
                            #14

                            @koahnig ,
                            thanks a lot for your tips.
                            I installed qt again .
                            using an other guide
                            It worked almost with some changes.
                            The timer problem I solved by adding -lrt to the make.
                            The problem using the assignemend :

                            tidp = &si->si_value.sival_ptr;
                            

                            I solved in this "old style" way;

                            titp = (void**)si->si_value.sival_ptr;
                            

                            It works now.

                            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