piettetech / PietteTech_DHT

DHT Sensor Library for Spark Core
Other
53 stars 60 forks source link

Add timeout to acquireAndWait() method #3

Closed owendelong closed 8 years ago

owendelong commented 9 years ago

The proposed changes implement a timeout argument to acquireAndWait() in a manner compatible with existing behavior of the library. If timeout=0 or no timeout is specified, default is to wait until acquisition finishes even if it never does.

If timeout is given a non-zero value, then the function will return when acquisition finishes or after timeout milliseconds, whichever occurs first. The timeout function is written in such a way that it should handle millis() counter wraps.

I've done basic testing of this code in my application and it appears to work.

owendelong commented 8 years ago

Awesome… Thanks!!

Owen

On Feb 6, 2016, at 6:17 PM, Scott Piette notifications@github.com wrote:

Merged #3 https://github.com/piettetech/PietteTech_DHT/pull/3.

— Reply to this email directly or view it on GitHub https://github.com/piettetech/PietteTech_DHT/pull/3#event-541974032.

gusgonnet commented 8 years ago

question, is it possible to publish this change in Particle's Build/library? thanks!

piettetech commented 8 years ago

Hi, I wanted to test it but have not had the chance. Have you tested the updated repository?

On Mon, Feb 15, 2016 at 5:53 AM, Gustavo notifications@github.com wrote:

question, is it possible to publish this change in Particle's Build/library? thanks!

— Reply to this email directly or view it on GitHub https://github.com/piettetech/PietteTech_DHT/pull/3#issuecomment-184194425 .

gusgonnet commented 8 years ago

alright, I'll give it a try and post back. thanks

gusgonnet commented 8 years ago

Hi Scott, I tried the new changes in two of my projects during the weekend and they are both running fine. I'd suggest, but it's only a suggestion, that to avoid people experiencing the issues Owen fixed in this pull request, we modify the examples so they use acquireAndWait(5) instead of acquire() what do you guys think? thank you Gustavo.

piettetech commented 8 years ago

Thanks Gustavo, Good suggestion, I can make the changes. I'm not able to re-import my library and I am working with the Particle team to try and correct that issue.

Scott

On Mon, Feb 22, 2016 at 5:18 AM, Gustavo notifications@github.com wrote:

Hi Scott, I tried the new changes in two of my projects during the weekend and they are both running fine. I'd suggest, but it's only a suggestion, that to avoid people experiencing the issues Owen fixed in this pull request, we modify the examples so they use acquireAndWait(5) instead of acquire() what do you guys think? thank you Gustavo.

— Reply to this email directly or view it on GitHub https://github.com/piettetech/PietteTech_DHT/pull/3#issuecomment-187149539 .