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

set name option for multiplexer signal #579

Merged
merged 11 commits into from
Jun 23, 2023

Conversation

hyihua
Copy link
Contributor

@hyihua hyihua commented Jun 12, 2023

The function _dump_message uses multiplexer signal id as the signal name. However, it might be incompatible in some platforms, such as the screenshot shown.

image

In addition, using the ID as the name of the multiplexer signal is not clear enough for people to understand the meaning of this multiplexer. For this issue, I'd suggest that if the multiplexer signal has an original name, use the signal name rather than use the signal id.

If the multiplexer signal has a name, use the signal name rather than use the signal id.
change the expected value from from `MultiplexedSig` to `MultiplexorSig`
@andlaus
Copy link
Member

andlaus commented Jun 12, 2023

would be nice if a test case actually triggered that condition... (i.e., empty name for the multiplexer selector signal)

update

Co-authored-by: Andreas Lauser <github@poware.org>
@coveralls
Copy link

coveralls commented Jun 12, 2023

Pull Request Test Coverage Report for Build 5360296379

  • 8 of 8 (100.0%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.005%) to 93.903%

Totals Coverage Status
Change from base Build 5186159054: 0.005%
Covered Lines: 7254
Relevant Lines: 7725

💛 - Coveralls

update the test case to rename a multiplexer signal to empty to triggered renaming condition
@hyihua hyihua changed the title set option for multiplexer signal set name option for multiplexer signal Jun 12, 2023
The GitHub action checks failed because the code didn't use the right variable in `test_multiplex_sym_dump`

# Note: cantools database cannot support multiple multiplexer signal names, so SYM file names the multiplexer
# signal after the multiplexer id (Hence, 2A, not MultiplexerSig)
Copy link
Member

Choose a reason for hiding this comment

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

@samc1213: I don't get that comment. Do you remember what you meant to say here? (In my understanding, assigning more than one multiplexer selector signal to any multiplexed signal does not make sense anyway?)

Copy link
Contributor Author

@hyihua hyihua Jun 12, 2023

Choose a reason for hiding this comment

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

The relevant pull request where this change was added.

Copy link
Contributor Author

@hyihua hyihua Jun 20, 2023

Choose a reason for hiding this comment

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

@andlaus Are there any updates for this? Is there anything we can do to get this move forward?

Copy link
Member

Choose a reason for hiding this comment

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

I am just confused why this comment was made in the first place, but I think that it was spurious. (so everything is alright here as far as I can see...) I'll merge the PR once the special treatments for empty signal names (and the corresponding test) are removed...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The files are already updated. Please let me know if there are any other issues. We really hope that this feature can be merged and it's an important feature for our product implementation. Thanks @andlaus

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm sorry for the late reply. I can't recall why I thought SYM multiplexer and cantools database representations didn't match, and decided to use the multiplexer value as the signal name. I thought during parsing we would lose the name of each multiplexer, so we had to use the value or something. I tried to reproduce but couldn't.

* Report an error when meeting an empty signal name rather than set name to signal value.
* Generate a test case for testing exception
tests/test_database.py Outdated Show resolved Hide resolved
…_multiplex_sym_with_empty_signal_name_dump`
@hyihua hyihua requested a review from andlaus June 22, 2023 20:23
@andlaus
Copy link
Member

andlaus commented Jun 23, 2023

once the CI is happy (seems like there is a typing mistake somewhere), I'll merge this.

@hyihua
Copy link
Contributor Author

hyihua commented Jun 23, 2023

once the CI is happy (seems like there is a typing mistake somewhere), I'll merge this.

But it seems like the error was not introduced by my changes.
image

@andlaus
Copy link
Member

andlaus commented Jun 23, 2023

hm, this is what the github action logs say:
Screenshot_20230623_214042
@zariiii9003: Any idea what's going on here and how to fix it?

@andlaus
Copy link
Member

andlaus commented Jun 23, 2023

okay: the linter is not run on the tests, so

ruff check --fix ./cantools

fixes the issue. (it is unrelated to this PR...)

@hyihua
Copy link
Contributor Author

hyihua commented Jun 23, 2023

okay: the linter is not run on the tests, so

ruff check --fix ./cantools

fixes the issue. (it is unrelated to this PR...)

I run this command locally before, but just feel like it's not related to this pull request and then I should not push the changes to this pull request. But anyway, we should fix the issue. Made a new commit for that.

@andlaus
Copy link
Member

andlaus commented Jun 23, 2023

I think it would have been slightly better if you put the fixes ruff made to the tests into a separate PR, but since the CI is happy and IMO they are all janitorial changes which we would want to have at some point anyway, I'll merge. thanks for the contribution!

@andlaus andlaus merged commit 10eb7bb into cantools:master Jun 23, 2023
16 checks passed
@hyihua
Copy link
Contributor Author

hyihua commented Jun 23, 2023

I think it would have been slightly better if you put the fixes ruff made to the tests into a separate PR, but since the CI is happy and IMO they are all janitorial changes which we would want to have at some point anyway, I'll merge. thanks for the contribution!

That's a great suggestion. Thanks for that.

@hyihua
Copy link
Contributor Author

hyihua commented Jun 23, 2023

@andlaus, may I ask about when you will release a new version of cantools?

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.

None yet

4 participants