File tree 3 files changed +16
-3
lines changed
3 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -551,11 +551,15 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
551
551
db .frames .append (frame )
552
552
add_frame_by_id (frame )
553
553
elif decoded .startswith ("SG_ " ):
554
+ original_line = l
555
+ if decoded .strip ().endswith (r'"' ):
556
+ decoded += r" Vector__XXX"
557
+ original_line += b" Vector__XXX"
554
558
pattern = r"^SG_ +(\w+) *: *(\d+)\|(\d+)@(\d+)([\+|\-]) *\(([0-9.+\-eE]+), *([0-9.+\-eE]+)\) *\[([0-9.+\-eE]+)\|([0-9.+\-eE]+)\] +\"(.*)\" +(.*)"
555
559
regexp = re .compile (pattern )
556
560
temp = regexp .match (decoded )
557
561
regexp_raw = re .compile (pattern .encode (dbc_import_encoding ))
558
- temp_raw = regexp_raw .match (l )
562
+ temp_raw = regexp_raw .match (original_line )
559
563
if temp :
560
564
receiver = [b .strip () for b in temp .group (11 ).split (',' )]
561
565
@@ -587,7 +591,7 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
587
591
regexp = re .compile (pattern )
588
592
regexp_raw = re .compile (pattern .encode (dbc_import_encoding ))
589
593
temp = regexp .match (decoded )
590
- temp_raw = regexp_raw .match (l )
594
+ temp_raw = regexp_raw .match (original_line )
591
595
receiver = [b .strip () for b in temp .group (12 ).split (',' )]
592
596
multiplex = temp .group (2 ) # type: str
593
597
Original file line number Diff line number Diff line change @@ -508,3 +508,11 @@ def test_float_cycle_time():
508
508
assert matrix .frames [0 ].cycle_time == 100
509
509
510
510
511
+ def test_without_ecu ():
512
+ dbc = io .BytesIO (textwrap .dedent (u'''\
513
+ BO_ 17 Frame_1: 8 Vector__XXX
514
+ SG_ A_B_C_D_E: 39|16@0+ (0.01,0) [0|655.35] "km/h"
515
+ ''' ).encode ('utf-8' ))
516
+
517
+ matrix = canmatrix .formats .dbc .load (dbc , dbcImportEncoding = "utf8" )
518
+ matrix .frames [0 ].signals [0 ].name == "A_B_C_D_E"
Original file line number Diff line number Diff line change @@ -114,7 +114,8 @@ def decode_number(value, float_factory): # type(string) -> (int)
114
114
:param value: string input value
115
115
:return: integer
116
116
"""
117
-
117
+ if value is None :
118
+ return 0
118
119
value = value .strip ()
119
120
120
121
if '.' in value :
You can’t perform that action at this time.
0 commit comments