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

Kankan patch1 #604

Merged
merged 3 commits into from
Oct 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/canmatrix/cli/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ def get_formats():
@click.option('--signals', help="Copy only given Signals (comma separated list) to target matrix just as 'free' signals without containing frame")
@click.option('--merge', help="merge additional can databases.\nSyntax: --merge filename[:ecu=SOMEECU][:frame=FRAME1][:frame=FRAME2],filename2")
@click.option('--ignorePduContainer/--no-ignorePduContainer', 'ignorePduContainer', default = False, help="Ignore any Frame with PDU container; if no export as multiplexed Frames\ndefault False")
@click.option('--calcSignalMax/--no-calcSignalMax', 'calcSignalMax', default = False, help="Calculate Signals Maximum Physical Value; If maximum value is set to 0\ndefault False")
@click.option('--recalcSignalMax/--no-recalcSignalMax', 'recalcSignalMax', default = False, help="Recalculate Signals Maximum Physical Value for the entire database\ndefault False")


# arxml switches
Expand Down
13 changes: 13 additions & 0 deletions src/canmatrix/convert.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,19 @@ def convert(infile, out_file_name, **options): # type: (str, str, **str) -> Non
for signal in [b for a in db for b in a.signals]:
signal.name = signal.attributes.get(options.get('signalNameFromAttrib'), signal.name)

# Max Signal Value Calculation , if max value is 0
if options.get('calcSignalMax') is not None and options['calcSignalMax']:
for signal in [b for a in db for b in a.signals]:
if signal.max == 0 or signal.max is None:
signal.calc_max_for_none = True
signal.set_max(None)

# Max Signal Value Calculation
if options.get('recalcSignalMax') is not None and options['recalcSignalMax']:
for signal in [b for a in db for b in a.signals]:
signal.calc_max_for_none = True
signal.set_max(None)

logger.info(name)
logger.info("%d Frames found" % (db.frames.__len__()))

Expand Down