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

Approach to make named mode default #69

Closed
nielsvd opened this issue Apr 7, 2021 · 2 comments · Fixed by #84
Closed

Approach to make named mode default #69

nielsvd opened this issue Apr 7, 2021 · 2 comments · Fixed by #84
Assignees
Labels
enhancement New feature or request

Comments

@nielsvd
Copy link
Collaborator

nielsvd commented Apr 7, 2021

Assuming my current understanding of this package is sufficient. Let us say (for simplicity) we want to assign two modes to an example_node: mode A and mode B. In both modes, we would like to redefine a long list of parameters. The package needs a __DEFAULT__ mode to be defined that is actually named as such, assume that we choose mode A to be default, the current working approaches that I found is to either:

  1. Rename mode A to __DEFAULT__, meaning our example_node has modes __DEFAULT__ and B. Effective, but not very idiomatic.
  2. Define an additional __DEFAULT__ mode, meaning our example_node has modes A, B, __DEFAULT__. To ensure that A and __DEFAULT__ are effectively the same, it is necessary to keep the parameters in their configuration are identical. Especially when there are many parameters this becomes tedious.

I'm not sure how to do this most effectively. But it would be nice if we can define modes A and B and choose the default in some other way, perhaps through another key in the yaml file (next to type and modes)?

@norro norro added the enhancement New feature or request label Apr 7, 2021
@norro
Copy link
Collaborator

norro commented Apr 14, 2021

@nielsvd Would you prefer that

  1. the first mode defined for a part (system or node) in the SMH file is considered the default mode or
  2. at least one of the modes defined for a part (system or node) in the SMH file has to be marked default?

@nielsvd
Copy link
Collaborator Author

nielsvd commented Apr 15, 2021

I actually think both options would be fine. Perhaps 2, with a fall-back to 1 in case the explicit choice is missing (also for backwards compatibility)?

norro added a commit that referenced this issue Jun 11, 2021
#69

Signed-off-by: Nordmann Arne (CR/ADT3) <arne.nordmann@de.bosch.com>
norro added a commit that referenced this issue Jun 11, 2021
Default mode can now be defined by
* Naming a mode '__DEFAULT__' (backword compatible)
* Specifying the parameter '__default'
* Neither of these two, then te first mode of a part will be its default

#69

Signed-off-by: Nordmann Arne (CR/ADT3) <arne.nordmann@de.bosch.com>
norro added a commit that referenced this issue Jun 17, 2021
* Now parsing default modes for all system parts first, including its
custom name
* Introduced new matching function that considers custom default mode
names

#69

Signed-off-by: Nordmann Arne (CR/ADT3) <arne.nordmann@de.bosch.com>
@norro norro linked a pull request Jun 17, 2021 that will close this issue
@norro norro self-assigned this Jun 17, 2021
@norro norro closed this as completed in #84 Jul 21, 2021
norro added a commit that referenced this issue Jul 21, 2021
Default mode can now be defined by
* Naming a mode '__DEFAULT__' (backword compatibility)
* Specifying the parameter '__default'
* Neither of these two, then the first mode of a part will be its default

#69

Signed-off-by: Nordmann Arne (CR/ADT3) <arne.nordmann@de.bosch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants