Repository navigation
Fix SeeedStudio recv crash on empty serial read - #2072
jafrivacation wants to merge 1 commit into
Conversation
|
Tick the box to add this pull request to the merge queue (same as
|
|
This is very nice as it completely omits crashes (exceptions). I personally would prefer to have this merged, as it clearly is an improvement. Tough, I haven't tested it yet. However with this solution, we still have occasionally "packet loss" (~1% for my use-case). A possible solution for correctly detecting the frame and parsing the data would be:
Demo implementation of exactly this solution:
Additionally noteworthy are the following cases: So to cover the case "C)", it is very important to initially "synchronize" to the CAN data. (Or did I call this framing before?) The case "B)" is useful for development of the parser, it is easier to implement the parser, when the synchronisation does not need to be final yet. |
Summary of Changes
Fix Seeed Studio CAN interface handling of empty reads.
Related Issues / Pull Requests
Type of Change
Checklist
tox).Additional Notes
This fixes the crash described in #2024 by guarding against empty reads before trying to parse the returned data. I reproduced the failure path, confirmed that an empty read could be returned, and updated the receive logic so empty data is skipped instead of being treated as a valid frame.