sparkfun / OpenLog

Open Source Hardware Datalogger
https://www.sparkfun.com/products/9530
Other
553 stars 216 forks source link

escape characters do not always trigger an escape to command mode #210

Closed trevorshannon closed 7 years ago

trevorshannon commented 7 years ago

I have an application where I am writing logs, and when the logs are done, I automatically drop to command mode. Sometimes, I find log files with the escape sequence and subsequent command written to the log file. In these cases, there are two logs back-to-back in the same file, separated by the escape sequence and command.

Example log file: [data from first run...] $$$reset [more data from second run...]

Perhaps this has to do with the fact that only the first character in the local buffer is checked for an escape character before entering escape detection logic? OpenLog.ino:481

Maybe it was done that way for speed/performance?

nseidle commented 7 years ago

Your intuitions are correct - it was a design decision to try to log as fast as possible while still scanning for escape chars.

To avoid your issue, and if possible, add a small delay of 500ms before sending $$$. If MAX_IDLE_TIME_MSEC passes the buffer is recorded and unit goes to sleep. This insures the first $ is picked up and the escape sequence is picked up correctly.

Please re-open if you have other problems or issues.