Skip to content

Commit e7a3405

Browse files
committed
Apply suggestion
1 parent 8c51146 commit e7a3405

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/canmatrix/formats/dbc.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,9 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
584584
receivers=receiver,
585585
**extras
586586
)
587+
if not temp_signal.is_little_endian:
588+
# startbit of motorola coded signals are MSB in dbc
589+
temp_signal.set_startbit(int(temp.group(2)), bitNumbering=1)
587590
frame.add_signal(temp_signal)
588591
# db.frames.addSignalToLastFrame(tempSig)
589592
else:
@@ -634,9 +637,11 @@ def add_frame_by_id(new_frame): # type: (canmatrix.Frame) -> None
634637
if is_complex_multiplexed or is_multiplexer:
635638
temp_signal.is_multiplexer = True
636639
temp_signal.multiplex = 'Multiplexor'
637-
640+
641+
if not temp_signal.is_little_endian:
642+
# startbit of motorola coded signals are MSB in dbc
643+
temp_signal.set_startbit(int(temp.group(3)), bitNumbering=1)
638644
frame.add_signal(temp_signal)
639-
640645
if is_complex_multiplexed:
641646
frame.is_complex_multiplexed = True
642647

src/canmatrix/formats/fibex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ def create_signal_instance(parent, signal, signal_id):
8181
# type: (_Element, Signal, str) -> _Element
8282
signal_instance = create_sub_element_fx(parent, "SIGNAL-INSTANCE")
8383
signal_instance.set("ID", "PDUINST_" + signal_id)
84-
create_sub_element_fx(signal_instance, "BIT-POSITION", str(signal.start_bit))
84+
create_sub_element_fx(signal_instance, "BIT-POSITION", str(signal.get_startbit(bit_numbering=1))
8585
create_sub_element_fx(signal_instance, "IS-HIGH-LOW-BYTE-ORDER", "false" if signal.is_little_endian else "true")
8686
return signal_instance
8787

0 commit comments

Comments
 (0)