sparkfun / OpenLog_Artemis

The OpenLog Artemis is an open source datalogger the comes preprogrammed to automatically log IMU, GPS, serial data, and various pressure, humidity, and distance sensors. All without writing a single line of code!
https://www.sparkfun.com/products/15846
Other
88 stars 47 forks source link

[Feature] Serial log timestamping #70

Closed DennisMelamed closed 3 years ago

DennisMelamed commented 3 years ago

Related to issue #63 . This setting generates a timestamp for the serial log (in the format used by the regular sensor logging) every time the serial log gets a newline.

Ends up switching the serial log write loop over to writing the timestamp when necessary in order to preserve all of the SD card buffering system.

Will work best for slow serial data (1-2 Hz) where adding the timestamp won't interfere with writing the true serial data. Timestamp is not the receive time of the serial data, but when it is written to file. This is good enough for most applications I can think of, and doesn't require diving into deeper serial code.

PaulZC commented 3 years ago

Hi Dennis (@DennisMelamed ), This looks nice - thank you. I think I will have to merge it by hand though. I am working on some new upgrades to the OLA firmware and I think your changes clash with those. (That's why you're seeing the "This branch has conflicts that must be resolved" error.) So, please leave it with me. I should be able to release the new version of the firmware next week. Another change I'm going to make - which is similar to yours - is to allow you to log the number of bytes logged to the serial file (charsReceived) in the sensor data file. That way, you can correlate the size of the serial file with the timestamps in the sensor file and work out when the data arrived. It might be a better solution for anyone that wants to know when the data arrived, but doesn't want to add extra data to the serial log? Anyway, thanks again. Leave it with me. All the best, Paul

PaulZC commented 3 years ago

Hi @DennisMelamed , As discussed in #63 , I have implemented your PR but had to change it a bit. The revised code is here. Thanks again for submitting this PR! Closing... Paul