Fix for sensor rate not updating correctly
Gyro sensor rate is not correct if accel is enabled, change sensor rate,
then enable gyro sensor.
.
Change-Id: I398bba660b34ed404a2ec156ad1f1a02dd6ed522
diff --git a/mlsdk/mllite/ml.c b/mlsdk/mllite/ml.c
index cb995a0..0489f5b 100644
--- a/mlsdk/mllite/ml.c
+++ b/mlsdk/mllite/ml.c
@@ -1775,10 +1775,11 @@
}
}
+ inv_set_fifo_rate(fifoRate);
+
if (!(sensors & INV_DMP_PROCESSOR) && (sensors & INV_THREE_AXIS_ACCEL)) {
struct ext_slave_config config;
long data;
- inv_set_fifo_rate(fifoRate);
config.len = sizeof(long);
config.key = MPU_SLAVE_CONFIG_IRQ_RESUME;
diff --git a/mlsdk/mllite/mlFIFO.c b/mlsdk/mllite/mlFIFO.c
index ce930ea..2c0d2f0 100644
--- a/mlsdk/mllite/mlFIFO.c
+++ b/mlsdk/mllite/mlFIFO.c
@@ -1964,9 +1964,9 @@
if (state != INV_STATE_DMP_OPENED && state != INV_STATE_DMP_STARTED)
return INV_ERROR_SM_IMPROPER_STATE;
- if (mldl_cfg->requested_sensors & INV_DMP_PROCESSOR) {
+ fifo_obj.fifo_rate = fifoRate;
- fifo_obj.fifo_rate = fifoRate;
+ if (mldl_cfg->requested_sensors & INV_DMP_PROCESSOR) {
regs[0] = (unsigned char)((fifoRate >> 8) & 0xff);
regs[1] = (unsigned char)(fifoRate & 0xff);
@@ -2026,12 +2026,7 @@
*/
unsigned short inv_get_fifo_rate(void)
{
- struct mldl_cfg *mldl_cfg = inv_get_dl_config();
- if (mldl_cfg->requested_sensors & INV_DMP_PROCESSOR)
- return fifo_obj.fifo_rate;
- else
- return (unsigned short)((1000 * fifo_obj.sample_step_size_ms) /
- (inv_mpu_get_sampling_period_us(mldl_cfg))) - 1;
+ return fifo_obj.fifo_rate;
}
/**