diff options
| author | 2023-07-21 20:52:40 +0000 | |
|---|---|---|
| committer | 2023-07-21 20:52:40 +0000 | |
| commit | dc176d9931b37be327c1091744e4cb6b51b50245 (patch) | |
| tree | 870a52abb18412e35a774be8e213d9880dddb2b4 | |
| parent | 2ef69194b2bd6c9cca45b2e1a60fdc3df05dbe85 (diff) | |
| parent | d0e68d20a6ae8aa91e2aef40cec57e148eb896c1 (diff) | |
Merge "Make maximum sensor fusion rate tunable." into main
| -rw-r--r-- | services/sensorservice/SensorFusion.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/services/sensorservice/SensorFusion.cpp b/services/sensorservice/SensorFusion.cpp index e27b52b23e..5c00260008 100644 --- a/services/sensorservice/SensorFusion.cpp +++ b/services/sensorservice/SensorFusion.cpp @@ -19,6 +19,7 @@ #include "SensorService.h" #include <android/util/ProtoOutputStream.h> +#include <cutils/properties.h> #include <frameworks/base/core/proto/android/service/sensor_service.proto.h> namespace android { @@ -60,10 +61,12 @@ SensorFusion::SensorFusion() mGyro = uncalibratedGyro; } - // 200 Hz for gyro events is a good compromise between precision - // and power/cpu usage. - mEstimatedGyroRate = 200; - mTargetDelayNs = 1000000000LL/mEstimatedGyroRate; + // Wearable devices will want to tune this parameter + // to 100 (Hz) in device.mk to save some power. + int32_t value = property_get_int32( + "sensors.aosp_low_power_sensor_fusion.maximum_rate", 200); + mEstimatedGyroRate = static_cast<float>(value); + mTargetDelayNs = 1000000000LL / mEstimatedGyroRate; for (int i = 0; i<NUM_FUSION_MODE; ++i) { mFusions[i].init(i); |