From b5c483f2e99354c8da9770cd763f0e752bc46614 Mon Sep 17 00:00:00 2001 From: Robert Kaiser Date: Sat, 24 Nov 2012 16:48:39 +0100 Subject: [PATCH] use only the reasonable values, and display roudned values with units --- index.html | 2 -- js/tricorder.js | 16 ++++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index cd2e16c..d2f8d3d 100644 --- a/index.html +++ b/index.html @@ -86,8 +86,6 @@ a better device. X:... Y:... Z:... -Rotation:... -Absolute Orientation:... Alpha:... Beta:... Gamma:... diff --git a/js/tricorder.js b/js/tricorder.js index f82d992..89c6094 100644 --- a/js/tricorder.js +++ b/js/tricorder.js @@ -110,16 +110,16 @@ var gModGrav = { document.getElementById("gravavail").style.display = "none"; }, orientEvent: function(orientData) { - document.getElementById("gravAbs").textContent = orientData.absolute; - document.getElementById("gravAlpha").textContent = orientData.alpha; - document.getElementById("gravBeta").textContent = orientData.beta; - document.getElementById("gravGamma").textContent = orientData.gamma; + //document.getElementById("gravAbs").textContent = orientData.absolute; + document.getElementById("gravAlpha").textContent = orientData.alpha.toFixed(1) + "°"; + document.getElementById("gravBeta").textContent = orientData.beta.toFixed(1) + "°"; + document.getElementById("gravGamma").textContent = orientData.gamma.toFixed(1) + "°"; }, motionEvent: function(event) { - document.getElementById("gravX").textContent = event.accelerationIncludingGravity.x; - document.getElementById("gravY").textContent = event.accelerationIncludingGravity.y; - document.getElementById("gravZ").textContent = event.accelerationIncludingGravity.z; - document.getElementById("gravRot").textContent = event.rotationRate; + document.getElementById("gravX").textContent = event.accelerationIncludingGravity.x.toFixed(2) + " m/s²"; + document.getElementById("gravY").textContent = event.accelerationIncludingGravity.y.toFixed(2) + " m/s²"; + document.getElementById("gravZ").textContent = event.accelerationIncludingGravity.z.toFixed(2) + " m/s²"; + //document.getElementById("gravRot").textContent = event.rotationRate; }, } -- 2.43.0