mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-03-13 08:20:00 +00:00
”2016-06-24”
This commit is contained in:
parent
b46316b914
commit
82309125b2
@ -115,7 +115,7 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
this.startService = function() {
|
||||
|
||||
this.maxLength = 255;
|
||||
this.maxLength = 500;
|
||||
if (this.deviceID !== null) {
|
||||
|
||||
console.log('Starting CC2650 Accelerometer Service on ', this.deviceID);
|
||||
@ -170,6 +170,10 @@ CC2650_ACCEL = function(p) {
|
||||
var text1ID;
|
||||
var lineID;
|
||||
var max;
|
||||
var yscale = 125;
|
||||
var height = 125;
|
||||
|
||||
var yOffset = 71;
|
||||
|
||||
var reducer = function(p, v) {
|
||||
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
|
||||
@ -179,6 +183,13 @@ CC2650_ACCEL = function(p) {
|
||||
var parts = ['x', 'y', 'z'];
|
||||
var _newData = {x: [],y: [],z: []};
|
||||
|
||||
if (subID === 'gyro') {
|
||||
height = 300;
|
||||
yscale = 300;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_data = data || this.data;
|
||||
|
||||
_subID = subID || '';
|
||||
@ -224,10 +235,16 @@ CC2650_ACCEL = function(p) {
|
||||
ceilingLimit = ceiling;
|
||||
console.log('ceiling:',ceiling);
|
||||
|
||||
scalePos = (124 / 2) / ceiling;
|
||||
|
||||
|
||||
scalePos = (yscale / 2) / ceiling;
|
||||
|
||||
xstep = (680 - 46) / this.maxLength;
|
||||
|
||||
yOffset = ((height - (14 + 12)) / 2) + 12;
|
||||
|
||||
|
||||
|
||||
//Var xstep = 2.34;
|
||||
|
||||
for (lineMode = 0; lineMode < parts.length; lineMode++) {
|
||||
@ -240,7 +257,7 @@ CC2650_ACCEL = function(p) {
|
||||
lineID = this.frameID + _subID + '-' + lm + '-line';
|
||||
for (var x = 0; x < _newData[lm].length; x++) {
|
||||
|
||||
calcArray.push((startX + (x * xstep)).toFixed(2) + ',' + (71 - ((_newData[lm][x]) * scalePos)).toFixed(
|
||||
calcArray.push((startX + (x * xstep)).toFixed(2) + ',' + (yOffset - ((_newData[lm][x]) * scalePos)).toFixed(
|
||||
2));
|
||||
|
||||
}
|
||||
@ -279,6 +296,10 @@ CC2650_ACCEL = function(p) {
|
||||
var text1ID;
|
||||
var lineID;
|
||||
var max;
|
||||
var yscale = 125;
|
||||
var height = 125;
|
||||
|
||||
var yOffset = 71;
|
||||
|
||||
var reducer = function(p, v) {
|
||||
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
|
||||
@ -295,6 +316,12 @@ CC2650_ACCEL = function(p) {
|
||||
text1ID = [this.frameID, _subID, '-txt1'].join('');
|
||||
text2ID = [this.frameID, _subID, '-txt2'].join('');
|
||||
|
||||
if (mode === 'gyro') {
|
||||
height = 300;
|
||||
yscale = 300;
|
||||
}
|
||||
|
||||
|
||||
if (_data.x.length > 0) {
|
||||
|
||||
max = 2;
|
||||
@ -319,10 +346,11 @@ CC2650_ACCEL = function(p) {
|
||||
floor = ceiling * -1;
|
||||
ceilingLimit = ceiling;
|
||||
|
||||
scalePos = (124 / 2) / ceiling;
|
||||
scalePos = (yscale / 2) / ceiling;
|
||||
|
||||
xstep = (680 - 46) / this.maxLength;
|
||||
|
||||
yOffset = ((height - (14 + 12)) / 2) + 12;
|
||||
//Var xstep = 2.34;
|
||||
|
||||
for (lineMode = 0; lineMode < parts.length; lineMode++) {
|
||||
@ -382,6 +410,8 @@ CC2650_ACCEL = function(p) {
|
||||
var _height = settings.height || 150;
|
||||
var _fill = settings.fill || 'blue';
|
||||
|
||||
var viewbox = [0,0,_width, _height].join(' ');
|
||||
|
||||
var svg = document.createElementNS(xmlns, 'svg');
|
||||
|
||||
svg.setAttribute('id', svgID);
|
||||
@ -393,26 +423,27 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
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, 'viewBox', viewbox);
|
||||
// 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'});
|
||||
svg = this.graphAddXAxis(svg, {y: _height - 14, x2: 680, colour: '#004c6d', id: text2ID});
|
||||
svg = this.graphAddXAxis(svg, {y: ((_height - (14 + 12)) / 2) + 12, x2: 680, colour: '#004c6d', text: '0'});
|
||||
|
||||
return svg;
|
||||
|
||||
};
|
||||
|
||||
this.generateBlankGraph = function(subID) {
|
||||
this.generateBlankGraph = function(subID, height) {
|
||||
|
||||
var _height = height || 150;
|
||||
var _subID = subID || '';
|
||||
var xlineID = this.frameID + _subID + '-x-line';
|
||||
var ylineID = this.frameID + _subID + '-y-line';
|
||||
var zlineID = this.frameID + _subID + '-z-line';
|
||||
|
||||
var svg = this.generateBlankGraphBase(_subID,{width: '700',height: 300});
|
||||
var svg = this.generateBlankGraphBase(_subID,{width: '700',height: height});
|
||||
|
||||
svg = this.graphAddLine(svg, xlineID, 'rgba(255,0,99,1)');
|
||||
svg = this.graphAddLine(svg, ylineID, 'rgba(46,255,0,1)');
|
||||
@ -439,8 +470,10 @@ CC2650_ACCEL = function(p) {
|
||||
var frame;
|
||||
var title;
|
||||
var modeID = mode + 'ID';
|
||||
var height = 150;
|
||||
this.frames[modeID] = this.frameID + '-' + mode;
|
||||
|
||||
|
||||
var titles = {
|
||||
gyro: 'Gyroscope', accel: 'Accelerometer', mag: 'Magnetometer'
|
||||
};
|
||||
@ -453,7 +486,12 @@ CC2650_ACCEL = function(p) {
|
||||
class: 'mui-panel', id: this.frames[modeID]
|
||||
});
|
||||
|
||||
if (mode === 'gyro') {
|
||||
height = 300;
|
||||
}
|
||||
|
||||
if (mode === 'mag') {
|
||||
|
||||
elm = $('<div />', {class: 'mui-row'});
|
||||
button = $('<button />', {
|
||||
class: 'mui-btn mui-btn--raised',
|
||||
@ -519,7 +557,7 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
_graph = this.generateBlankGraph(mode);
|
||||
_graph = this.generateBlankGraph(mode, height);
|
||||
row.append($('<div>', {class: 'mui-col-sm-12'}).append(_graph));
|
||||
|
||||
this.$id[modeID].append(row);
|
||||
|
@ -12,7 +12,7 @@
|
||||
<path id="<%= data.baseID + 'temp-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
|
||||
</g>
|
||||
<g transform="translate(150,30)">
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<path id="<%= data.baseID + 'pressure-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
|
||||
</g>
|
||||
<g transform="translate(150,30)">
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'pressure-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50'>--</text>
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'pressure-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='40'>--</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
<path id="<%= data.baseID + 'temp-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
|
||||
</g>
|
||||
<g transform="translate(150,30)">
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--</text>
|
||||
</g>
|
||||
</svg>
|
||||
</div>
|
||||
@ -25,7 +25,7 @@
|
||||
<path id="<%= data.baseID + 'humidity-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
|
||||
</g>
|
||||
<g transform="translate(150,30)">
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'humidity-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'humidity-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='40' >--</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -115,7 +115,7 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
this.startService = function() {
|
||||
|
||||
this.maxLength = 255;
|
||||
this.maxLength = 500;
|
||||
if (this.deviceID !== null) {
|
||||
|
||||
console.log('Starting CC2650 Accelerometer Service on ', this.deviceID);
|
||||
@ -170,6 +170,10 @@ CC2650_ACCEL = function(p) {
|
||||
var text1ID;
|
||||
var lineID;
|
||||
var max;
|
||||
var yscale = 125;
|
||||
var height = 125;
|
||||
|
||||
var yOffset = 71;
|
||||
|
||||
var reducer = function(p, v) {
|
||||
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
|
||||
@ -179,6 +183,13 @@ CC2650_ACCEL = function(p) {
|
||||
var parts = ['x', 'y', 'z'];
|
||||
var _newData = {x: [],y: [],z: []};
|
||||
|
||||
if (subID === 'gyro') {
|
||||
height = 300;
|
||||
yscale = 300;
|
||||
}
|
||||
|
||||
|
||||
|
||||
_data = data || this.data;
|
||||
|
||||
_subID = subID || '';
|
||||
@ -214,20 +225,26 @@ CC2650_ACCEL = function(p) {
|
||||
}
|
||||
|
||||
if (ceiling > 500) {
|
||||
max = (ceiling > max) ? (Math.ceil((Math.round(ceiling) + 1) / 50) * 50) : max;
|
||||
} else {
|
||||
max = (ceiling > max) ? (Math.ceil((Math.round(ceiling) + 1) / 10) * 10) : max;
|
||||
}
|
||||
max = (ceiling > max) ? (Math.ceil((Math.round(ceiling) + 1) / 50) * 50) : max;
|
||||
} else {
|
||||
max = (ceiling > max) ? (Math.ceil((Math.round(ceiling) + 1) / 10) * 10) : max;
|
||||
}
|
||||
ceiling = max;
|
||||
|
||||
floor = ceiling * -1;
|
||||
ceilingLimit = ceiling;
|
||||
console.log('ceiling:',ceiling);
|
||||
|
||||
scalePos = (124 / 2) / ceiling;
|
||||
|
||||
|
||||
scalePos = (yscale / 2) / ceiling;
|
||||
|
||||
xstep = (680 - 46) / this.maxLength;
|
||||
|
||||
yOffset = ((height - (14 + 12)) / 2) + 12;
|
||||
|
||||
|
||||
|
||||
//Var xstep = 2.34;
|
||||
|
||||
for (lineMode = 0; lineMode < parts.length; lineMode++) {
|
||||
@ -240,7 +257,7 @@ CC2650_ACCEL = function(p) {
|
||||
lineID = this.frameID + _subID + '-' + lm + '-line';
|
||||
for (var x = 0; x < _newData[lm].length; x++) {
|
||||
|
||||
calcArray.push((startX + (x * xstep)).toFixed(2) + ',' + (71 - ((_newData[lm][x]) * scalePos)).toFixed(
|
||||
calcArray.push((startX + (x * xstep)).toFixed(2) + ',' + (yOffset - ((_newData[lm][x]) * scalePos)).toFixed(
|
||||
2));
|
||||
|
||||
}
|
||||
@ -279,6 +296,10 @@ CC2650_ACCEL = function(p) {
|
||||
var text1ID;
|
||||
var lineID;
|
||||
var max;
|
||||
var yscale = 125;
|
||||
var height = 125;
|
||||
|
||||
var yOffset = 71;
|
||||
|
||||
var reducer = function(p, v) {
|
||||
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
|
||||
@ -295,6 +316,12 @@ CC2650_ACCEL = function(p) {
|
||||
text1ID = [this.frameID, _subID, '-txt1'].join('');
|
||||
text2ID = [this.frameID, _subID, '-txt2'].join('');
|
||||
|
||||
if (mode === 'gyro') {
|
||||
height = 300;
|
||||
yscale = 300;
|
||||
}
|
||||
|
||||
|
||||
if (_data.x.length > 0) {
|
||||
|
||||
max = 2;
|
||||
@ -319,10 +346,11 @@ CC2650_ACCEL = function(p) {
|
||||
floor = ceiling * -1;
|
||||
ceilingLimit = ceiling;
|
||||
|
||||
scalePos = (124 / 2) / ceiling;
|
||||
scalePos = (yscale / 2) / ceiling;
|
||||
|
||||
xstep = (680 - 46) / this.maxLength;
|
||||
|
||||
yOffset = ((height - (14 + 12)) / 2) + 12;
|
||||
//Var xstep = 2.34;
|
||||
|
||||
for (lineMode = 0; lineMode < parts.length; lineMode++) {
|
||||
@ -382,6 +410,8 @@ CC2650_ACCEL = function(p) {
|
||||
var _height = settings.height || 150;
|
||||
var _fill = settings.fill || 'blue';
|
||||
|
||||
var viewbox = [0,0,_width, _height].join(' ');
|
||||
|
||||
var svg = document.createElementNS(xmlns, 'svg');
|
||||
|
||||
svg.setAttribute('id', svgID);
|
||||
@ -393,26 +423,27 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
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, 'viewBox', viewbox);
|
||||
// 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'});
|
||||
svg = this.graphAddXAxis(svg, {y: _height - 14, x2: 680, colour: '#004c6d', id: text2ID});
|
||||
svg = this.graphAddXAxis(svg, {y: ((_height - (14 + 12)) / 2) + 12, x2: 680, colour: '#004c6d', text: '0'});
|
||||
|
||||
return svg;
|
||||
|
||||
};
|
||||
|
||||
this.generateBlankGraph = function(subID) {
|
||||
this.generateBlankGraph = function(subID, height) {
|
||||
|
||||
var _height = height || 150;
|
||||
var _subID = subID || '';
|
||||
var xlineID = this.frameID + _subID + '-x-line';
|
||||
var ylineID = this.frameID + _subID + '-y-line';
|
||||
var zlineID = this.frameID + _subID + '-z-line';
|
||||
|
||||
var svg = this.generateBlankGraphBase(_subID,{width: '700',height: 150});
|
||||
var svg = this.generateBlankGraphBase(_subID,{width: '700',height: height});
|
||||
|
||||
svg = this.graphAddLine(svg, xlineID, 'rgba(255,0,99,1)');
|
||||
svg = this.graphAddLine(svg, ylineID, 'rgba(46,255,0,1)');
|
||||
@ -422,6 +453,8 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
this.startCalibrate = function() {
|
||||
console.log('Start calibrate');
|
||||
|
||||
@ -437,8 +470,10 @@ CC2650_ACCEL = function(p) {
|
||||
var frame;
|
||||
var title;
|
||||
var modeID = mode + 'ID';
|
||||
var height = 150;
|
||||
this.frames[modeID] = this.frameID + '-' + mode;
|
||||
|
||||
|
||||
var titles = {
|
||||
gyro: 'Gyroscope', accel: 'Accelerometer', mag: 'Magnetometer'
|
||||
};
|
||||
@ -451,7 +486,12 @@ CC2650_ACCEL = function(p) {
|
||||
class: 'mui-panel', id: this.frames[modeID]
|
||||
});
|
||||
|
||||
if (mode === 'gyro') {
|
||||
height = 300;
|
||||
}
|
||||
|
||||
if (mode === 'mag') {
|
||||
|
||||
elm = $('<div />', {class: 'mui-row'});
|
||||
button = $('<button />', {
|
||||
class: 'mui-btn mui-btn--raised',
|
||||
@ -517,7 +557,7 @@ CC2650_ACCEL = function(p) {
|
||||
|
||||
row = $('<div />', {class: 'mui-row'});
|
||||
|
||||
_graph = this.generateBlankGraph(mode);
|
||||
_graph = this.generateBlankGraph(mode, height);
|
||||
row.append($('<div>', {class: 'mui-col-sm-12'}).append(_graph));
|
||||
|
||||
this.$id[modeID].append(row);
|
||||
|
@ -12,7 +12,7 @@
|
||||
<path id="<%= data.baseID + 'temp-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
|
||||
</g>
|
||||
<g transform="translate(150,30)">
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
@ -26,7 +26,7 @@
|
||||
<path id="<%= data.baseID + 'pressure-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
|
||||
</g>
|
||||
<g transform="translate(150,30)">
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'pressure-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50'>--</text>
|
||||
<text text-anchor="middle" id="<%= data.baseID + 'pressure-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='40'>--</text>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
<div class="mui-row">
|
||||
<div class="mui-col-md-6 mui--text-center" id="<%= data.baseID + '-t-pane' %>">
|
||||
|
||||
<svg width='300' height='200' viewbox='0 0 300 220' background="#212121" id="<%= data.baseID + 'temp-svg' %>" style="border:1px solid red;">
|
||||
<svg width='300' height='200' viewbox='0 0 300 220' background="#212121" id="<%= data.baseID + 'temp-svg' %>" >
|
||||
|
||||
<g transform="translate(-90,40) rotate(-120 180 90)" >
|
||||
<path id="<%= data.baseID + 'temp-arcB' %>" fill="none" stroke="rgb(61, 61, 61)" stroke-width="12" />
|
||||
|
Loading…
Reference in New Issue
Block a user