Skip to content
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

Adafruit_PWMServoDriver::setPWM returns 0 not endTransmission response #96

Closed
Carl-UB opened this issue Aug 10, 2023 · 4 comments
Closed

Comments

@Carl-UB
Copy link

Carl-UB commented Aug 10, 2023

Using ESP32 and VSCode with PlatformIO, but this issue doesn't relate to any particular board/IDE.

Adafruit_PWMServoDriver::setPWM documentation states that it returns the result from endTransmission, but in fact always returns 0.

* @return result from endTransmission

vs.

It would be good if either the documentation reflected reality, or even better if it actually returned the endTransmission response to allow for detection of errors. This would be similarly useful for Adafruit_PWMServoDriver::writeMicroseconds and Adafruit_PWMServoDriver::setPin.

@caternuson
Copy link
Contributor

Thanks. Looks like the docstring was not updated when the switch to BusIO was done.

@caternuson
Copy link
Contributor

OK, should be fixed with #98.

There are some limitations that prevent fully passing the endTransmission return. But it now returns 0 or 1. And docstring updated to reflect that.

@Carl-UB
Copy link
Author

Carl-UB commented Aug 11, 2023

Great, thanks for the speedy fix. Is there a generally preferred choice or rationale between returning a zero code on success vs. a bool indicating success or failure? E.g. Adafruit_PWMServoDriver::begin returns a bool but this returns uint?

@Carl-UB Carl-UB closed this as completed Aug 11, 2023
@caternuson
Copy link
Contributor

In that case, just to avoid making a breaking change. The return is currently uint8_t. Otherwise would make it a bool.

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

No branches or pull requests

2 participants