Skip to content

Incorrect _PDO_RESPONSE_CODES list #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
MattHowardCT opened this issue May 14, 2025 · 2 comments · Fixed by #6
Closed

Incorrect _PDO_RESPONSE_CODES list #4

MattHowardCT opened this issue May 14, 2025 · 2 comments · Fixed by #6

Comments

@MattHowardCT
Copy link

MattHowardCT commented May 14, 2025

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",
    ]
@BlitzCityDIY
Copy link
Contributor

hihi- would you be interested in opening a PR with this fix?

@MattHowardCT
Copy link
Author

hihi- would you be interested in opening a PR with this fix?

Yeah sure I'll create a PR tonight! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants