#21 DS18(B)20 resolution cache fix

Johan Ström

Cache fix for DS18B20 (and friends with resolution support)
By default, 12 bit resolution is used when reading "temperature".
DS18B20 powers up with 12 bit resolution configured.
Previous code would find no cached value, read scratchpad and notice it
was correct, then continue on with the temperature reading.

If 12bit resolution was used all the time, no value would ever be
written to the cache, and we would read the scratchpad twice for every
single temperature reading.

Bug found when noticing that reading a simultaneously converted
18S20 (which has no resolution support) took almost half the time
compared to 18B20s.


(How do you want pull requests/patches now when GIT is used?)


  • Paul Alfille
    Paul Alfille

    I'm still a git newbie. How should I merge your patch back? -- Paul

    Last edit: Paul Alfille 2014-06-20
  • Johan Ström
    Johan Ström

    Ah, SF had fork and pull requests support built in, of course.

    A pull request is now open at https://sourceforge.net/p/owfs/code/merge-requests/1/
    You should be able to click some "accept & merge" or something, haven't merged a pull request on SF before so I'm not sure.. :)

    The pull request was created by:
    1. Go to owfs code tab
    2. Click Fork on the right hand side (clones the owfs repo to my SF user)
    3. Push my commits to a new branch in my repo
    4. On my repo/branch page at SF, click Request pull.

    For the record, to do the same thing manually against my github repo (which I'll remove now, keeping to SF), it would go something like this:
    1. git checkout master
    2. git remote add stromnet-github https://github.com/stromnet/owfs.git
    3. git fetch stromnet-github
    4. git merge stromnet-github/ds1820-resolution-cache-fix



Cancel   Add attachments