From e1df3ea6fb4c1af4069e0610a5a7a8634b786e99 Mon Sep 17 00:00:00 2001 From: Nick Vaccaro Date: Tue, 6 May 2014 15:19:21 -0700 Subject: Invensense: 6515: remember pedometer poll rate The enableDmpPedometer call was hard-coding the pedometer poll period to 100mS. Save off the period passed to batch() as the new step count polling period instead of hard-coding it to 100mS. Bug: 14299562 Change-Id: Idc680c0a5d3c8bad7caf0db58336ea60d56a81de --- 6515/libsensors_iio/MPLSensor.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/6515/libsensors_iio/MPLSensor.cpp b/6515/libsensors_iio/MPLSensor.cpp index 5896a22..737fefb 100644 --- a/6515/libsensors_iio/MPLSensor.cpp +++ b/6515/libsensors_iio/MPLSensor.cpp @@ -1776,7 +1776,6 @@ int MPLSensor::enableDmpPedometer(int en, int interruptMode) } else { mFeatureActiveMask |= INV_DMP_PEDOMETER_STEP; - mStepCountPollTime = 100000000LL; } clock_gettime(CLOCK_MONOTONIC, &mt_pre); @@ -5587,6 +5586,12 @@ int MPLSensor::batch(int handle, int flags, int64_t period_ns, int64_t timeout) return 0; } + if (what == StepCounter) { + mStepCountPollTime = period_ns; + LOGI("HAL: set step count poll time = %lld nS (%.2f Hz)", + mStepCountPollTime, 1000000000.f / mStepCountPollTime); + } + int tempBatch = 0; if (timeout > 0) { tempBatch = mBatchEnabled | (1 << what); -- cgit v1.2.3