File tree 2 files changed +19
-1
lines changed
2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -932,7 +932,7 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
932
932
ecu .name = ecu .attributes .get ("SystemNodeLongSymbol" )[1 :- 1 ]
933
933
ecu .del_attribute ("SystemNodeLongSymbol" )
934
934
for frame in db .frames :
935
- frame .cycle_time = int (frame .attributes .get ("GenMsgCycleTime" , 0 ))
935
+ frame .cycle_time = int (float ( frame .attributes .get ("GenMsgCycleTime" , 0 ) ))
936
936
if frame .attributes .get ("SystemMessageLongSymbol" , None ) is not None :
937
937
frame .name = frame .attributes .get ("SystemMessageLongSymbol" )[1 :- 1 ]
938
938
frame .del_attribute ("SystemMessageLongSymbol" )
Original file line number Diff line number Diff line change @@ -489,3 +489,21 @@ def test_escaped_quotes():
489
489
assert matrix .frames [0 ].signals [0 ].values [2 ] == r'string with "escaped" double quotes'
490
490
491
491
492
+ def test_float_cycle_time ():
493
+ dbc = io .BytesIO (textwrap .dedent (u'''\
494
+ BO_ 17 Frame_1: 8 Vector__XXX
495
+ SG_ sig2 : 8|8@1- (1,0) [0|0] "" Vector__XXX
496
+ SG_ sig1 : 0|8@1- (1,0) [0|0] "" Vector__XXX
497
+
498
+
499
+ BA_DEF_ BO_ "GenMsgCycleTime" INT 0 3600000;
500
+ BA_ "GenMsgCycleTime" BO_ 17 100.0;
501
+ ''' ).encode ('utf-8' ))
502
+
503
+
504
+ matrix = canmatrix .formats .dbc .load (dbc , dbcImportEncoding = "utf8" )
505
+
506
+ assert matrix .frames [0 ].cycle_time == 100
507
+ assert matrix .frames [0 ].signal_by_name ("sig1" ).cycle_time == 10
508
+ assert matrix .frames [0 ].signal_by_name ("sig2" ).cycle_time == 20
509
+
You can’t perform that action at this time.
0 commit comments