-
Notifications
You must be signed in to change notification settings - Fork 13.3k
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
Wire buffer length improvments. #8398
Wire buffer length improvments. #8398
Conversation
#ifndef I2C_BUFFER_LENGTH | ||
// DEPRECATED: Do not use BUFFER_LENGTH, prefer I2C_BUFFER_LENGTH |
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.
I expect this may be a bit controversial. My idea is to use the new I2C_BUFFER_LENGTH
functionality as a carrot to convince people to switch to the new define.
cc @d-a-v |
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.
LGTM
Thanks !
It has to be noted that the resulting flash occupation is decreased with this PR. So for example when one needs an |
Based on paclema/arduino-esp32@375a89e We should have been very careful when #defining things to not use a name that could conflict with the user's own code, so this marks that old define as deprecated. If you opt-into the new behavior, you do not get the old BUFFER_LENGTH constant. As a bonus, changing these uint8_ts to size_t both reduces the code size & improves performance.
I looked over the users of these variables and they should be fine with no additional changes. The existing methods already have an option to use size_t rather than uint8_t. There's a few methods which return int instead of size_t, which isn't great from a portability perspective but will be fine since this only is designed to run on the ESP8266.
7fea6d4
to
733eef3
Compare
That's interesting, and not something I expected. I've updated the commit message with this information. |
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.
LGTM, thanks!
* Enable I2C_BUFFER_LENGTH definition for Wire lib Based on paclema/arduino-esp32@375a89e We should have been very careful when #defining things to not use a name that could conflict with the user's own code, so this marks that old define as deprecated. If you opt-into the new behavior, you do not get the old BUFFER_LENGTH constant. As a bonus, changing these uint8_ts to size_t both reduces the code size & improves performance. * Increase buffer indexing variable size I looked over the users of these variables and they should be fine with no additional changes. The existing methods already have an option to use size_t rather than uint8_t. There's a few methods which return int instead of size_t, which isn't great from a portability perspective but will be fine since this only is designed to run on the ESP8266.
Enable I2C_BUFFER_LENGTH definition for Wire lib
Based on
paclema/arduino-esp32@375a89e
We should have been very careful when #defining things to not use a name
that could conflict with the user's own code, so this marks that old
define as deprecated.
If you opt-into the new behavior, you do not get the old BUFFER_LENGTH
constant.
Increase buffer indexing variable size
I looked over the users of these variables and they should be fine with
no additional changes. The existing methods already have an option to
use size_t rather than uint8_t.
There's a few methods which return int instead of size_t, which isn't
great from a portability perspective but will be fine since this only is
designed to run on the ESP8266.'
Fixes #8391
Feel free to use this patchset in full or in part.