Hi all,
My program gives a command to a device. The device needs some time to respond to adjust to the command value. The program then reads values each second and tests if the system is stable (when max value-min value of the last n measurements < limit).
Connect (timer,SIGNAL(timeout),this,SLOT(read_values());
timer->start(1000);
QTimer *timer;
Connect (timer,SIGNAL(timeout),this,SLOT(read_values());
timer->start(1000);
To copy to clipboard, switch view to plain text mode
<The read_values function>
Void read_values()
{
stability=stability_test();
if(! stability)
{
<read values from device>
}
else
{
< stop timer>
timer->stop();
}
}
Void read_values()
{
stability=stability_test();
if(! stability)
{
<read values from device>
}
else
{
< stop timer>
timer->stop();
}
}
To copy to clipboard, switch view to plain text mode
The problem is that the program freeze after timer->stop(). Is there a way around this problem?
Any help is deeply appreciated!
(The main class of the program subclass QDialog. Read_values() is a privat slot)
<Main.cpp>
int main(int argc, char *argv[])
{
Client client
(parent,
QString::fromLocal8Bit(argv
[1]));
client.show();
client.exec();
}
int main(int argc, char *argv[])
{
Client client(parent,QString::fromLocal8Bit(argv[1]));
client.show();
client.exec();
}
To copy to clipboard, switch view to plain text mode
Bookmarks