Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions canopen/pdo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,9 @@ def save(self) -> None:
# mappings for an invalid object 0x0000:00 to overwrite any
# excess entries with all-zeros.
self._fill_map(self.map_array[0].raw)
subindex = 1
for var in self.map:
for subindex, var in enumerate(self.map, start=1):
if not var.od.writable:
continue
Comment on lines +426 to +428
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not doing what was intended, I believe. The check should skip mapping entries which cannot be changed. However, it tests the writable attribute of the object which is about to be mapped.

logger.info("Writing %s (0x%04X:%02X, %d bits) to PDO map",
var.name, var.index, var.subindex, var.length)
if getattr(self.pdo_node.node, "curtis_hack", False):
Expand All @@ -436,7 +437,6 @@ def save(self) -> None:
self.map_array[subindex].raw = (var.index << 16 |
var.subindex << 8 |
var.length)
subindex += 1
try:
self.map_array[0].raw = len(self.map)
except SdoAbortedError as e:
Expand Down