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

Support for a non-blocking access pattern #24

Open
JeffyW opened this issue Aug 5, 2016 · 0 comments
Open

Support for a non-blocking access pattern #24

JeffyW opened this issue Aug 5, 2016 · 0 comments

Comments

@JeffyW
Copy link

JeffyW commented Aug 5, 2016

In this library, the standard readRawTemperature and ReadRawPressure code makes use of delays to allow the sensor to perform the reads as per the datasheet. When reading the pressure at higher resolutions, these delays can exceed 31ms (5ms for temp and another 26ms for the highest resolution pressure).

On an Arduino Mega 2560 with a 16mhz board hooked up to a 10DoF, it takes approximately:

  • 1.8ms to call getEvent on the Mag
  • 1.1ms to call getEvent on the Accel
  • 1.1ms to call getEvent on the Gyro

Rather than wasting that time sitting in a delay, we could be processing data from other sensors.

I'd like to propose adding a method like "isDataReady()" which internally would issue the requests and record what time the request would complete, and when called after that time has passed, read the data into a persisted variable and kick off the next request. When polling in this mode, the getTemperature and getPressure calls would simply use the persisted variable rather than requesting / reading the data directly.

@JeffyW JeffyW mentioned this issue Aug 5, 2016
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

No branches or pull requests

1 participant