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

AHTxx.cpp:101:8: error: 'class TwoWire' has no member named 'setClockStretchLimit' #2

Closed
gotfredsen opened this issue Oct 29, 2021 · 5 comments

Comments

@gotfredsen
Copy link

I get this:

/Users/.../Documents/Arduino/libraries/AHTxx/src/AHTxx.cpp:101:8: error: 'class TwoWire' has no member named 'setClockStretchLimit'
   Wire.setClockStretchLimit(stretch); //experimental! default 150000usec
        ^~~~~~~~~~~~~~~~~~~~

so I commented out the line and now it works.

My Arduino installation is brand new, with latest libraries, on a new Mac. I used to use AHT10, but this pointed me to this library, so I haven't used it before. Running on a ESP32.

@davidkleng
Copy link

davidkleng commented Oct 29, 2021

Hi, im using ATMEGA328 with MiniCore and have the same problem.
My solution was to simply go to AHTxx.cpp, line 91 and changed the following:

Wire.setWireTimeout(stretch, false);   

with

Wire.setTimeout(stretch);

Everything works just fine.

@enjoyneering
Copy link
Owner

enjoyneering commented Oct 31, 2021

Hi folks,

Thank you for feedback. You probably need to update Arduino AVR Core. Recently Wire.setWireTimeout() timeout API method was added to the AVR Wire library. See arduino/reference-en#895

@gotfredsen
Copy link
Author

Hi folks,

Thank you for feedback. You probably need to update Arduino AVR Core. Recently Wire.setWireTimeout() timeout API method was added to the AVR Wire library. See arduino/reference-en#895

I am using an ESP32, not an AVR Core, and both Arduino and ESP32 board files were installed same day. Maybe the changes you are referring to has not yet been implemented for the ESP cores.

@enjoyneering
Copy link
Owner

enjoyneering commented Nov 1, 2021

Hi gotfredsen,

You're right. For some reason, Arduino ESP32 uses Wire.setTimeout(stretch) in milliseconds, while Arduino ESP8266 uses setClockStretchLimit(uint32_t) in microseconds. I believe the timeout for the I2C bus in milliseconds is too long, so in the library I'm using microseconds.

The library has been updated. Thank you for your help.

@enjoyneering
Copy link
Owner

fixed, see #5

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

3 participants