Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add possibility to set power mode, add function for calculate sea level pressure #5

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

germsb
Copy link

@germsb germsb commented Jul 27, 2019

Add setconfig function:

  • set pressure oversampling
  • set temperature oversampling
  • set IIR filter
  • set powermode
  • set ODR (output data rate)
  • set interrupt (data ready interrupt, see 3.7.5.3)

Add getSealevelPressure function:
Return sea level pressure in Pa according to the local altitude in meter and atmospheric pressure in Pa.

Modif performReading function to remove redundancies:
No need to redefine all settings at each reading, only power mode should be if it is set to forced mode.

Modif readAltitude function:
Sea level pressure param must be now defined in Pa. Now, for simplicity, all the params and values returned from the API are in Pa

Delete setTemperatureOversampling, setPressureOversampling, setIIRFilterCoeff and setOutputDataRate functions.
Not needed anymore.

It's my first coding in c/c++/ardui, I see this as an exercise, remarks are welcome :)
Have fun.

@germsb germsb changed the title Add posibility to set power mode, add function for calculate sea level pressure Add possibility to set power mode, add function for calculate sea level pressure Jul 27, 2019
@ladyada
Copy link
Member

ladyada commented Jul 28, 2019

hiya you removed some functions, which makes it impossible for us to merge. please try splitting the PR into multiple small branches for each change, but don't delete functions.

@germsb
Copy link
Author

germsb commented Aug 3, 2019

Indeed, I am merging the configuration functions into one.
The current implementation may seem correct, but it allows to exploit only a small part of the power of the sensor. Only the FORCED_MODE is supported which makes besides the setOutputDataRate function useless. There remains the possibility to configure the irr filter and temperature / pressure oversampling. Too bad when we see the possibilities of the sensor. Moreover, the implementation of the function performReading constrains to rewrite at each reading the totality of the configuration on the sensor whereas only the power mode must be it when defined on FORCED_MODE. In short, two writes for one read, it's not very efficient.
So yes, my pull request modifies how to use the library, but improves performance, provides the ability to set the power mode and therefore enjoy the outputdatarate setting in NORMAL_MODE, and also allows to use the sensor data ready interrupt function.
Before long, I plan to implement the fifo mode and correctly implement the different interrupt mode

@ladyada
Copy link
Member

ladyada commented Aug 3, 2019

hiya its possible to do this withoutt breakint existing functionality - please update the PR and we can merge it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants