Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 6F2DE983B for ; Fri, 16 Mar 2012 18:14:50 +0000 (UTC) Received: (qmail 32317 invoked by uid 500); 16 Mar 2012 18:14:50 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 32244 invoked by uid 500); 16 Mar 2012 18:14:50 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 31874 invoked by uid 99); 16 Mar 2012 18:14:49 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Mar 2012 18:14:49 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 213A77681; Fri, 16 Mar 2012 18:14:49 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: filmaj@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [8/29] ios commit: added unification of accelerometer values on ios (based on android values) Message-Id: <20120316181449.213A77681@tyr.zones.apache.org> Date: Fri, 16 Mar 2012 18:14:49 +0000 (UTC) added unification of accelerometer values on ios (based on android values) Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/commit/f471cadd Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/tree/f471cadd Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/diff/f471cadd Branch: refs/heads/master Commit: f471cadd6ec3bc6551811903d082ce2fe7c810d2 Parents: f78192e Author: Fil Maj Authored: Thu Mar 15 17:32:43 2012 -0700 Committer: Fil Maj Committed: Fri Mar 16 10:56:50 2012 -0700 ---------------------------------------------------------------------- CordovaLib/Classes/CDVAccelerometer.m | 8 +++++--- 1 files changed, 5 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-ios/blob/f471cadd/CordovaLib/Classes/CDVAccelerometer.m ---------------------------------------------------------------------- diff --git a/CordovaLib/Classes/CDVAccelerometer.m b/CordovaLib/Classes/CDVAccelerometer.m index 9083c7f..611e28d 100644 --- a/CordovaLib/Classes/CDVAccelerometer.m +++ b/CordovaLib/Classes/CDVAccelerometer.m @@ -28,6 +28,8 @@ #define kMinAccelerometerInterval 40 // min rate of 1/sec #define kMaxAccelerometerInterval 1000 +// g constant: -9.81 m/s^2 +#define kGravitionalConstant -9.81 - (CDVAccelerometer*) init { @@ -88,9 +90,9 @@ // Create an acceleration object NSMutableDictionary *accelProps = [NSMutableDictionary dictionaryWithCapacity:4]; - [accelProps setValue:[NSNumber numberWithDouble:x] forKey:@"x"]; - [accelProps setValue:[NSNumber numberWithDouble:y] forKey:@"y"]; - [accelProps setValue:[NSNumber numberWithDouble:z] forKey:@"z"]; + [accelProps setValue:[NSNumber numberWithDouble:x*kGravitionalConstant] forKey:@"x"]; + [accelProps setValue:[NSNumber numberWithDouble:y*kGravitionalConstant] forKey:@"y"]; + [accelProps setValue:[NSNumber numberWithDouble:z*kGravitionalConstant] forKey:@"z"]; [accelProps setValue:[NSNumber numberWithDouble:timestamp] forKey:@"timestamp"]; result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:accelProps];