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

Examples won't compile on ESP32 ? #13

Closed
CRprog opened this issue Mar 6, 2020 · 4 comments
Closed

Examples won't compile on ESP32 ? #13

CRprog opened this issue Mar 6, 2020 · 4 comments

Comments

@CRprog
Copy link

CRprog commented Mar 6, 2020

I'am using an ESP32 and want to use the setChannelsPWM to set 6 Servos at one I2C-write.
But the BatchingExample producing compile-errors:
no matching function for call to 'PCA9685::setChannelsPWM(int, int, word [12])'
and also other examples fail:
S:\arduino-1.8.10_ESP32\portable\sketchbook\libraries\PCA9685-Arduino\PCA9685.cpp:208:45: error: 'BUFFER_LENGTH' was not declared in this scope
int maxChannels = min(numChannels, (BUFFER_LENGTH - 1) / 4);

Any Idea ?

Edit:
By replacing "word pwms[12];" --> "uint16_t pwms[12];" in example the 1st error is gone :-)
Only the missing BUFFER_LENGTH remains in moment.

@NachtRaveVL
Copy link
Owner

I left this as a comment around its usage:

// In avr/libraries/Wire.h and avr/libraries/utility/twi.h, BUFFER_LENGTH controls
// how many channels can be written at once.

Since you're not using the AVR libraries (you're using ESP32) you'll probably have to self-define this.

Still may be worth coding in a default to use in any case.

@CRprog
Copy link
Author

CRprog commented Mar 7, 2020

Thank you for the hint, For me, I've added the marked (#) lines here in PCA9685.h
.....
#define PCA9685_MIN_CHANNEL 0
#define PCA9685_MAX_CHANNEL 15
#define PCA9685_CHANNEL_COUNT 16
#ifndef BUFFER_LENGTH (#)
#define BUFFER_LENGTH 32 (#)
#endif (#)
.....
Now it compiles. But maybe there's a better solution at another place ....
Btw.: If you maybe update sometime, think about adding a keywords.txt (?)

@NachtRaveVL
Copy link
Owner

Fixed on version 1.2.11. Pushed to master. No worries =). It was a good catch for an odd side case. Let me know if the new version helps or not. =)

@CRprog
Copy link
Author

CRprog commented Mar 15, 2020

Runs fine now 'out of the box' also in the ESP32 environment. Good job and have a nice day.

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