-
Notifications
You must be signed in to change notification settings - Fork 207
Open
Description
The __getitem__
implementation for PdoBase
has following check:
if isinstance(key, int) and (0x1A00 <= key <= 0x1BFF or # By TPDO ID (512)
0x1600 <= key <= 0x17FF or # By RPDO ID (512)
0 < key <= 512): # By PDO Index
return self.map[key]
Suggesting that one could get the PDO with the Mapping Parameter Index
But looking at the __getitem__
of PdoMaps
:
def __getitem__(self, key: int) -> PdoMap:
return self.maps[key]
one can see that it makes a normal dictionary fetch.
When looking at how the dict is populated in the __init__
:
self.maps: Dict[int, PdoMap] = {}
for map_no in range(512):
...
self.maps[map_no + 1] = new_map
you see that the key is a normal index counting up the PdoMap added. So an access by the Mapping Parameter isn't possible.
Additionally I think an access via the Communication Parameter in addition to the Mapping Parameter could make sense. Either way, either the check in the PdoBase
needs to be redacted to only check 0 < key <= 512
or (what I think makes more sense) the __getitem__
in PdoMaps
needs to be changed.