Skip to content

Update esp32_can_builtin.cpp #73

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

MotorvateDIY
Copy link

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)

Set msg.timestamp to micros() as soon as possible after CAN frame is received.
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
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