nilbus / pinewood-derby

Pinewood derby status board & sensor driver
Other
17 stars 9 forks source link

Buffer partially read lines #27

Closed nilbus closed 10 years ago

nilbus commented 10 years ago

Sometimes readline_nonblock is returning partial lines because IO blocks briefly during the read. Eg:

"Copyrigh Mi"
"cro Wizard 2001-2009 \r\n"
"K3 1.07A  Serial Number 23855\r\n"
"A=3.554! B=3.768\" C=3.948# D=4.105$"
" E=0.000  F=0.000  \r\n"

Any race result that gets split like this will not get read properly and will have to be re-run.

Buffering data read and returning it after a full line has been read should alleviate this problem.