From 1f362f4fbe414242d4be9d0347ac1c11822144ef Mon Sep 17 00:00:00 2001 From: Martin Donnelly Date: Wed, 8 Jun 2016 16:45:06 +0100 Subject: [PATCH] =?UTF-8?q?=E2=80=9D2016-06-08=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/device/CC2650/cc2650_accelerometer.js | 68 ++- .../sensortoy/app/js/standards/capability.js | 5 +- .../2.2.1/taskArtifacts/cache.properties.lock | Bin 17 -> 17 bytes .../2.2.1/taskArtifacts/fileHashes.bin | Bin 148764 -> 148764 bytes .../2.2.1/taskArtifacts/fileSnapshots.bin | Bin 10918810 -> 10918810 bytes .../2.2.1/taskArtifacts/taskArtifacts.bin | Bin 61031 -> 61031 bytes .../js/device/CC2650/cc2650_accelerometer.js | 68 ++- .../assets/www/js/standards/capability.js | 5 +- .../js/device/CC2650/cc2650_accelerometer.js | 435 ++++++++++++------ .../ios/www/js/standards/capability.js | 102 ++-- 10 files changed, 459 insertions(+), 224 deletions(-) diff --git a/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js b/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js index a488a2f..8b1cfe8 100644 --- a/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js +++ b/sensortoy/sensortoy/app/js/device/CC2650/cc2650_accelerometer.js @@ -198,22 +198,16 @@ CC2650_ACCEL = function(p) { } } - - console.log('accel max:', max); ceiling = max; - /* 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; var scaleNeg = (124 / 2) / floor; - // Var xstep = (280 - 46) / 100; - var xstep = 2.34; + var xstep = (680 - 46) / 100; + + //Var xstep = 2.34; for (lineMode = 0; lineMode < parts.length; lineMode++) { @@ -259,7 +253,7 @@ CC2650_ACCEL = function(p) { }; - this.generateBlankGraphBase = function(subID) { + this.generateBlankGraphBase = function(subID, settings) { var _subID = subID || ''; var xmlns = 'http://www.w3.org/2000/svg'; @@ -268,16 +262,28 @@ CC2650_ACCEL = function(p) { var text1ID = this.frameID + _subID + '-txt1'; var text2ID = this.frameID + _subID + '-txt2'; + var _width = settings.width || 300; + var _height = settings.height || 150; + var _fill = settings.fill || 'blue'; + var svg = document.createElementNS(xmlns, 'svg'); - svg.setAttributeNS(xmlns, 'id', svgID); - svg.setAttributeNS(xmlns, 'width', '300'); - svg.setAttributeNS(xmlns, 'height', '150'); - svg.setAttributeNS(xmlns, 'fill', 'blue'); + svg.setAttribute('id', svgID); + // Svg.setAttribute(xmlns, 'version', '1.1'); + svg.setAttribute('width', _width.toString()); + svg.setAttribute('height', _height.toString()); + svg.setAttribute('fill', _fill); - svg = this.graphAddXAxis(svg, {y: 12, colour: '#004c6d', id: text1ID}); - svg = this.graphAddXAxis(svg, {y: 136, colour: '#004c6d', id: text2ID}); - svg = this.graphAddXAxis(svg, {y: 71, colour: '#004c6d', text: '0'}); + + svg.setAttributeNS('http://www.w3.org/2000/xmlns/', 'xmlns:xlink', 'http://www.w3.org/1999/xlink'); + + svg.setAttributeNS(xmlns, 'viewBox', '0 0 700 150'); + // Svg.setAttributeNS(xmlns, 'style', 'width:700px;height:150px;'); + + + svg = this.graphAddXAxis(svg, {y: 12, x2: 680, colour: '#004c6d', id: text1ID}); + svg = this.graphAddXAxis(svg, {y: 136, x2: 680, colour: '#004c6d', id: text2ID}); + svg = this.graphAddXAxis(svg, {y: 71, x2: 680, colour: '#004c6d', text: '0'}); return svg; @@ -290,7 +296,7 @@ CC2650_ACCEL = function(p) { var ylineID = this.frameID + _subID + '-y-line'; var zlineID = this.frameID + _subID + '-z-line'; - var svg = this.generateBlankGraphBase(_subID); + var svg = this.generateBlankGraphBase(_subID,{width: '700',height: 150}); svg = this.graphAddLine(svg, xlineID, 'rgba(255,0,0,0.5)'); svg = this.graphAddLine(svg, ylineID, 'rgba(0,255,0,0.5)'); @@ -300,6 +306,12 @@ CC2650_ACCEL = function(p) { }; + this.startCalibrate = function() { + console.log('Start calibrate'); + + alert('Mag Calibration: Wave device in a figure eight until done!'); + }; + this.insertFrame = function(mode) { var frame; @@ -320,10 +332,22 @@ CC2650_ACCEL = function(p) { class: 'mui-panel', id: this.frames[modeID] }); - $('
', {class: 'mui-row'}).append($('
', { - class: 'mui-col-xs-12 mui--text-title mui-ellipsis-2', text: title - })).appendTo(frame); + if (mode === 'mag') { + var elm = $('
', {class: 'mui-row'}); + var button = $('