Open
Conversation
Set msg.timestamp to micros() as soon as possible after CAN frame is received.
Was version 0.2.5, now 0.2.5.1
Incremented version to 0.2.6 added msg.timestamp = micros(); in esp32_can_builtin.cpp for more accurate timestamps when saving to SD card.
Updated description
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Inside ESP32CAN::processFrame(twai_message_t &frame), msg.timestamp is now set to micros() as soon as possible after CAN frame is received.
This will be used in a forked version of A0RET (renamed to ESP32_RET_SD to prevent confusion) that it records all CAN data (in SavvyCAN CSV format) to an SD card until a SavvyCAN wifi connection, then the SD CAN data log stops. This allows a simple to use "offline" plug and play "CAN to SD" mode as well as the fantastic features of SavvyCAN.
This greatly reduces the average inter-frame interval to within 1-3 mSec, as writing data to an SD card does not have a predictable duration. Before this change the average inter-frame interval would be more than 100ms.
I don't think it changes anything for wifi sendFrameToBuffer() in gvret_com.cpp (line 517) as it gets the current micros() and uses that for the timestamp.
A0RET based ESP32_RET_SD will be released after a few more days of testing in my car.
(I hope this follows the proper procedure as I am very new to github, so any coaching/correcting is appreciated)