Repository navigation
fix(mf4): convert 1-based BusChannel to 0-based Message.channel - #2166
Merged
Merged
Conversation
Collaborator
AI Review: fix(mf4): convert 1-based BusChannel to 0-based Message.channelThe fix is correct. Requested changes
Verdictrequest changes |
Contributor
Author
|
Thanks for the review! Addressed all three items in 05929ad:
|
Contributor
Author
|
you're welcome! thanks for the quick review. |
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.
Summary of Changes
MF4Reader(_CANDataFrameIterator,_CANErrorFrameIterator,_CANRemoteFrameIterator) to convert 1-based ASAM MDF4BusChannelvalues (>= 1) to 0-basedMessage.channelvalues (bus_channel - 1), leavingMessage.channelasNonewhenBusChannelis0(unspecified).MF4Writerto accept a default 1-basedchannel: int = 1parameter and write 1-basedBusChannelvalues (channel + 1for integer channels, orself.channelwhen unset), matchingASCReader/ASCWriter,BLFReader/BLFWriter, andTRCWriter.BusChannelreading,MF4Reader->TRCWriter/ASCWriterconversion, andMF4Writer1-based writing, and updated theBusChannel = 2expectation intest_error_frame_payloadfrom2to1.doc/changelog.d/2164.fixed.rst.Root Cause
ASCReader/ASCWriter,BLFReader/BLFWriter, andTRCWriterall treatMessage.channelas 0-based internally and convert to/from 1-based file bus numbers.MF4Readerpreviously passed 1-based ASAM MDF4BusChannelvalues through unchanged (e.g.,BusChannel = 1->Message.channel = 1), so converting.mf4to.trcor.asccaused the writer'schannel += 1conversion to shift every bus number up by one (producing2, 3, ...instead of1, 2, ...).Related Issues / Pull Requests
Type of Change
Checklist
doc/changelog.d/2164.fixed.rst.Verification
pytest -o addopts="" test/logformats_test.py test/test_scripts.py: 164 passed, 6 skipped.black --check can/io/mf4.py test/logformats_test.py: passed.ruff check can/io/mf4.py: passed.mypy --no-site-packages can/io/mf4.py: 0 errors incan/io/mf4.py.