-
Notifications
You must be signed in to change notification settings - Fork 2
Join reader thread + serial conn validation check[CPP-593] #379
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
Conversation
c263ecc
to
51d8344
Compare
e682531
to
8fbc2a2
Compare
@notoriaga I wasn't sure the best way to formulate my work in with yours so I pushed mine over yours. It does seem joining the reader thread was catching a corner case before disconnecting and attempting to connect to the same device with a different baudrate. |
|
||
Ok((Box::new(rdr), Box::new(writer))) | ||
} | ||
fn validate_serial_port(&self) -> std::result::Result<(), std::io::Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I thought of after we talked about this, what if the corruption still results in a preamble byte?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess my thinking was that if it shows up at all then it should hopefully show up again and once it hits the process messages loop the crc check should error out but I see how this is not the most deterministic behavior. However playing with this approach, it does seem to error out consistently for each of the available baudrates that are not expected. This might be something we would have to monitor on multiple devices.
Otherwise we would need to implement some additional logic in the parser. I guess we would not want to have the console dictate the behavior of the sbp parser. Either we could move some of the timeout logic out of the console and into the parser or potentially add a maximum amount of data parsed with no valid message before erroring out. 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, seems better than nothing 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👀
Here is a video showing what is observed connecting to a port with the incorrect baudrate. Note, there is a seven second debounce on the connection notifications which is why it does not show up each time. Looks like the first 10sec of the video are corrupted 😬 I cannot catch a break.
bad-baudy.mp4