Skip to content

Commit

Permalink
Cancel any repeating frames when calling sendCANMessage with periodMs…
Browse files Browse the repository at this point in the history
… == 0
  • Loading branch information
LandryNorris committed Sep 11, 2024
1 parent 83b9cea commit 31795ab
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/main/native/include/rev/Drivers/DriverDeviceThread.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ class DriverDeviceThread {
if(timeIntervalMs == 0) {
// If the time interval is 0, we want to allow duplicates.
m_sendQueue.push_back(detail::CANThreadSendQueueElement(msg, timeIntervalMs));

// Cancel existing repeating frame with same id
detail::CANThreadSendQueueElement* existing = findFirstMatchingIdWithNonZeroInterval(msg.GetMessageId());
if(existing) {
existing->m_intervalMs = -1;
}
} else {
// We don't want to replace elements with zero as the interval. Those should be guaranteed to be sent
detail::CANThreadSendQueueElement* existing = findFirstMatchingIdWithNonZeroInterval(msg.GetMessageId());
Expand Down

0 comments on commit 31795ab

Please sign in to comment.