diff options
author | Ben Fennema <fennema@google.com> | 2017-08-28 11:19:18 -0700 |
---|---|---|
committer | Ben Fennema <fennema@google.com> | 2017-08-28 11:55:51 -0700 |
commit | fb51aff369e963adb7746e11baf4031406bf6890 (patch) | |
tree | e2373ec3a7a1899727aca57a418f16b51d45e7ec | |
parent | c49ff6febb721b79d19bbffa2ae04ce49fe12919 (diff) | |
download | contexthub-fb51aff369e963adb7746e11baf4031406bf6890.tar.gz |
nanohub: check for sensor rate change in rate changed callback
If a sensor rate is lowered and then raised back to the original
rate while the hardware is lowering the rate, the rate will be
left at the lower value. In the rate change callback, call
sensorReconfig to catch this and issue another rate change
command to the driver.
Bug: 64841879
Test: CTS testSensorsWithSeveralClients pass
Change-Id: I4d5269cf25d933b3c4ba23131eff0faf0b70ec72
Signed-off-by: Ben Fennema <fennema@google.com>
-rw-r--r-- | firmware/os/core/sensors.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/firmware/os/core/sensors.c b/firmware/os/core/sensors.c index d96fdc68..307b8970 100644 --- a/firmware/os/core/sensors.c +++ b/firmware/os/core/sensors.c @@ -526,6 +526,7 @@ static void sensorInternalRateChanged(void *evtP) if (s && s->currentRate != SENSOR_RATE_OFF && s->currentRate < SENSOR_RATE_POWERING_ON) { s->currentRate = evt->value1; s->currentLatency = evt->value2; + sensorReconfig(s, sensorCalcHwRate(s, 0, 0), sensorCalcHwLatency(s)); osEnqueueEvtOrFree(sensorGetMyCfgEventType(s->si->sensorType), evt, sensorInternalEvtFreeF); } else { slabAllocatorFree(mInternalEvents, evt); |