Repository navigation
sym: use the longest Len of a multiplexed message - #879
Merged
Merged
Conversation
Each section of a multiplexed SYM message can state its own Len, but only the Len of the first section was read. Signals from the later sections were then checked against that length, so loading failed with "The signal x does not fit in message y". Take the largest Len of the first section and the sections continuing it. Non-multiplexed messages and sections without a Len read as before.
Member
|
I don't know much about the SYM format, but the reasoning here seems correct. (I trust that your LLM got the implementation right.) Merging, thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #148
A multiplexed SYM message can repeat its section with a different
Len=for each multiplexer value:Loading this fails with
The signal value does not fit in message TestAlert._load_messagereadLenonly from the first section, the one with theID._load_muxed_message_signalsmerges the signals of every section with that name, so signals from the later sections were checked against the first section's length.The message length is now the largest
Lenamong the first section and the sections that continue it (same name, noID). Non-multiplexed messages and sections without aLenread the same as before.One behaviour change to check: a file whose first section is shorter than a later one now loads with the longer length, even if all its signals happened to fit the first. cantools keeps one length per message, so a short frame for the first multiplexer value now needs
allow_truncated=Trueto decode.What I ran:
test_multiplexed_sections_with_different_lengths_symfails before the change and passes after itpytest tests/test_database.py tests/test_convert.py tests/test_dump.py tests/test_list.py tests/test_database_merge.py tests/test_tester.py: 327 passedruff check src tests/test_database.py, andmypyonsym.pyonlyNot run: the rest of the test suite (command line, monitor, plot), tox, or the C code generation tests. I did not check the sample file in the PCAN Symbol Editor.