autorope / donkeycar

Open source hardware and software platform to build a small scale self driving car.
http://www.donkeycar.com
MIT License
3.13k stars 1.29k forks source link

adafruit_python_pca9685 and adafruit_circuitpython_pca9685 conflict #1108

Closed quebeh closed 1 year ago

quebeh commented 1 year ago

Hey guys, i want to use the newer adafruit_circuitpython_pca9685 library for other utilities. But it seems like donkeycar is using the old, deprecated library adafruit_python_pca9685.

Is there any replacement for donkeycar.parts.actuator.PWMThrottle (ESC module) that uses the new library? I have tried to download the old one's source code, but it seems like having both the modules having its own instances of PCA9685 objects will reduce the efficiency.

Any help is appreciated Thank you

Ezward commented 1 year ago

We have no plans to change that library, but we are definitely open to accepting a PR.

The old PCA9685 class is being deprecated in favor of PulseController which takes a PwmPin which can source Pwm from GPIO or PCA9685. That is what PWMSteering and PWMThrottle use to source the PWM signal. So there is no need to touch those; you want to change the implementation of the PCA9685 pwm pin at PwmPinPCA9685.

"both the modules having its own instances of PCA9685 objects will reduce the efficiency"

You are correct that the PwmPinPCA9685 implementation does use one PCA9685 instance per pin via the factory method pca9685. I don't think this is an issue but you are free to change that implementation detail if you decide to open a PR.

quebeh commented 1 year ago

Alright. Thank you very much. I'll get a better understanding of the pins.py code and possibly make a pull request.