Skip to content

Incorrect _PDO_RESPONSE_CODES list #4

Closed
@MattHowardCT

Description

@MattHowardCT

In this line:

raise RuntimeError(self._PDO_RESPONSE_CODES[self.response])

The self.response value is being used to access the _PDO_RESPONSE_CODES list.

However at list index 2 is the value "INVALID COMMAND OR ARGUMENT" when this should be at list index 3.

This is because in the datasheet: https://en.hynetek.com/uploadfiles/site/219/news/eb6cc420-847e-40ec-a352-a86fbeedd331.pdf

The value 010 is not used in the PD_RESPONSE section of the PD_STATUS1 register.

The fix is to add another None value in the list.

So the following code:

_PDO_RESPONSE_CODES = [
"NO RESPONSE",
None, # Success
"INVALID COMMAND OR ARGUMENT",
"COMMAND NOT SUPPORTED",
"TRANSACTION FAILED, NO GOOD CRC",
]

Should instead be:

    # PDO response codes
    _PDO_RESPONSE_CODES = [
        "NO RESPONSE",
        None,  # Success
        None,  # Reserved 
        "INVALID COMMAND OR ARGUMENT",
        "COMMAND NOT SUPPORTED",
        "TRANSACTION FAILED, NO GOOD CRC",
    ]

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