Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. How to stop recursive single shot timer after 240 second ?
Qt 6.11 is out! See what's new in the release blog

How to stop recursive single shot timer after 240 second ?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
2 Posts 2 Posters 414 Views
  • 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.
  • Q Offline
    Q Offline
    Qt embedded developer
    wrote on last edited by
    #1

    Below you can see that my startcalibration function is call MagnetometerCalibration function

    how to stop this recursive call after 240 second ?

    void startcalibration()
    {
    QTimer::singleShot(1,this, SLOT(MagnetometerCalibration()));
    }

    bool MagnetometerCalibration()
    {
    QTimer::singleShot(1,this, SLOT(MagnetometerCalibration()));
    }

    J.HilkJ 1 Reply Last reply
    0
    • Q Qt embedded developer

      Below you can see that my startcalibration function is call MagnetometerCalibration function

      how to stop this recursive call after 240 second ?

      void startcalibration()
      {
      QTimer::singleShot(1,this, SLOT(MagnetometerCalibration()));
      }

      bool MagnetometerCalibration()
      {
      QTimer::singleShot(1,this, SLOT(MagnetometerCalibration()));
      }

      J.HilkJ Online
      J.HilkJ Online
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Qt-embedded-developer
      use a QElapsedTimer as member variable,

      in startCalibration, start it,
      in MagnetometerCalibration check if the elapsed time is below 250 ms


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      3

      • Login

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