Skip to content
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

Support choice tables in dump subcommand #65

Merged
merged 6 commits into from
Nov 8, 2018

Conversation

karlding
Copy link
Contributor

@karlding karlding commented Nov 7, 2018

This change implements choice tables in the dump subcommand.

@coveralls
Copy link

Coverage Status

Coverage increased (+0.04%) to 92.573% when pulling 387ea16 on karlding:support_choice_dump into 3c2aa1b on eerimoq:master.

@coveralls
Copy link

coveralls commented Nov 7, 2018

Coverage Status

Coverage increased (+0.04%) to 92.568% when pulling 402dca6 on karlding:support_choice_dump into 3c2aa1b on eerimoq:master.

Copy link
Collaborator

@eerimoq eerimoq left a comment

Choose a reason for hiding this comment

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

Please add a test where two signals in the same message have choices. I think I prefer the output to be:

Signal choices:

    Foo
        0 Disabled
        1 Enabled
        2 Other
        
    Bar
        0 On
        1 Off

cantools/database/can/message.py Outdated Show resolved Hide resolved
cantools/subparsers/dump.py Outdated Show resolved Hide resolved
Remove add_prefix inner function from signal_choice_string
This dumps in the following format

    Signal choices:

        Foo
            0 Disabled
            1 Enabled
            2 Other

        Bar
            0 On
            1 Off
@karlding
Copy link
Contributor Author

karlding commented Nov 8, 2018

Did you want me to add a command line test using tests/files/multiplex_choices.dbc, or is this along the lines of what you were thinking?

I wasn't sure if you wanted me to use that DBC, since there's another message inside besides the one with a multiplexed signal that has choice values.

@eerimoq
Copy link
Collaborator

eerimoq commented Nov 8, 2018

You can create a new DBC-file, say files/dump_signal_choices.dbc, for dump signal choices testing. The file should contain a message with two signals, both with choices. Other dump scenarios are already covered by existing dump tests it seems.

@eerimoq eerimoq merged commit 752123b into cantools:master Nov 8, 2018
@eerimoq
Copy link
Collaborator

eerimoq commented Nov 8, 2018

Part of release 28.13.0, available on PyPI!

@karlding karlding deleted the support_choice_dump branch November 11, 2018 02:03
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.

3 participants