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

IMU data reads #21

Open
alanbithell opened this issue Jun 25, 2019 · 2 comments
Open

IMU data reads #21

alanbithell opened this issue Jun 25, 2019 · 2 comments

Comments

@alanbithell
Copy link

In your function dmpDataReady, instead of setting IMUdataReady = 1, try incrementing the value, then in your main loop, read the data IMUdataReady times to clear the FIFO and decrement that counter with each loop.
This will prevent fifo overflow and give you the most recent value from the IMU.
I would have added this to code and created a PR but part 19 isn't up.

void dmpDataReady() {
    IMUdataReady++;
}

...main loop...

// IMU test
while (IMUdataReady > 0) {
    readAngles();
    IMUdataRead--;
}
@XRobots
Copy link
Owner

XRobots commented Jun 25, 2019

According to the example code it'll read multiple values out of the FIFO when the function is called anyway, so it should never leave anything behind.

@alanbithell
Copy link
Author

alanbithell commented Jun 25, 2019 via email

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

2 participants