-
Notifications
You must be signed in to change notification settings - Fork 261
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
Allow Driving FFB Servo's through PCA9685 #98
base: proto5
Are you sure you want to change the base?
Allow Driving FFB Servo's through PCA9685 #98
Conversation
Update Branch to latest Proto 5 Firmware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, just a couple of comments.
Allow Driving FFB Servo's through PCA9685 Allows connecting and driving your FFB servo's through a PCA9685 I2C board instead of needing them directly connected to the ESP/Arduino, allowing you to control all your servo's using only two pins. I setup the PCA code to follow the input format of the ESP32Servo and Servo.h libraries, allowing the servo commands to be passed to the PCA without changes. Edit when squashing commits Cleanup of changes AdvancedConfig.h, & Lucidgloves-firmware.ino Remove unneeded include of "advancedConfig.h" in _main.ino Moved PCA9685 related defines in AdvancedConfig.h to only actually be defined if they where going to be accessed. Did the same for I2C in lucidgloves-firmware.ino as it is currently only used for this. Moves the PCA9685 initialization out of _main.ino and into the preexisting "setupServoHaptics" function in haptics.ino. This eliminated the need for any changes to _main.ino to implement PCA9685 support
9c9225a
to
85cd6f0
Compare
The function itself was moved into its own file for I2C to make it easier if someone else needs I2C support for other hardware in the future. Currently it's still called in the haptics.ino with the PCA9685 setup code as that is the only thing to use it.
85cd6f0
to
cfe87da
Compare
Well, I moved the I2C struct into its own file as a normal function. Doing so fixed the compile error by indirectly #including AdvancedConfig.h in haptics.ino (and also wire.h which I had missed before) Either way. It now compiles and from what I can tell fully works again. |
Changes servo code to derive from a new abstract IServo class that can be easily expanded on to make addition of future servo library support easier. + minor cleanup of extra spaces and lines in I2C.h & PCA9685Servo.ino
Moves the function & method declarations out of PCA9685.hpp and into their own .cpp file. Code mostly by danwillm. Co-Authored-By: danwillm <[email protected]>
Alright, I think that's everything from your original comments done. |
…) class The previous version of the PCA initialization code was being called before I2C was initialized, was being reran for each of the 5 servo objects, & wasn't acknowledging the configured I2C pins. This commit redoes it to be run as part of a subfunction within InitServoInterface() just as I2C initialization is.
Recombines PCA9685Servo.cpp & PCA9685Servo.hpp into a single .ino file so that #if statements can be used to prevent PCA code from being compiled & included when not actually using a PCA board.
Allows connecting and driving your FFB servo's through a PCA9685 I2C board instead of needing them directly connected to the ESP/Arduino, allowing you to control all your servo's using only two pins.
I setup the PCA code to follow the input format of the ESP32Servo and Servo.h libraries, allowing the servo commands to be passed to the PCA without changes.