Skip to content

Commit 8c51146

Browse files
committed
Merge branch 'fbx_keep_the_signal_start_position_as_in_dbc_file' of https://github.com/SabrineBH/canmatrix into fbx_keep_the_signal_start_position_as_in_dbc_file
2 parents 083368a + 3bc25c4 commit 8c51146

File tree

6 files changed

+216
-108
lines changed

6 files changed

+216
-108
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
# os: [ubuntu-latest]
2020
experimental: [false]
2121
# python-version: ["2.7","3.4","3.5","3.6","3.7","3.8","3.9","3.10","3.11","3.12"]
22-
python-version: ["3.7","3.8","3.9","3.10","3.11","3.12"]
22+
python-version: ["3.8","3.9","3.10","3.11","3.12", "3.13"]
2323
fail-fast: false
2424
steps:
2525
- uses: actions/checkout@v4

appveyor.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ skip_branch_with_pr: true
77

88
environment:
99
matrix:
10-
- TOXENV: py37
1110
- TOXENV: py38
1211
- TOXENV: py39
1312
- TOXENV: py310

src/canmatrix/formats/arxml.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1134,7 +1134,8 @@ def get_signals(signal_array, frame, ea, multiplex_id, float_factory, bit_offset
11341134
isignal_ub = canmatrix.Signal(ub_name,
11351135
start_bit=int(ub_start_bit.text, 0),
11361136
size = 1,
1137-
is_signed = False)
1137+
is_signed = False,
1138+
unit = "Unitless")
11381139
frame.add_signal(isignal_ub)
11391140

11401141
group_id = group_id + 1
@@ -1389,7 +1390,8 @@ def get_signals(signal_array, frame, ea, multiplex_id, float_factory, bit_offset
13891390
new_signal_ub = canmatrix.Signal(ub_name,
13901391
start_bit = int(ub_start_bit.text, 0),
13911392
size = 1,
1392-
is_signed = False)
1393+
is_signed = False,
1394+
unit = "Unitless")
13931395
frame.add_signal(new_signal_ub)
13941396

13951397

@@ -1631,19 +1633,21 @@ def get_frame(frame_triggering, ea, multiplex_translation, float_factory, header
16311633
if freshness_tx_length is not None and int(freshness_tx_length, 0) > 0:
16321634
freshness_name = f"{ea.get_element_name(frame_elem)}_Freshness"
16331635
signal_freshness = canmatrix.Signal(freshness_name,
1634-
start_bit = int(ipdu_length, 0)*8 + int(freshness_tx_length, 0) - 8,
1636+
start_bit = int(ipdu_length, 0) * 8 + int(freshness_tx_length, 0) - 16,
16351637
size = int(freshness_tx_length, 0),
16361638
is_signed = False,
1637-
is_little_endian = False)
1639+
is_little_endian = False,
1640+
unit = "Unitless")
16381641
new_frame.add_signal(signal_freshness)
16391642

16401643
if auth_tx_length is not None and int(auth_tx_length, 0) > 0:
16411644
authinfo_name = f"{ea.get_element_name(frame_elem)}_AuthInfo"
16421645
signal_authinfo = canmatrix.Signal(authinfo_name,
1643-
start_bit = int(ipdu_length, 0)*8 + int(freshness_tx_length, 0) + int(auth_tx_length, 0) - 8,
1646+
start_bit = int(ipdu_length, 0) * 8 + int(freshness_tx_length, 0),
16441647
size = int(auth_tx_length, 0),
16451648
is_signed = False,
1646-
is_little_endian = False)
1649+
is_little_endian = False,
1650+
unit = "Unitless")
16471651
new_frame.add_signal(signal_authinfo)
16481652

16491653
comment = ea.get_element_desc(frame_elem)

src/canmatrix/formats/dbc.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,8 @@ def dump(in_db, f, **options):
223223
# remove "-" from frame names
224224
if compatibility:
225225
frame.name = re.sub("[^A-Za-z0-9]", whitespace_replacement, frame.name)
226+
if frame.name[0].isdigit():
227+
frame.name = "_" + frame.name
226228

227229
duplicate_signal_totals = collections.Counter(normalized_names.values())
228230
duplicate_signal_counter = collections.Counter() # type: typing.Counter[str]
@@ -459,7 +461,7 @@ def dump(in_db, f, **options):
459461
if frame.is_complex_multiplexed:
460462
for signal in frame.signals:
461463
if signal.muxer_for_signal is not None:
462-
f.write(("SG_MUL_VAL_ %d %s %s " % (frame.arbitration_id.to_compound_integer(), signal.name, signal.muxer_for_signal)).encode(dbc_export_encoding, ignore_encoding_errors))
464+
f.write(("SG_MUL_VAL_ %d %s %s " % (frame.arbitration_id.to_compound_integer(), output_names[frame][signal], signal.muxer_for_signal)).encode(dbc_export_encoding, ignore_encoding_errors))
463465
f.write((", ".join(["%d-%d" % (a, b) for a, b in signal.mux_val_grp])).encode(dbc_export_encoding, ignore_encoding_errors))
464466

465467
f.write(";\n".encode(dbc_export_encoding, ignore_encoding_errors))

0 commit comments

Comments
 (0)