From b3ff013308a5446f9ea77aa3a771be9cb610efaf Mon Sep 17 00:00:00 2001 From: Kiran Gowda Kempanna Date: Fri, 17 May 2024 13:52:46 +0200 Subject: [PATCH] Correct misidentification of Container PDUs. Co-authored-by: Rule Timothy Signed-off-by: Rule Timothy (VM/EMT3) --- extra/tools/network/build/package/gencode.py | 6 ++---- extra/tools/network/internal/app/generate/network.go | 3 +++ 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/extra/tools/network/build/package/gencode.py b/extra/tools/network/build/package/gencode.py index 983635c..bf707d6 100644 --- a/extra/tools/network/build/package/gencode.py +++ b/extra/tools/network/build/package/gencode.py @@ -38,9 +38,7 @@ def scan_messages(dbc_file, out_path, filter, cycle_time): for message in db.messages: if filter is not None and str(message.frame_id) in filter: continue - isContainer = False - if len(message.signal_groups) > 0 : - isContainer = True + isContainer = message.is_multiplexed() messageName = camel_to_snake_case(message.name) frames[messageName] = { 'frame_id': int(message.frame_id), @@ -52,7 +50,7 @@ def scan_messages(dbc_file, out_path, filter, cycle_time): } if str(message.frame_id) in cycle_time.keys(): frames[messageName]['cycle_time_ms'] = int(cycle_time[str(message.frame_id)]) - if isContainer : + if isContainer: for mux_id, signals in message.signal_tree[0]['Header_ID'].items(): frames[messageName + '_' + hex(mux_id)] = { 'container': messageName, diff --git a/extra/tools/network/internal/app/generate/network.go b/extra/tools/network/internal/app/generate/network.go index 99d3c99..dc1026e 100644 --- a/extra/tools/network/internal/app/generate/network.go +++ b/extra/tools/network/internal/app/generate/network.go @@ -108,6 +108,9 @@ func (c *GenNetworkCommand) Run() error { annotations["cycle_time_ms"] = frameInfo.CycleTime } } + if frameInfo == nil { + continue + } annotations["struct_name"] = structName // Signals (field/member names of the struct). signals := []kind.NetworkSignal{}