diff --git a/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js b/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js index 1c596dc..a488a2f 100644 --- a/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js +++ b/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js @@ -68,23 +68,34 @@ CC2650_ACCEL = function(p) { var message; var calcData; + function gString(v) { + return [v.toFixed(3),'G'].join(''); + } + + function aString(v) { + return [v.toFixed(3),'\'/s'].join(''); + } + + function mString(v) { + return [v.toFixed(3),'mT'].join(''); + } calcData = this.processData(data); message = 'Gyro
' + 'X: ' + calcData.gyro.x + '
' + 'Y: ' + calcData.gyro.y + '
' + 'Z: ' + calcData.gyro.z + '
' + 'Accel
' + 'X: ' + calcData.accel.x + '
' + 'Y: ' + calcData.accel.y + '
' + 'Z: ' + calcData.accel.z + '
' + 'Mag
' + 'X: ' + calcData.mag.x + '
' + 'Y: ' + calcData.mag.y + '
' + 'Z: ' + calcData.mag.z + '
'; this.state = message; - this.$result[this.frames.gyroID + '-x'].text(calcData.gyro.x.toFixed(5)); - this.$result[this.frames.gyroID + '-y'].text(calcData.gyro.y.toFixed(5)); - this.$result[this.frames.gyroID + '-z'].text(calcData.gyro.z.toFixed(5)); + this.$result[this.frames.gyroID + '-x'].text(gString(calcData.gyro.x)); + this.$result[this.frames.gyroID + '-y'].text(gString(calcData.gyro.y)); + this.$result[this.frames.gyroID + '-z'].text(gString(calcData.gyro.z)); - this.$result[this.frames.accelID + '-x'].text(calcData.accel.x.toFixed(5)); - this.$result[this.frames.accelID + '-y'].text(calcData.accel.y.toFixed(5)); - this.$result[this.frames.accelID + '-z'].text(calcData.accel.z.toFixed(5)); + this.$result[this.frames.accelID + '-x'].text(aString(calcData.accel.x)); + this.$result[this.frames.accelID + '-y'].text(aString(calcData.accel.y)); + this.$result[this.frames.accelID + '-z'].text(aString(calcData.accel.z)); - this.$result[this.frames.magID + '-x'].text(calcData.mag.x); - this.$result[this.frames.magID + '-y'].text(calcData.mag.y); - this.$result[this.frames.magID + '-z'].text(calcData.mag.z); + this.$result[this.frames.magID + '-x'].text(mString(calcData.mag.x)); + this.$result[this.frames.magID + '-y'].text(mString(calcData.mag.y)); + this.$result[this.frames.magID + '-z'].text(mString(calcData.mag.z)); this.data.gyro.x = this.storeData(calcData.gyro.x, this.data.gyro.x); this.data.gyro.y = this.storeData(calcData.gyro.y, this.data.gyro.y); @@ -158,6 +169,7 @@ CC2650_ACCEL = function(p) { var lineID; var max; + var parts = ['x', 'y', 'z']; _data = data || this.data; @@ -186,9 +198,16 @@ CC2650_ACCEL = function(p) { } } - console.log('accel max:', max) + + console.log('accel max:', max); ceiling = max; - floor = max * -1; + + /* if (ceiling < this.previousCeil) { + ceiling = ceiling + ((this.previousCeil - ceiling) / 2); + ceiling = (Math.ceil((Math.round(ceiling) + 1) / 10)); + }*/ + + floor = ceiling * -1; ceilingLimit = ceiling; var scalePos = (124 / 2) / ceiling; @@ -225,6 +244,7 @@ CC2650_ACCEL = function(p) { } + this.previousCeil = ceiling; }; this.animateGraph = function() { diff --git a/sensortoy/sensortoy/app/js/standards/capability.js b/sensortoy/sensortoy/app/js/standards/capability.js index f636fe7..deb83a7 100644 --- a/sensortoy/sensortoy/app/js/standards/capability.js +++ b/sensortoy/sensortoy/app/js/standards/capability.js @@ -45,6 +45,9 @@ var CAPABILITY = function(p) { this.target = null; this.$frame = null; + + this.previousCeil = 0; + capabilityManager.register({id: this.capabilityID, module: this}); }; diff --git a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock index 075c00c..6f33c71 100644 Binary files a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock and b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/cache.properties.lock differ diff --git a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin index e1add62..146d3d6 100644 Binary files a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin and b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileHashes.bin differ diff --git a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin index 5e3cd04..23fe41c 100644 Binary files a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin and b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/fileSnapshots.bin differ diff --git a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin index bdeb7e9..5eb306e 100644 Binary files a/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin and b/sensortoy/sensortoy/platforms/android/.gradle/2.2.1/taskArtifacts/taskArtifacts.bin differ diff --git a/sensortoy/sensortoy/platforms/android/assets/www/js/device/CC2650/cc2650_accelerometer.js b/sensortoy/sensortoy/platforms/android/assets/www/js/device/CC2650/cc2650_accelerometer.js index 1c596dc..a488a2f 100644 --- a/sensortoy/sensortoy/platforms/android/assets/www/js/device/CC2650/cc2650_accelerometer.js +++ b/sensortoy/sensortoy/platforms/android/assets/www/js/device/CC2650/cc2650_accelerometer.js @@ -68,23 +68,34 @@ CC2650_ACCEL = function(p) { var message; var calcData; + function gString(v) { + return [v.toFixed(3),'G'].join(''); + } + + function aString(v) { + return [v.toFixed(3),'\'/s'].join(''); + } + + function mString(v) { + return [v.toFixed(3),'mT'].join(''); + } calcData = this.processData(data); message = 'Gyro
' + 'X: ' + calcData.gyro.x + '
' + 'Y: ' + calcData.gyro.y + '
' + 'Z: ' + calcData.gyro.z + '
' + 'Accel
' + 'X: ' + calcData.accel.x + '
' + 'Y: ' + calcData.accel.y + '
' + 'Z: ' + calcData.accel.z + '
' + 'Mag
' + 'X: ' + calcData.mag.x + '
' + 'Y: ' + calcData.mag.y + '
' + 'Z: ' + calcData.mag.z + '
'; this.state = message; - this.$result[this.frames.gyroID + '-x'].text(calcData.gyro.x.toFixed(5)); - this.$result[this.frames.gyroID + '-y'].text(calcData.gyro.y.toFixed(5)); - this.$result[this.frames.gyroID + '-z'].text(calcData.gyro.z.toFixed(5)); + this.$result[this.frames.gyroID + '-x'].text(gString(calcData.gyro.x)); + this.$result[this.frames.gyroID + '-y'].text(gString(calcData.gyro.y)); + this.$result[this.frames.gyroID + '-z'].text(gString(calcData.gyro.z)); - this.$result[this.frames.accelID + '-x'].text(calcData.accel.x.toFixed(5)); - this.$result[this.frames.accelID + '-y'].text(calcData.accel.y.toFixed(5)); - this.$result[this.frames.accelID + '-z'].text(calcData.accel.z.toFixed(5)); + this.$result[this.frames.accelID + '-x'].text(aString(calcData.accel.x)); + this.$result[this.frames.accelID + '-y'].text(aString(calcData.accel.y)); + this.$result[this.frames.accelID + '-z'].text(aString(calcData.accel.z)); - this.$result[this.frames.magID + '-x'].text(calcData.mag.x); - this.$result[this.frames.magID + '-y'].text(calcData.mag.y); - this.$result[this.frames.magID + '-z'].text(calcData.mag.z); + this.$result[this.frames.magID + '-x'].text(mString(calcData.mag.x)); + this.$result[this.frames.magID + '-y'].text(mString(calcData.mag.y)); + this.$result[this.frames.magID + '-z'].text(mString(calcData.mag.z)); this.data.gyro.x = this.storeData(calcData.gyro.x, this.data.gyro.x); this.data.gyro.y = this.storeData(calcData.gyro.y, this.data.gyro.y); @@ -158,6 +169,7 @@ CC2650_ACCEL = function(p) { var lineID; var max; + var parts = ['x', 'y', 'z']; _data = data || this.data; @@ -186,9 +198,16 @@ CC2650_ACCEL = function(p) { } } - console.log('accel max:', max) + + console.log('accel max:', max); ceiling = max; - floor = max * -1; + + /* if (ceiling < this.previousCeil) { + ceiling = ceiling + ((this.previousCeil - ceiling) / 2); + ceiling = (Math.ceil((Math.round(ceiling) + 1) / 10)); + }*/ + + floor = ceiling * -1; ceilingLimit = ceiling; var scalePos = (124 / 2) / ceiling; @@ -225,6 +244,7 @@ CC2650_ACCEL = function(p) { } + this.previousCeil = ceiling; }; this.animateGraph = function() { diff --git a/sensortoy/sensortoy/platforms/android/assets/www/js/standards/capability.js b/sensortoy/sensortoy/platforms/android/assets/www/js/standards/capability.js index f636fe7..deb83a7 100644 --- a/sensortoy/sensortoy/platforms/android/assets/www/js/standards/capability.js +++ b/sensortoy/sensortoy/platforms/android/assets/www/js/standards/capability.js @@ -45,6 +45,9 @@ var CAPABILITY = function(p) { this.target = null; this.$frame = null; + + this.previousCeil = 0; + capabilityManager.register({id: this.capabilityID, module: this}); };