Skip to content

Commit

Permalink
Merge pull request #22 from REVrobotics/return-latest-message
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahAndrews authored Nov 10, 2023
2 parents 5675170 + 8b2f5e1 commit 6917751
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion publish.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apply plugin: 'maven-publish'

ext.licenseFile = files("$rootDir/LICENSE.txt")

def pubVersion = '2.1.0'
def pubVersion = '2.2.0'

def outputsFolder = file("$buildDir/allOutputs")

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ CANStatus CandleWinUSBDevice::ReceiveCANMessage(std::shared_ptr<CANMessage>& msg
m_thread.ReceiveMessage(messages);
std::shared_ptr<CANMessage> mostRecent;
for (auto& m : messages) {
if (CANBridge_ProcessMask({m.second->GetMessageId(), 0}, m.first) && CANBridge_ProcessMask({messageID, messageMask}, m.first)) {
if (
CANBridge_ProcessMask({m.second->GetMessageId(), 0}, m.first)
&& CANBridge_ProcessMask({messageID, messageMask}, m.first)
&& (!mostRecent || m.second->GetTimestampUs() > mostRecent->GetTimestampUs())
) {
mostRecent = m.second;
status = CANStatus::kOk;
}
Expand Down
6 changes: 5 additions & 1 deletion src/main/native/cpp/Drivers/Serial/SerialDevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ CANStatus SerialDevice::ReceiveCANMessage(std::shared_ptr<CANMessage>& msg, uint
m_thread.ReceiveMessage(messages);
std::shared_ptr<CANMessage> mostRecent;
for (auto& m : messages) {
if (CANBridge_ProcessMask({m.second->GetMessageId(), 0}, m.first) && CANBridge_ProcessMask({messageID, messageMask}, m.first)) {
if (
CANBridge_ProcessMask({m.second->GetMessageId(), 0}, m.first)
&& CANBridge_ProcessMask({messageID, messageMask}, m.first)
&& (!mostRecent || m.second->GetTimestampUs() > mostRecent->GetTimestampUs())
) {
mostRecent = m.second;
status = CANStatus::kOk;
}
Expand Down
2 changes: 1 addition & 1 deletion vendordeps/CANBridge.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"fileName": "CANBridge.json",
"name": "CANBridge",
"version": "2.1.0",
"version": "2.2.0",
"uuid": "34b37c7c-8acc-405f-9631-d21f20dc59d8",
"mavenUrls": [
"http://www.revrobotics.com/content/sw/max/sdk/maven/"
Expand Down

0 comments on commit 6917751

Please sign in to comment.