OneWire Library Bug / Proposed FIX (June 2019) Affects DS18B20 and other OneWire devices


#41

Thank you very much. Yes, the code is pretty different, but full of gems! I’m working on adapting it now. Thanks again.


#42

Thank you so much for the great work here. I have struggled with the onewire lib for years. Add one more verification this fix works 100% on the Photon. Using 2 probes my error rates dropped from ~10% to 0.


#43

Okay, well-meaning idiot here. :smile:

How do I update the OneWire library with the code earlier in this thread? I see it’s called by the DS18B20 library, but that library is called directly from Particle resources and is not in my firmware code. I’m using the Web IDE.

Any pointers in the right direction greatly appreciated.

Thanks!


#44

Since 2.0.3 is the latest OneWire version in the cloud the DS18B20 library can’t really pull a newer version in. I’d reupload the DS18B20 lib if there was a newer public OneWire version.

Having said that, you can add new files to a Web IDE project via the (+) icon top right.
Then name the added files according to the library files you’d need to modify and copy paste the library codes into the respective file tabs.
It’s not comfortable but at least that way you can tweak the libraries to your needs.

@bsatrom, can the above fix be included in the official OneWire library and a new version made public?
BTW, the GitHub link is missing in 2.0.3 - having that available would make it easier to file issues and PRs on the library :wink:
Please also enable the Issues tab on the repo (as already mentioned half a year ago)

IMHO, official libraries should set an example in best practices on the meta-data side too :wink:


#45

Thanks for flagging @ScruffR, I’ll get the library fixed this week. In the meantime, I’ve just enabled Issues for the repo.


#46

Thanks, @ScruffR. That did it.

I “removed” the integrated DS18B20 library from my build in the IDE, and text copied and pasted the .h and .cpp files for DS18B20, OneWire, and DS18 as new library file tabs.

As others have noted, my DS18B20 temp sensors now seem super-robust and reliable in their readings.

Thanks also to all above (@Jonpcar and others) who took the time and effort to figure this thing out and make things a bit better for all of us.


#47

My electron would have good readings when using AUTOMATIC mode. However, when doing SEMI_AUTOMATIC it wouldn’t be reliable, after following the instructions on this post to modify the code it’s now running great in whatever mode I run it.
Thanks a lot for that, you saved a bunch of people’s headaches!


#48

Hey folks, just wanted to let you all know that the OneWire library has been updated with this fix, and published: https://build.particle.io/libs/OneWire/2.0.4/tab/DS18.cpp.

Thanks @ScruffR for the callout and @Jonpcar for the original fix!