From 5367d83ec953e2eaefcbf654ca3f6b65c8ee088c Mon Sep 17 00:00:00 2001 From: Jan Sommer Date: Tue, 4 Jun 2024 21:43:08 +0200 Subject: [PATCH] objectdictionary: Use node_id from DCF if not provided (#350) If no valid node_id (zero or None) is passed to import_eds(), try applying the one from the DeviceComissioning section if available. This mainly affects internal usage during import, namely interpolation of $NODEID references. --- canopen/objectdictionary/eds.py | 1 + 1 file changed, 1 insertion(+) diff --git a/canopen/objectdictionary/eds.py b/canopen/objectdictionary/eds.py index 5c2a72d5..cd64f604 100644 --- a/canopen/objectdictionary/eds.py +++ b/canopen/objectdictionary/eds.py @@ -87,6 +87,7 @@ def import_eds(source, node_id): if eds.has_section("DeviceComissioning"): od.bitrate = int(eds.get("DeviceComissioning", "Baudrate")) * 1000 od.node_id = int(eds.get("DeviceComissioning", "NodeID"), 0) + node_id = node_id or od.node_id for section in eds.sections(): # Match dummy definitions