Skip to content

Commit

Permalink
Fix IMU sensor functions to propagate failure status
Browse files Browse the repository at this point in the history
  • Loading branch information
atharvakedia authored Jan 13, 2025
1 parent 6f4dd25 commit 5d13042
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/imu/imu.cpp
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");
return false;
}

ICM_20948_AGMT_t agmt = myICM.getAGMT();

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

0 comments on commit 5d13042

Please sign in to comment.