Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • F firmware
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Graph
    • Compare
  • Issues 74
    • Issues 74
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 29
    • Merge requests 29
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • External wiki
    • External wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • card10card10
  • firmware
  • Merge requests
  • !286

BME680 Refactor

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Rahix requested to merge rahix/bme680-refactor into master Aug 31, 2019
  • Overview 9
  • Commits 3
  • Pipelines 8
  • Changes 7

Add a sensor-class interface for the BME680 which is more pythonic than access through raw functions. This class also functions as a context-manager to automatically turn off the sensor once it is no longer needed.

The new interface allows a number of different ways to access the sensor:

import bme680

with bme680.Bme680() as environment:
    # Do a measurement, just for temperature
    t = environment.temperature

    # Do a measurement, just for humidity
    h = environment.humidity

    # Get all measurements in a single call; this is faster
    d = environment.get_data()
    t = d.temperature
    h = d.humidity

# Without context-manager
env = bme680.Bme680()
t = env.temperature
# Turn off manually:
env.close()

Closes #107 (closed)

cc @chris007

Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: rahix/bme680-refactor