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

This PR fixes issue #130 by ensuring that IMU sensor functions return failure status correctly. #165

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/imu/imu.cpp
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Repeat for Gryroscope and mag

Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,15 @@ void setupICM(void)
bool getAccelerometer(float *acc_x, float *acc_y, float *acc_z)
{
#if SF_PLATFORM == SF_PLATFORM_PARTICLE

myICM.getAGMT();

if (myICM.status != ICM_20948_Stat_Ok)
{
SF_OSAL_printf("Failed to get accelerometer data");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't use printf, add to FLOG

return false;
}

ICM_20948_AGMT_t agmt = myICM.getAGMT();

*acc_x = getAccMG(agmt.acc.axes.x, agmt.fss.a);
Expand Down
Loading