QT Timers Delay in Process
-
HI all,
I am newbie to QT. As i am developing an application, got struck with the timers controls. I want to run 6 timers at time in some conditions. and in some conditions 3 timers.
In this process 2 timers got delayed bcoz of the other as per my knowledge i think so.
My timers n its intervals r as follows -
@
//1st timer -
timer_HMIScrLvl4 = new QTimer(this);
connect(timer_HMIScrLvl4, SIGNAL(timeout()), this, SLOT(update_HMIScrLvl4()));
timer_HMIScrLvl4->setInterval(100);
//2nd timer -
Timer_failure_display = new QTimer(this);
connect(Timer_failure_display, SIGNAL(timeout()), this, SLOT(failure_display()));
Timer_failure_display->setInterval(250);
//3rd timer -
Timer_footer = new QTimer(this);
connect(Timer_footer, SIGNAL(timeout()), this, SLOT(footer()));
Timer_footer->setInterval(250);
//4th timer -
Timer_diagonostic_refresh = new QTimer(this);
connect(Timer_diagonostic_refresh, SIGNAL(timeout()), this, SLOT(diagonostic_refresh()));
Timer_diagonostic_refresh->setInterval(50);
//5th Timer -
Timer_information_refresh = new QTimer(this);
connect(Timer_information_refresh, SIGNAL(timeout()), this, SLOT(information_refresh()));
Timer_information_refresh->setInterval(25);
//6th timer -
Timer_footer = new QTimer(this);
connect(Timer_footer, SIGNAL(timeout()), this, SLOT(footer()));
Timer_footer->setInterval(250);
@
1st & 2nd timers are the main timers i should not wanted them to be delayed, they should run at a time.Thanks in Advance.
Forgive me if any thing i posted is against to the rules if the forum.
Edit: edited your code formatting a bit to make it more readable, and that you are in a hurry is your problem, not ours; Andre
-
So, what exactly is your problem?
Your timers won't be fired exactly at the given intervals, as the operating system usually has a precision of ~10 - 15 ms. You might use Qt 5's high precision timers, but even then your application might not be scheduled at the time the timer fires.
Is there any reason you are using three different timers for the 250 interval? You are allowed to connect more than one slot to the timeout() signal.
-
HI,
My problem is on push button click all the above timers will start.
this time "timer_HMIScrLvl4" is getting delayed after the click on pushbutton.
- as per this timer i need to receive (i.e. at the receiver end) every 100ms one telegram means the slot which is connected to it.
SO if i run only "timer_HMIScrLvl4" timer then i am achieving it.
- If i run timer_HMIScrLvl4 + another 5 timers at same time simultaneously then the timer "timer_HMIScrLvl4" at receiver end i am getting the packet around at 4secs each. Which has to be achieved 100MS in actual case(i.e. 1 case).
and another thing is the 250 timer need to me executed in different cases so thats the reason i hav opted for three diff timers of 250ms