Coder Social home page Coder Social logo

Comments (2)

Gadgetoid avatar Gadgetoid commented on July 19, 2024

It's a side-effect of the fact it makes sense for all the readings to be processed at once, coupled with the fact I prefer methods over attributes for getting values... and you kind of expect a method to do something and fetch the data.

There are ways this could be mitigated, but it's one of those cases where running update_sensor() twice probably hurts less than contriving some method to prevent it.

With the benefit of hindsight, I'd probably rewrite the whole library API 😬 but since we can't really do that, I'm open to suggestions!

from bme280-python.

JimMadge avatar JimMadge commented on July 19, 2024

It's a side-effect of the fact it makes sense for all the readings to be processed at once

On that point, it did occur to me that adding a get_readings method which returns a tuple (temperature, pressure, humidity) would be a nice addition for those who want to get all of the values, particularly in forced mode. I could do that if you'd like.

coupled with the fact I prefer methods over attributes for getting values...

This is precisely the kind of thing that makes me spend a day agonising over how I should do something rather than actually doing it 😆 . Python's flexibility can be a blessing and a curse.

I think it would be safe to remove self.update_sensor() from get_altitude as it will always be called anyway on the first line of get_pressure (and get_pressure requires that line to function correctly).

from bme280-python.

Related Issues (18)

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.