Skip to content

Saving dynamic/empty PDOs: TypeError: unsupported operand type(s) for |: 'NoneType' and 'int' #445

@friederschueler

Description

@friederschueler

Currently, if you have dynamic PDOs, which are only defined but not configured in the EDS-File, you can not save them, because they are initialized with cob_id = None, which can not be compared in this loc in pdo/base.py:376

self.com_record[1].raw = self.cob_id | PDO_NOT_VALID | (RTR_NOT_ALLOWED if not self.rtr_allowed else 0x0)

Also, map is initilized with [], but the save-check checks for None, which is never the case, so all pdo will be saved, even if they are empty.

Test to reproduce:

    def test_save_pdo(self):
        node = canopen.Node(1, EDS_PATH)
        node.tpdo.save()
        node.rpdo.save()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions