I made some changes, but not sure best, that reduces the Over Sample rate down to 32ms from 512ms that you currently use. In addition I added three functions:
void setSeaPressure(float pascal); // allows user to set local sea level pressure
void readPressure(); // reads pressure in millibars
void readAltitude(); // reads altitude in meters and temperature in degrees centigrade
readPressure and readAltitude functions lifted from Kris Winers MPL3115A2 code. setSeaPressure from adafruit library since it was already there (just sets a register).
So now if a user wants MPL data they have to specifically ask for it so I removed the MPL3115_read call in the Update function. The code defaults to altimeter mode. When you call readPressure it switches to barometer mode and then back to altimeter mode. I also added a an example.
Hi Paul
In the thread, https://forum.pjrc.com/threads/40346-Teensy-3-2-w-Prop-Shield-Pressure-Sensor-causing-sketch-to-run-very-slow, and one of the Issues some folks wanted to make data from the MPL sensor visible to the user and improve speed.
I made some changes, but not sure best, that reduces the Over Sample rate down to 32ms from 512ms that you currently use. In addition I added three functions:
readPressure and readAltitude functions lifted from Kris Winers MPL3115A2 code. setSeaPressure from adafruit library since it was already there (just sets a register).
So now if a user wants MPL data they have to specifically ask for it so I removed the MPL3115_read call in the Update function. The code defaults to altimeter mode. When you call readPressure it switches to barometer mode and then back to altimeter mode. I also added a an example.
Let me know if you want anything changed.