Skip to content

Commit

Permalink
free_parameter_info(): fix output of constant values
Browse files Browse the repository at this point in the history
instead of the representation of `CompuConst`, it is much better to
print the values expected/produced by the encoding/decoding routines.

Signed-off-by: Andreas Lauser <andreas.lauser@mbition.io>
Signed-off-by: Florian Jost <florian.jost@mbition.io>
  • Loading branch information
andlaus committed Aug 9, 2024
1 parent 80b65b7 commit 21f784d
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion odxtools/parameterinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,16 @@ def parameter_info(param_list: Iterable[Parameter], quoted_names: bool = False)
val_str = ""
if scale.lower_limit is not None:
val_str = f"({repr(scale.lower_limit.value)})"
of.write(f" {repr(scale.compu_const)}{val_str}\n")

if scale.compu_const is None:
of.write(f" <ERROR in ODX data: no value specified>\n")
else:
vt = scale.compu_const.vt
v = scale.compu_const.v
if vt is not None:
of.write(f" \"{vt}\" {val_str}\n")
else:
of.write(f" {v}\n")

elif isinstance(cm, IdenticalCompuMethod):
bdt = dop.physical_type.base_data_type
Expand Down

0 comments on commit 21f784d

Please sign in to comment.