Skip to content

Commit b52da1b

Browse files
committed
Add arr and record additional information later
1 parent b4907ad commit b52da1b

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

canopen/objectdictionary/__init__.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,14 +116,15 @@ class Record(MutableMapping):
116116
#: Description for the whole record
117117
description = ""
118118

119-
def __init__(self, name, index, storage_location):
119+
def __init__(self, name, index):
120120
#: The :class:`~canopen.ObjectDictionary` owning the record.
121121
self.parent = None
122122
#: 16-bit address of the record
123123
self.index = index
124124
#: Name of record
125125
self.name = name
126-
self.storage_location = storage_location
126+
#: Storage location of index
127+
self.storage_location = None
127128
self.subindices = {}
128129
self.names = {}
129130

@@ -171,14 +172,15 @@ class Array(Mapping):
171172
#: Description for the whole array
172173
description = ""
173174

174-
def __init__(self, name, index, storage_location):
175+
def __init__(self, name, index):
175176
#: The :class:`~canopen.ObjectDictionary` owning the record.
176177
self.parent = None
177178
#: 16-bit address of the array
178179
self.index = index
179180
#: Name of array
180181
self.name = name
181-
self.storage_location = storage_location
182+
#: Storage location of index
183+
self.storage_location = None
182184
self.subindices = {}
183185
self.names = {}
184186

canopen/objectdictionary/eds.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,21 @@ def import_eds(source, node_id):
6868
var = build_variable(eds, section, node_id, index)
6969
od.add_object(var)
7070
elif object_type == ARR and eds.has_option(section, "CompactSubObj"):
71-
arr = objectdictionary.Array(name, index, storage_location)
71+
arr = objectdictionary.Array(name, index)
7272
last_subindex = objectdictionary.Variable(
7373
"Number of entries", index, 0)
7474
last_subindex.data_type = objectdictionary.UNSIGNED8
7575
arr.add_member(last_subindex)
7676
arr.add_member(build_variable(eds, section, node_id, index, 1))
77+
arr.storage_location = storage_location
7778
od.add_object(arr)
7879
elif object_type == ARR:
79-
arr = objectdictionary.Array(name, index, storage_location)
80+
arr = objectdictionary.Array(name, index)
81+
arr.storage_location = storage_location
8082
od.add_object(arr)
8183
elif object_type == RECORD:
82-
record = objectdictionary.Record(name, index, storage_location)
84+
record = objectdictionary.Record(name, index)
85+
record.storage_location = storage_location
8386
od.add_object(record)
8487

8588
continue

0 commit comments

Comments
 (0)