diff options
author | Xavier Ducrohet <xav@android.com> | 2011-02-15 09:25:20 -0800 |
---|---|---|
committer | Android Code Review <code-review@android.com> | 2011-02-15 09:25:20 -0800 |
commit | bdedc85ca0c7ae3dcb9771595d196e6f533f4492 (patch) | |
tree | dff7673aaa8256c322c777ea36d07726683fdfd5 /android/hw-sensors.c | |
parent | 752e385393d3d2239bb8cf9c8caf3cdd6b5e7a68 (diff) | |
parent | 593d0ea0d2c851f099c5e7d16cbebc992b0bf152 (diff) | |
download | external_qemu-bdedc85ca0c7ae3dcb9771595d196e6f533f4492.zip external_qemu-bdedc85ca0c7ae3dcb9771595d196e6f533f4492.tar.gz external_qemu-bdedc85ca0c7ae3dcb9771595d196e6f533f4492.tar.bz2 |
Merge "hw-sensors.c: Reduce default delay between sensor updates."
Diffstat (limited to 'android/hw-sensors.c')
-rw-r--r-- | android/hw-sensors.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/android/hw-sensors.c b/android/hw-sensors.c index d9f3a6f..e191f68 100644 --- a/android/hw-sensors.c +++ b/android/hw-sensors.c @@ -10,6 +10,7 @@ ** GNU General Public License for more details. */ +#include <math.h> #include "android/hw-sensors.h" #include "android/utils/debug.h" #include "android/utils/misc.h" @@ -210,7 +211,7 @@ _hwSensorClient_new( HwSensors* sensors ) cl->sensors = sensors; cl->enabledMask = 0; - cl->delay_ms = 1000; + cl->delay_ms = 800; cl->timer = qemu_new_timer(vm_clock, _hwSensorClient_tick, cl); cl->next = sensors->clients; @@ -625,16 +626,17 @@ _hwSensors_setCoarseOrientation( HwSensors* h, AndroidCoarseOrientation orient * If the phone is completely vertical, rotating it will not do anything ! */ const double g = 9.81; - const double cos_30 = 0.866025403784; - const double sin_30 = 0.5; + const double angle = 20.0; + const double cos_angle = cos(angle/M_PI); + const double sin_angle = sin(angle/M_PI); switch (orient) { case ANDROID_COARSE_PORTRAIT: - _hwSensors_setAcceleration( h, 0., g*cos_30, g*sin_30 ); + _hwSensors_setAcceleration( h, 0., g*cos_angle, g*sin_angle ); break; case ANDROID_COARSE_LANDSCAPE: - _hwSensors_setAcceleration( h, g*cos_30, 0., g*sin_30 ); + _hwSensors_setAcceleration( h, g*cos_angle, 0., g*sin_angle ); break; default: ; |