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 32966a3430
commit 90f561a62b
2 changed files with 5 additions and 1 deletions
+2
View File
@@ -88,6 +88,8 @@ class IMU : public SensorBase<IMUAnglesMsg> {
if (_imu->dataReady()) if (_imu->dataReady())
{ {
_imu->getAGMT(); _imu->getAGMT();
} else {
return false;
} }
#endif #endif
_msg.rpy[0] = _imu->accX(); _msg.rpy[0] = _imu->accX();
+2
View File
@@ -48,6 +48,8 @@ class Magnetometer : public SensorBase<MagnetometerMsg> {
if (_imu->dataReady()) if (_imu->dataReady())
{ {
_imu->getAGMT(); _imu->getAGMT();
} else {
return false;
} }
#endif #endif
_msg.rpy[0] = _mag->magX(); _msg.rpy[0] = _mag->magX();