Commit ed2450ee authored by Grégory JANISZEWSKI's avatar Grégory JANISZEWSKI

Use singleshot timer for HearBeat producer to avoid time-compression in

case of retarded timeout
parent f485e85d
......@@ -57,7 +57,9 @@ CanOpenProtocolManager::CanOpenProtocolManager (const bool autoRemoveMsg, const
m_syncTimer = new QTimer (this);
m_syncTimer->setTimerType (Qt::PreciseTimer);
m_heartBeatTimer = new QTimer (this);
m_heartBeatTimer->setInterval (0);
m_heartBeatTimer->setTimerType (Qt::PreciseTimer);
m_heartBeatTimer->setSingleShot (true);
connect (m_syncTimer, &QTimer::timeout, this, &CanOpenProtocolManager::broadcastSync);
connect (m_heartBeatTimer, &QTimer::timeout, this, &CanOpenProtocolManager::broadcastHeartBeat);
connect (m_objDict->getSubEntry (0x1006, 0x00), &CanOpenSubEntry::dataChanged, this, &CanOpenProtocolManager::onSyncIntervalChanged);
......@@ -500,6 +502,9 @@ void CanOpenProtocolManager::broadcastHeartBeat (void) {
}
}
}
if (m_heartBeatTimer->interval () > 0) {
m_heartBeatTimer->start ();
}
}
void CanOpenProtocolManager::updateLocalNodeState (const CanOpenHeartBeatState state) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment