Skip to content

Commit 44d3121

Browse files
authored
store multiple scalings per signal (LDF-import) (#823)
1 parent f02e080 commit 44d3121

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/canmatrix/canmatrix.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ class Signal(object):
191191

192192
cycle_time = attr.ib(default=0) # type: int
193193
initial_value = attr.ib(converter=float_factory, default=float_factory(0.0)) # type: canmatrix.types.PhysicalValue
194-
194+
scale_ranges = attr.ib(factory=list)
195195
min = attr.ib(
196196
converter=lambda value, float_factory=float_factory: (
197197
float_factory(value)

src/canmatrix/formats/ldf.py

+6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ def load(f, **options): # type: (typing.IO, **typing.Any) -> canmatrix.CanMatri
2525
if isinstance(converter, ldfparser.encoding.LogicalValue):
2626
cm_signal.add_values(converter.phy_value, converter.info)
2727
if isinstance(converter, ldfparser.encoding.PhysicalValue):
28+
cm_signal.scale_ranges.append({
29+
"min" : converter.phy_min,
30+
"max" : converter.phy_max,
31+
"factor" : converter.scale,
32+
"offset" : converter.offset,
33+
"unit" : converter.unit})
2834
cm_signal.offset = converter.offset
2935
cm_signal.factor = converter.scale
3036
cm_signal.unit = converter.unit

0 commit comments

Comments
 (0)