Fix calling of IMU/MAG data when no new data available

This commit is contained in:
Niklas Jensen
2025-12-26 22:52:06 +01:00
parent da87d12588
commit d1c2e5f447
3 changed files with 13 additions and 3 deletions
+3 -1
View File
@@ -142,8 +142,10 @@ class IMU : public SensorBase<IMUAnglesMsg> {
#ifndef ICM20948_GET_AGMT_UPDATED_ONCE_PER_LOOP
#define ICM20948_GET_AGMT_UPDATED_ONCE_PER_LOOP
if (_imu->dataReady())
{
{
_imu->getAGMT();
} else {
return false;
}
#endif
_msg.rpy[0] = _imu->accX();
+2
View File
@@ -75,6 +75,8 @@ class Magnetometer : public SensorBase<MagnetometerMsg> {
if (_imu->dataReady())
{
_imu->getAGMT();
} else {
return false;
}
#endif
_msg.rpy[0] = _mag->magX();