Skip to content

Conversation

notoriaga
Copy link
Contributor

@notoriaga notoriaga commented Jan 20, 2022

  • Adds a join to the message reader thread.
  • Adds a short one second validation of the serial connection to parse for a preamble message before starting up the process messages thread.

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

@notoriaga notoriaga force-pushed the steve/join branch 3 times, most recently from c263ecc to 51d8344 Compare January 20, 2022 22:02
@john-michaelburke john-michaelburke changed the title [test] join reader thread Join reader thread + serial conn validation check[CPP-593] Jan 21, 2022
@john-michaelburke
Copy link
Collaborator

@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.

@john-michaelburke john-michaelburke requested a review from a team January 21, 2022 22:23

Ok((Box::new(rdr), Box::new(writer)))
}
fn validate_serial_port(&self) -> std::result::Result<(), std::io::Error> {
Copy link
Contributor Author

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?

Copy link
Collaborator

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. 🤷

Copy link
Contributor Author

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 🤷

Copy link
Collaborator

@john-michaelburke john-michaelburke left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👀

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.

2 participants