Skip to content

Commit

Permalink
TPDO mappings may be read-only
Browse files Browse the repository at this point in the history
  • Loading branch information
erlend-aasland committed Sep 2, 2024
1 parent 6bc90a8 commit fdf5724
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions canopen/pdo/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -427,15 +427,19 @@ def save(self) -> None:
for var in self.map:
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):
# Curtis HACK: mixed up field order
self.map_array[subindex].raw = (var.index |
var.subindex << 16 |
var.length << 24)
else:
self.map_array[subindex].raw = (var.index << 16 |
var.subindex << 8 |
var.length)
try:
if getattr(self.pdo_node.node, "curtis_hack", False):
# Curtis HACK: mixed up field order
self.map_array[subindex].raw = (var.index |
var.subindex << 16 |
var.length << 24)
else:
self.map_array[subindex].raw = (var.index << 16 |
var.subindex << 8 |
var.length)
except SdoAbortedError as e:
if e.code != 0x06010002:
raise
subindex += 1
try:
self.map_array[0].raw = len(self.map)
Expand Down

0 comments on commit fdf5724

Please sign in to comment.