Originally Posted by
wysota
How do you know what is the real interval of timer timeouts? Where are you "seeing" those ticks?
I started seeing it because the microcontroller that I am communicating with started to complain about timing violations. To verify it I am using the output of a separate QTime.
It looks like this:
QTime *debug_time;
//used for measuring elapsed time between two ticks QTimer *tx_timer;
//used to trigger the periodic send/receive
void TxThread::run() {
debug_time->start();
tx_timer->setInterval(SEND_INTERVAL);
connect(tx_timer, SIGNAL(timeout()), this, SLOT(send_receive()));
tx_timer->start();
exec();
}
void TxThread::send_receive() {
qDebug() << "SR: " << debug_time->elapsed() << "ms";
//here comes the actual TX/RX part via SPI
}
QTime *debug_time; //used for measuring elapsed time between two ticks
QTimer *tx_timer; //used to trigger the periodic send/receive
void TxThread::run() {
debug_time->start();
tx_timer = new QTimer();
tx_timer->setInterval(SEND_INTERVAL);
connect(tx_timer, SIGNAL(timeout()), this, SLOT(send_receive()));
tx_timer->start();
exec();
}
void TxThread::send_receive() {
qDebug() << "SR: " << debug_time->elapsed() << "ms";
//here comes the actual TX/RX part via SPI
}
To copy to clipboard, switch view to plain text mode
Bookmarks