Closed countrysideboy closed 1 year ago
@countrysideboy
What do you expect from no-blocking in terms of time? == What amount of blocking is acceptable? Did you investigate the datasheet of what is possible?
bool SHT::read(bool fast)
{
if (writeCmd(fast ? SHT_MEASUREMENT_FAST : SHT_MEASUREMENT_SLOW) == false)
{
return false;
}
delay(fast ? 4 : 15); // table 4 datasheet
return readData(fast);
}
can be split up in something like this
bool SHT::request(bool fast)
{
if (writeCmd(fast ? SHT_MEASUREMENT_FAST : SHT_MEASUREMENT_SLOW) == false)
{
return false;
}
requestTime = millis();
requestPending = true;
}
// returns false or reads the data and returns true
bool requestReady(bool fast)
{
if (requestPending == false) return false;
if ( ( millis() - requestTime ) < (fast ? 4 : 15) ) return false;
readData(fast);
requestPending = false;
return true;
}
Alternative, without requestPending...
// returns false or reads the data and returns true
bool requestReady(bool fast)
{
if ( ( millis() - requestTime ) > 3000 ) return false;
if ( ( millis() - requestTime ) < (fast ? 4 : 15) ) return false;
readData(fast);
return true;
}
Think without request pending is better. User is responsible for tracking requests.
@countrysideboy Can you tell more about what you exactly requested .
I interpreted it that you want a asynchronous interface for the SHT85 but that already exists. (there are a few small problems that are under investigation)
Or did you mean you want an async interface for the SHT2X library. The I interpreted your oneliner wrong.
Hello, Robtillaart, thanks for your project.I use both si7021 and sht30 sensors in my diy clock, and I have successfully running the sht30 in async mode with the sht85 code.I hope that I could use the si7021 too, cause my clock will request the ntp time and alarm hourly.
I used to create a lib of si7021 myself, and makes the temperature request and read splitly.I use a library called pthead (pt.h), which provides the emulate multiple threads ability, and use a PT_DELAY macro instead of the delay() function.
OK, sounds like a nice project. But I still do not understand your question.
https://github.com/RobTillaart/DHTNew does work with the SOnOff Si7021 since oktober 2022 Did not test it myself. See for discussion - https://github.com/RobTillaart/DHTNew/issues/79
The Si7021 does not work with the SHT85 library.
There might be more Si7021 named sensors in the world. As my SHT2X library derives it and it is a way different protocol.
Do you have a link to the Si7021 you use?
There might be more Si7021 named sensors in the world. As my SHT2X library derives it and it is a way different protocol.
Do you have a link to the Si7021 you use?
There might be more Si7021 named sensors in the world. As my SHT2X library derives it and it is a way different protocol. Do you have a link to the Si7021 you use?
Those should work with the SHT2X library
OK, and your question is to have an ASYNC interface on the SHT2X library.?
I try to use SHT2X library, and find it does not provide the asynchronous interface like SHT85.Maybe I can merge the SHT2X code into SHT85, although it has different i2c address and protocol.
have
Yes, sorry for my confused request. I am looking forward to have an ASYNC interface on the SHT2X.
Those are not compatible enough to merge.
I created a new issue - https://github.com/RobTillaart/SHT2x/issues/16 - describing the problem a bit. Furthermore it describes your request in more detail.
SO I close this issue, and we can continue in the other.
Those are not compatible enough to merge.
I created a new issue - RobTillaart/SHT2x#16 - describing the problem a bit. Furthermore it describes your request in more detail.
SO I close this issue, and we can continue in the other.
Thank you.
@countrysideboy Thanks for this issue, I will transfer it to the SHT85 and look into it if it is feasable.