Skip to content

Commit 71d0379

Browse files
author
Eduard Bröcker
committed
fixes #572
1 parent a61d93c commit 71d0379

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/canmatrix/formats/sym.py

+3
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,9 @@ class Mode(object):
600600
if value_table_name is not None:
601601
signal.values = db.value_tables[value_table_name]
602602
signal.enumeration = value_table_name
603+
if enumeration is not None:
604+
signal.values = db.value_tables[enumeration]
605+
signal.enumeration = value_table_name
603606
# signal.add_comment(comment)
604607
# ... (1 / ...) because this somehow made 59.8/0.1 be 598.0 rather than 597.9999999999999
605608
if start_value is not None:

src/canmatrix/tests/test_sym.py

+20-1
Original file line numberDiff line numberDiff line change
@@ -397,4 +397,23 @@ def test_mux_decode(var_name,data,raw_value):
397397
frame = matrix.frame_by_name("MuxTestFrame")
398398
r = frame.decode(data)
399399
assert var_name in r.keys(), "Signal {}, not decoded. Only : {}".format(var_name, ','.join(r for r in r.keys()))
400-
assert r[var_name].raw_value == raw_value
400+
assert r[var_name].raw_value == raw_value
401+
402+
403+
def test_sym_val_table():
404+
sym = io.BytesIO(textwrap.dedent(u'''\
405+
FormatVersion=5.0 // Do not edit this line!
406+
Title="Test-CAN"
407+
408+
{ENUMS}
409+
enum Status_val(0="R", 1="B", 2="E")
410+
411+
{SENDRECEIVE}
412+
413+
[Flow_extCAN]
414+
ID=700h
415+
DLC=6
416+
Var=status Status_val 36,2
417+
''').encode('utf-8'))
418+
matrix = canmatrix.formats.sym.load(sym)
419+
assert matrix.frames[0].signals[0].values == {0: 'R', 1: 'B', 2: 'E'}

0 commit comments

Comments
 (0)