From 5d13042aafae38f10978b86bfd841c0ae8f87fd3 Mon Sep 17 00:00:00 2001 From: Atharva Kedia <83458020+atharvakedia@users.noreply.github.com> Date: Sun, 12 Jan 2025 23:55:18 -0800 Subject: [PATCH] Fix IMU sensor functions to propagate failure status --- src/imu/imu.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/imu/imu.cpp b/src/imu/imu.cpp index 348f462..a22a3d9 100644 --- a/src/imu/imu.cpp +++ b/src/imu/imu.cpp @@ -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);