Skip to content

Add CANMessage timestamp#684

Open
wsilverio wants to merge 2 commits intoOpen-Agriculture:mainfrom
wsilverio:feature/canmessage-timestamp
Open

Add CANMessage timestamp#684
wsilverio wants to merge 2 commits intoOpen-Agriculture:mainfrom
wsilverio:feature/canmessage-timestamp

Conversation

@wsilverio
Copy link
Copy Markdown

This PR aims to add a microsecond timestamp support to isobus::CANMessage, propagated from the underlying CANMessageFrame.

Motivation:

Enables timing for latency analysis, diagnostics, and time-sensitive applications.

Based on #680

Semantics:

  • Single-frame: timestamp of the originating CANMessageFrame, as reported by the hardware layer
  • Multi-frame messages (RX only): timestamp of the last data-transfer frame
    • The last frame represents when the message becomes fully available to upper layers
    • Multi-frame TX is out of scope (would require new callback infrastructure)

Implementation:

  • Added timestamp_us = 0 parameter to CANMessage constructors
  • Added CANMessage::get_timestamp_us() getter
  • Propagated frame.timestamp_us via CANNetworkManager
  • Forwarded timestamps in:
    • TransportProtocolManager
    • ExtendedTransportProtocolManager
    • FastPacketProtocol

Unit tests:

New and updated unit tests in the existing test files:

./<build>/test/unit_tests --gtest_filter="CAN_MESSAGE_TESTS.*:TransportProtocolTest.BroadcastMessageReceiving"

Note: some unrelated tests are currently failing on main. These failures are reproducible without this PR and were excluded to isolate the changes introduced here.
./<build>/test/unit_tests --gtest_filter=-VirtualTerminalTest.FullPoolAutoscalingWithVector:VirtualTerminalTest.FullPoolAutoscalingWithDataChunkCallbacks:VirtualTerminalTest.FullPoolAutoscalingWithPointer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant