GithubHelp home page GithubHelp logo

Comments (6)

RobTillaart avatar RobTillaart commented on June 26, 2024

Hi,

Thanks for your proposal, I will go through your points with my (first) thoughts.

Saves those raw values and exposes them

Given your rationale to transmit these - saving 50% - I think it is a good idea to do that. Names could be

  • rawHumidity
  • rawTemperature
    I prefer accessor functions e.g. getRawHumidity() getRawTemperature() around to prevent writing to them.
    These will be optimized by the compiler anyway but makes the variables effectively read-only preventing errors.
    The extra storage is 4 bytes, which is no problem imho.

Moves the conversion to actual floating point values to the getTemperature() and getHumidity() functions?

The rationale to have the math direct after read, is to do it only once per read. It allows one to access temperature / humidity more than once without redoing the math. So there is little need to change this sec. However in combination with the "raw" change it definitely makes sense (as the 2 floats to hold the temp/hum are replaced by 2 ints to hold their raw value).

Optionally: create a pair of boolean flags _needToRecomputeTemp/_needToRecomputeHumidity.

Think this is fixing a problem "created by design changes above", yes I understand 100% why one could do this.
However it is far easier to tell the user that if he wants to speed things up, he should cache the value himself.
That would also keep the code and memory footprint smaller, so in short a note in the readme.md file should be sufficient.

Please update the version number to 0.3.2 in your PR.

Any questions, let me know / or discuss in PR
Rob

Note: https://github.com/RobTillaart/SHT85 will be updated later - I try to keep these "cousins" a bit in sync.

from sht31.

RobTillaart avatar RobTillaart commented on June 26, 2024

0.3.2 released,

from sht31.

RobTillaart avatar RobTillaart commented on June 26, 2024

@jgillula
FYI, added the changes to https://github.com/RobTillaart/SHT85 library
thanks

from sht31.

jgillula avatar jgillula commented on June 26, 2024

Thank you so much!

from sht31.

jgillula avatar jgillula commented on June 26, 2024

BTW do you have a way I can toss some cash your way for making the most useful SHT-3X library I've found? :-D

from sht31.

RobTillaart avatar RobTillaart commented on June 26, 2024

Thanks for the compliment, you helped to improve it.
If there are other issues or you need a "better" library for some other device let me know.

I do not have a sponsor program in place (yet) so please donate to a charity of your choice.

from sht31.

Related Issues (12)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.