Skip to content

Commit b470a0a

Browse files
friederschuelerbizfsc
authored andcommitted
Update canopen/pdo/base.py:
- additional logging on enabling pdo - minor formatting options
1 parent b2fa0bb commit b470a0a

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

canopen/pdo/base.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,8 @@ def _raw_from(param):
359359
subindex = (value >> 8) & 0xFF
360360
# Ignore the highest bit, it is never valid for <= 64 PDO length
361361
size = value & 0x7F
362-
if getattr(self.pdo_node.node, "curtis_hack", False): # Curtis HACK: mixed up field order
362+
if getattr(self.pdo_node.node, "curtis_hack", False):
363+
# Curtis HACK: mixed up field order
363364
index = value & 0xFFFF
364365
subindex = (value >> 16) & 0xFF
365366
size = (value >> 24) & 0x7F
@@ -371,7 +372,7 @@ def _raw_from(param):
371372
def save(self) -> None:
372373
"""Save PDO configuration for this map using SDO."""
373374
if self.cob_id is None:
374-
logger.debug("Skipping %s: no cob-id set", self.com_record.od.name)
375+
logger.info("Skip saving %s: COB-ID was never set", self.com_record.od.name)
375376
return
376377
logger.info("Setting COB-ID 0x%X and temporarily disabling PDO", self.cob_id)
377378
self.com_record[1].raw = self.cob_id | PDO_NOT_VALID | (RTR_NOT_ALLOWED if not self.rtr_allowed else 0x0)
@@ -422,7 +423,9 @@ def save(self) -> None:
422423
self._update_data_size()
423424

424425
if self.enabled:
425-
self.com_record[1].raw = self.cob_id | (RTR_NOT_ALLOWED if not self.rtr_allowed else 0x0)
426+
cob_id = self.cob_id | (RTR_NOT_ALLOWED if not self.rtr_allowed else 0x0)
427+
logger.info("Setting COB-ID 0x%X and re-enabling PDO", cob_id)
428+
self.com_record[1].raw = cob_id
426429
self.subscribe()
427430

428431
def subscribe(self) -> None:

0 commit comments

Comments
 (0)