Skip to content

Commit 2afeefb

Browse files
DALENCON StanislasDALENCON Stanislas
authored andcommitted
Add loading of DummyUsage definitions in order to map dummy data in PDO definition.
1 parent 61bc0a0 commit 2afeefb

File tree

1 file changed

+11
-0
lines changed
  • canopen/objectdictionary

1 file changed

+11
-0
lines changed

canopen/objectdictionary/eds.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,17 @@ def import_eds(source, node_id):
3636
od.node_id = int(eds.get("DeviceComissioning", "NodeID"))
3737

3838
for section in eds.sections():
39+
# Match dummy definitions
40+
match = re.match(r"^[D|d]ummy[U|u]sage$", section)
41+
if match is not None:
42+
for i in range(1,8):
43+
key = "Dummy%04d" % i
44+
if eds.getint(section,key) == 1:
45+
var = objectdictionary.Variable(key, i, 0)
46+
var.data_type = i
47+
var.access_type = "const"
48+
od.add_object(var)
49+
3950
# Match indexes
4051
match = re.match(r"^[0-9A-Fa-f]{4}$", section)
4152
if match is not None:

0 commit comments

Comments
 (0)