Skip to content

Commit f1315d3

Browse files
authored
Gracefully handle missing Baudrate setting in DCF (#492)
The CiA306 spec is not quite clear on which fields are mandatory within the DeviceComissioning section. Thus it should be assumed that the two options handled here could be missing. Instead of raising an exception, ignore the absence of the Baudrate setting.
1 parent 6a4ca11 commit f1315d3

File tree

1 file changed

+2
-1
lines changed
  • canopen/objectdictionary

1 file changed

+2
-1
lines changed

canopen/objectdictionary/eds.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ def import_eds(source, node_id):
8585
pass
8686

8787
if eds.has_section("DeviceComissioning"):
88-
od.bitrate = int(eds.get("DeviceComissioning", "Baudrate")) * 1000
88+
if val := eds.get("DeviceComissioning", "Baudrate", fallback=None):
89+
od.bitrate = int(val) * 1000
8990

9091
if node_id is None:
9192
if val := eds.get("DeviceComissioning", "NodeID", fallback=None):

0 commit comments

Comments
 (0)