Added more dials

This commit is contained in:
Martin Donnelly 2016-06-20 17:13:02 +01:00
parent 0d90e0b7f6
commit 7ecf2ec9ef
20 changed files with 440 additions and 243 deletions

View File

@ -370,17 +370,17 @@ CC2650_ACCEL = function(p) {
row = $('<div />', {class: 'mui-row'});
$('<div />', {
class: 'mui-col-xs-4 mui--text-dark mui--text-center',
class: 'mui-col-xs-4 mui--text-light mui--text-center',
text: '--',
id: this.frames[modeID] + '-x'
}).appendTo(row);
$('<div />', {
class: 'mui-col-xs-4 mui--text-dark mui--text-center',
class: 'mui-col-xs-4 mui--text-light mui--text-center',
text: '--',
id: this.frames[modeID] + '-y'
}).appendTo(row);
$('<div />', {
class: 'mui-col-xs-4 mui--text-dark mui--text-center',
class: 'mui-col-xs-4 mui--text-light mui--text-center',
text: '--',
id: this.frames[modeID] + '-z'
}).appendTo(row);

View File

@ -5,7 +5,7 @@
* Time: 10:13
*
*/
/* global CAPABILITY, inheritsFrom, capabilityManager, device */
/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@ -84,73 +84,99 @@ var CC2650_BAR = function(p) {
};
this.animateGraph = function() {
this.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.pressure, 'pressure');
/* This.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.pressure, 'pressure');*/
var arcTemp = this.frameID + 'temp-arc';
var arcPressure = this.frameID + 'pressure-arc';
this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
this.updateArc(this.data.pressure, 'pressure' , arcPressure, 'hPa');
};
this.insertFrame = function() {
var self = this;
var blankChart;
// Call the parent displayForm first...
this.superClass_.insertFrame.call(self);
var temp = this.frameID + '-t';
var pressure = this.frameID + '-p';
var row = $('<div />', {class: 'mui-row'});
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
var arcB = this.frameID + 'temp-arcB';
var arcTemp = this.frameID + 'temp-arc';
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Pressure:'}).appendTo(row);
var pressureArcB = this.frameID + 'pressure-arcB';
var arcPressure = this.frameID + 'pressure-arc';
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: pressure}).appendTo(row);
var settings = {data: {baseID: this.frameID}};
var html = new EJS({url: './partials/cc2650_barometer_dial.ejs'}).render(settings);
this.$id.append(row);
this.$id.append(html);
if (/ipad/i.test(device.model)) {
document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
tabBody = $('<div>', {class: 'mui-row'});
document.getElementById(pressureArcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcPressure).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('temp'))) ;
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('pressure'))) ;
this.$id.append(tabBody);
} else {
/* Var row = $('<div />', {class: 'mui-row'});
var tabBody = $('<ul>',
{class: 'mui-tabs__bar mui-tabs__bar--justified'});
$('<li>', {class: 'mui--is-active tabOnWhite'}).append($('<a>',
{
text: 'Temperature',
'data-mui-toggle': 'tab',
'data-mui-controls': (temp + '-pane')
})).appendTo(tabBody);
$('<li>', {class: 'tabOnWhite'}).append($('<a>',
{
text: 'Pressure',
'data-mui-toggle': 'tab',
'data-mui-controls': (pressure + '-pane')
})).appendTo(tabBody);
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
this.$id.append(tabBody);
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Pressure:'}).appendTo(row);
blankChart = this.generateBlankGraph('temp');
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: pressure}).appendTo(row);
this.$id.append($('<div>',
{class: 'mui-tabs__pane mui--is-active', id: (temp + '-pane')}).append(
blankChart));
this.$id.append(row);
blankChart = this.generateBlankGraph('pressure');
if (/ipad/i.test(device.model)) {
this.$id.append($('<div>',
{
class: 'mui-tabs__pane',
id: (pressure + '-pane')
}).append(blankChart));
}
tabBody = $('<div>', {class: 'mui-row'});
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('temp'))) ;
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('pressure'))) ;
this.$id.append(tabBody);
} else {
var tabBody = $('<ul>',
{class: 'mui-tabs__bar mui-tabs__bar--justified'});
$('<li>', {class: 'mui--is-active tabOnWhite'}).append($('<a>',
{
text: 'Temperature',
'data-mui-toggle': 'tab',
'data-mui-controls': (temp + '-pane')
})).appendTo(tabBody);
$('<li>', {class: 'tabOnWhite'}).append($('<a>',
{
text: 'Pressure',
'data-mui-toggle': 'tab',
'data-mui-controls': (pressure + '-pane')
})).appendTo(tabBody);
this.$id.append(tabBody);
blankChart = this.generateBlankGraph('temp');
this.$id.append($('<div>',
{class: 'mui-tabs__pane mui--is-active', id: (temp + '-pane')}).append(
blankChart));
blankChart = this.generateBlankGraph('pressure');
this.$id.append($('<div>',
{
class: 'mui-tabs__pane',
id: (pressure + '-pane')
}).append(blankChart));
}*/
this.$result.temp = $('#' + temp);
this.$result.pressure = $('#' + pressure);

View File

@ -5,7 +5,7 @@
* Time: 10:13
*
*/
/* global CAPABILITY, inheritsFrom, capabilityManager, device */
/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@ -87,28 +87,55 @@ var CC2650_HUM = function(p) {
};
this.animateGraph = function() {
this.simpleGraph(this.data.temp, 'temp');
/*
This.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.humidity, 'humidity');
};
*/
var arcTemp = this.frameID + 'temp-arc';
var arcHumidity = this.frameID + 'humidity-arc';
this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
this.updateArc(this.data.humidity, 'humidity' , arcHumidity, '%RH', 100);
};
this.insertFrame = function() {
var self = this;
var blankChart;
// Call the parent displayForm first...
this.superClass_.insertFrame.call(self);
var temp = this.frameID + '-t';
var humidity = this.frameID + '-h';
var row = $('<div />', {class: 'mui-row'});
var arcB = this.frameID + 'temp-arcB';
var arcTemp = this.frameID + 'temp-arc';
var humidityArcB = this.frameID + 'humidity-arcB';
var arcHumidity = this.frameID + 'humidity-arc';
var settings = {data: {baseID: this.frameID}};
var html = new EJS({url: './partials/cc2650_humidity_dial.ejs'}).render(settings);
this.$id.append(html);
document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
document.getElementById(humidityArcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcHumidity).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
/*
Var row = $('<div />', {class: 'mui-row'});
$('<div />',
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light', id: temp}).appendTo(row);
$('<div />',
{
class: 'mui-col-xs-3 mui--text-accent mui--text-right',
@ -116,7 +143,7 @@ var CC2650_HUM = function(p) {
}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark', id: humidity}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light', id: humidity}).appendTo(row);
this.$id.append(row);
@ -157,7 +184,7 @@ var CC2650_HUM = function(p) {
class: 'mui-tabs__pane',
id: (humidity + '-pane')
}).append(blankChart));
}
}*/
this.$result.temp = $('#' + temp);
this.$result.humidity = $('#' + humidity);

View File

@ -95,7 +95,7 @@ var CC2650_LUX = function(p) {
row);
$('<div />',
{class: 'mui-col-xs-8 mui--text-dark', id: lux}).appendTo(row);
{class: 'mui-col-xs-8 mui--text-light', id: lux}).appendTo(row);
this.$id.append(row);

View File

@ -5,7 +5,7 @@
* Time: 10:13
*
*/
/* global CAPABILITY, inheritsFrom, capabilityManager */
/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@ -88,53 +88,16 @@ var CC2650_TMP = function(p) {
this.animateGraph = function() {
// This.simpleGraph(this.data.temp, 'temp');
// debugger;
// debugger;
var arcTemp = this.frameID + 'temp-arc';
var arcAmbient = this.frameID + 'ambient-arc';
this.updateArc(this.data.temp, 'temp' , arcTemp);
this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
this.updateArc(this.data.ambient, 'ambient' , arcAmbient, '°C', 50);
this.updateArc(this.data.ambient, 'ambient' , arcAmbient);
//This.simpleGraph(this.data.ambient, 'ambient');
};
this.updateArc = function(data, subID, elmID) {
var ceilingLimit;
var _subID;
var _data;
var label;
_data = data || this.data;
_subID = subID || '';
if (_data.length > 0) {
ceilingLimit = 50;
var latest = _data[_data.length - 1];
var scale = 100 / ceilingLimit;
var arcP = scale * latest;
// Var xstep = (280 - 46) / 100;
label = this.frameID + subID + '-label';
document.getElementById(elmID).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(arcP)));
// document.getElementById(label).innerText(latest.toFixed(2) + 'ºc');
}
};
this.insertFrame = function() {
var liSetting;
var tabBody;
var blankChart;
var self = this;
// Console.log('Overloading...');
// Call the parent displayForm first...
@ -156,7 +119,6 @@ var CC2650_TMP = function(p) {
this.$id.append(html);
debugger;
document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
@ -170,7 +132,7 @@ debugger;
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark mui--text-left', id: temp}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light mui--text-left', id: temp}).appendTo(row);
$('<div />',
{
class: 'mui-col-xs-3 mui--text-accent mui--text-right',
@ -178,7 +140,7 @@ debugger;
}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark', id: amb}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light', id: amb}).appendTo(row);
this.$id.append(row);

View File

@ -271,35 +271,44 @@ CAPABILITY.prototype.setArc = function(percent) {
return (240 / 100) * percent;
};
CAPABILITY.prototype.updateArc = function(data, subID, elmID) {
CAPABILITY.prototype.updateArc = function(data, subID, elmID, suffix, limiter) {
var ceilingLimit;
var ceiling;
var _subID;
var _data;
var _limiter = limiter || null;
var _suffix = suffix || '';
var label;
_data = data || this.data;
_subID = subID || '';
label = '#' + this.frameID + _subID + '-label';
if (_data.length > 0) {
ceiling = _data.reduce(function(p, v) {
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
});
if (_limiter === null) {
ceiling = _data.reduce(function(p, v) {
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
});
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 10) * 10);
if (ceilingLimit > 1000) {
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 50) * 50);
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 10) * 10);
if (ceilingLimit > 1000) {
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 50) * 50);
}
} else {
ceilingLimit = _limiter;
}
var latest = _data[_data.length-1];
var latest = _data[_data.length - 1];
var scale = 100 / ceilingLimit;
var arcP = scale * latest;
// Var xstep = (280 - 46) / 100;
document.getElementById(elmID).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(arcP)));
$(label).text(latest.toFixed(2) + _suffix);
}

View File

@ -0,0 +1,68 @@
<%= data.baseID + 'pressure-line' %>
<div class="mui-row">
<div class="mui-col-xs-3 mui--text-accent mui--text-right">Temp:</div>
<div class="mui-col-xs-3 mui--text-light" id="<%= data.baseID + '-t' %>">--</div>
<div class="mui-col-xs-3 mui--text-accent mui--text-right">Pressure:</div>
<div class="mui-col-xs-3 mui--text-light" id="<%= data.baseID + '-p' %>">--</div>
</div>
<ul class="mui-tabs__bar mui-tabs__bar--justified">
<li class="mui--is-active tabOnWhite"><a data-mui-toggle="tab"
data-mui-controls="<%= data.baseID + '-t-pane' %>">Temperature</a>
</li>
<li class="tabOnWhite"><a data-mui-toggle="tab"
data-mui-controls="<%= data.baseID + '-p-pane' %>">Pressure</a>
</li>
</ul>
<div class="mui-tabs__pane mui--is-active" id="<%= data.baseID + '-t-pane' %>">
<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" />
<path id="<%= data.baseID + 'temp-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
</g>
<g transform="translate(150,100)">
<text id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
</g>
</svg>
<!-- <svg id="<%= data.baseID + 'temp-svg' %>" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'temp-txt1' %>" x="36" y="15" text-anchor="end">&#45;&#45;</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0</text>
<polyline id="<%= data.baseID + 'temp-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>-->
</div>
<div class="mui-tabs__pane" id="<%= data.baseID + '-p-pane' %>">
<svg width='300' height='200' viewbox='0 0 300 220' background="#212121" id="<%= data.baseID + 'pressure-svg' %>">
<g transform="translate(-90,40) rotate(-120 180 90)" >
<path id="<%= data.baseID + 'pressure-arcB' %>" fill="none" stroke="rgb(61, 61, 61)" stroke-width="12" style=""/>
<path id="<%= data.baseID + 'pressure-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
</g>
<g transform="translate(150,100)">
<text id="<%= data.baseID + 'pressure-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50'>--</text>
</g>
</svg>
<!--<svg id="<%= data.baseID + 'pressure-svg' %>" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'pressure-txt1' %>" x="36" y="15" text-anchor="end">&#45;&#45;</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0</text>
<polyline id="<%= data.baseID + 'pressure-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>-->
</div>

View File

@ -0,0 +1,41 @@
<div class="mui-row">
<div class="mui-col-xs-3 mui--text-accent mui--text-right">Temp:</div>
<div class="mui-col-xs-3 mui--text-light" id="<%= data.baseID + '-t' %>">--</div>
<div class="mui-col-xs-3 mui--text-accent mui--text-right">Humidity:</div>
<div class="mui-col-xs-3 mui--text-light" id="<%= data.baseID + '-h' %>">--</div>
</div>
<ul class="mui-tabs__bar mui-tabs__bar--justified">
<li class="tabOnWhite"><a data-mui-toggle="tab"
data-mui-controls="<%= data.baseID + '-t-pane' %>">Temperature</a>
</li>
<li class="tabOnWhite mui--is-active"><a data-mui-toggle="tab"
data-mui-controls="<%= data.baseID + '-h-pane' %>">Humidity</a>
</li>
</ul>
<div class="mui-tabs__pane" id="<%= data.baseID + '-t-pane' %>">
<svg id="<%= data.baseID + 'temp-svg' %>" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'temp-txt1' %>" x="36" y="15" text-anchor="end">--</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0</text>
<polyline id="<%= data.baseID + 'temp-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>
</div>
<div class="mui-tabs__pane mui--is-active" id="<%= data.baseID + '-h-pane' %>">
<svg id="<%= data.baseID + 'humidity-svg' %>" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'humidity-txt1' %>" x="36" y="15" text-anchor="end">--</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0
</text>
<polyline id="<%= data.baseID + 'humidity-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>
</div>

View File

@ -0,0 +1,67 @@
<div class="mui-row">
<div class="mui-col-xs-3 mui--text-accent mui--text-right">Temp:</div>
<div class="mui-col-xs-3 mui--text-light" id="<%= data.baseID + '-t' %>">--</div>
<div class="mui-col-xs-3 mui--text-accent mui--text-right">Humidity:</div>
<div class="mui-col-xs-3 mui--text-light" id="<%= data.baseID + '-h' %>">--</div>
</div>
<ul class="mui-tabs__bar mui-tabs__bar--justified">
<li class="tabOnWhite"><a data-mui-toggle="tab"
data-mui-controls="<%= data.baseID + '-t-pane' %>">Temperature</a>
</li>
<li class="tabOnWhite mui--is-active"><a data-mui-toggle="tab"
data-mui-controls="<%= data.baseID + '-h-pane' %>">Humidity</a>
</li>
</ul>
<div class="mui-tabs__pane" id="<%= data.baseID + '-t-pane' %>">
<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" />
<path id="<%= data.baseID + 'temp-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
</g>
<g transform="translate(150,100)">
<text id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
</g>
</svg>
<!--
<svg id="<%= data.baseID + 'temp-svg' %>" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'temp-txt1' %>" x="36" y="15" text-anchor="end">&#45;&#45;</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0</text>
<polyline id="<%= data.baseID + 'temp-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>
-->
</div>
<div class="mui-tabs__pane mui--is-active" id="<%= data.baseID + '-h-pane' %>">
<svg width='300' height='200' viewbox='0 0 300 220' background="#212121" id="<%= data.baseID + 'humidity-svg' %>">
<g transform="translate(-90,40) rotate(-120 180 90)" >
<path id="<%= data.baseID + 'humidity-arcB' %>" fill="none" stroke="rgb(61, 61, 61)" stroke-width="12" />
<path id="<%= data.baseID + 'humidity-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
</g>
<g transform="translate(150,100)">
<text id="<%= data.baseID + 'humidity-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
</g>
</svg>
<!--<svg id="<%= data.baseID + 'humidity-svg' %>" width="300" height="150" fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'humidity-txt1' %>" x="36" y="15" text-anchor="end">&#45;&#45;</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0
</text>
<polyline id="<%= data.baseID + 'humidity-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>-->
</div>

View File

@ -28,45 +28,16 @@
</filter>
<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" style="filter:url(#dropshadow)"/>
<path id="<%= data.baseID + 'temp-arcB' %>" fill="none" stroke="rgb(61, 61, 61)" stroke-width="12" />
<path id="<%= data.baseID + 'temp-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
</g>
<g transform="translate(150,100)">
<text id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' style="filter:url(#dropshadow)">--ºc</text>
<text id="<%= data.baseID + 'temp-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
</g>
</svg>
<!--<svg id="<%= data.baseID + 'temp-svg' %>" width="300" height="150"
fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'temp-txt1' %>" x="36" y="15"
text-anchor="end">&#45;&#45;
</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0</text>
<polyline id="<%= data.baseID + 'temp-line' %>" fill="none" stroke="#2196F3"
text-anchor="end" stroke-width="2" points=""></polyline>
</svg>-->
</div>
<div class="mui-tabs__pane" id="<%= data.baseID + '-a-pane' %>">
<!--<svg id="<%= data.baseID + 'ambient-svg' %>" width="300" height="150"
fill="blue">
<line x1="46" y1="12" x2="280" y2="12"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="<%= data.baseID + 'ambient-txt1' %>" x="36" y="15"
text-anchor="end">&#45;&#45;
</text>
<line x1="46" y1="136" x2="280" y2="136"
style="stroke:#004c6d;stroke-width:2;"></line>
<text id="undefined" x="36" y="139" text-anchor="end">0</text>
<polyline id="<%= data.baseID + 'ambient-line' %>" fill="none"
stroke="#2196F3" text-anchor="end" stroke-width="2"
points=""></polyline>
</svg>-->
<svg width='300' height='200' viewbox='0 0 300 220' background="#212121" id="<%= data.baseID + 'ambient-svg' %>">
<filter id="dropshadow" height="130%">
@ -80,11 +51,11 @@
<!-- stroke-linecap="round" -->
<g transform="translate(-90,40) rotate(-120 180 90)" >
<path id="<%= data.baseID + 'ambient-arcB' %>" fill="none" stroke="rgb(61, 61, 61)" stroke-width="12" style="filter:url(#dropshadow)"/>
<path id="<%= data.baseID + 'ambient-arcB' %>" fill="none" stroke="rgb(61, 61, 61)" stroke-width="12" />
<path id="<%= data.baseID + 'ambient-arc' %>" fill="none" stroke="#00bfff" stroke-width="12" />
</g>
<g transform="translate(150,100)">
<text id="<%= data.baseID + 'ambient-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' style="filter:url(#dropshadow)">--ºc</text>
<text id="<%= data.baseID + 'ambient-label' %>" class='textLabel' x='0' y='100' fill='#bad649' font-size='50' >--ºc</text>
</g>
</svg>

View File

@ -370,17 +370,17 @@ CC2650_ACCEL = function(p) {
row = $('<div />', {class: 'mui-row'});
$('<div />', {
class: 'mui-col-xs-4 mui--text-dark mui--text-center',
class: 'mui-col-xs-4 mui--text-light mui--text-center',
text: '--',
id: this.frames[modeID] + '-x'
}).appendTo(row);
$('<div />', {
class: 'mui-col-xs-4 mui--text-dark mui--text-center',
class: 'mui-col-xs-4 mui--text-light mui--text-center',
text: '--',
id: this.frames[modeID] + '-y'
}).appendTo(row);
$('<div />', {
class: 'mui-col-xs-4 mui--text-dark mui--text-center',
class: 'mui-col-xs-4 mui--text-light mui--text-center',
text: '--',
id: this.frames[modeID] + '-z'
}).appendTo(row);

View File

@ -5,7 +5,7 @@
* Time: 10:13
*
*/
/* global CAPABILITY, inheritsFrom, capabilityManager, device */
/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@ -84,73 +84,99 @@ var CC2650_BAR = function(p) {
};
this.animateGraph = function() {
this.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.pressure, 'pressure');
/* This.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.pressure, 'pressure');*/
var arcTemp = this.frameID + 'temp-arc';
var arcPressure = this.frameID + 'pressure-arc';
this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
this.updateArc(this.data.pressure, 'pressure' , arcPressure, 'hPa');
};
this.insertFrame = function() {
var self = this;
var blankChart;
// Call the parent displayForm first...
this.superClass_.insertFrame.call(self);
var temp = this.frameID + '-t';
var pressure = this.frameID + '-p';
var row = $('<div />', {class: 'mui-row'});
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
var arcB = this.frameID + 'temp-arcB';
var arcTemp = this.frameID + 'temp-arc';
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Pressure:'}).appendTo(row);
var pressureArcB = this.frameID + 'pressure-arcB';
var arcPressure = this.frameID + 'pressure-arc';
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: pressure}).appendTo(row);
var settings = {data: {baseID: this.frameID}};
var html = new EJS({url: './partials/cc2650_barometer_dial.ejs'}).render(settings);
this.$id.append(row);
this.$id.append(html);
if (/ipad/i.test(device.model)) {
document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
tabBody = $('<div>', {class: 'mui-row'});
document.getElementById(pressureArcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcPressure).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('temp'))) ;
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('pressure'))) ;
this.$id.append(tabBody);
} else {
/* Var row = $('<div />', {class: 'mui-row'});
var tabBody = $('<ul>',
{class: 'mui-tabs__bar mui-tabs__bar--justified'});
$('<li>', {class: 'mui--is-active tabOnWhite'}).append($('<a>',
{
text: 'Temperature',
'data-mui-toggle': 'tab',
'data-mui-controls': (temp + '-pane')
})).appendTo(tabBody);
$('<li>', {class: 'tabOnWhite'}).append($('<a>',
{
text: 'Pressure',
'data-mui-toggle': 'tab',
'data-mui-controls': (pressure + '-pane')
})).appendTo(tabBody);
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
this.$id.append(tabBody);
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
$('<div />', { class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Pressure:'}).appendTo(row);
blankChart = this.generateBlankGraph('temp');
$('<div />', { class: 'mui-col-xs-3 mui--text-dark', id: pressure}).appendTo(row);
this.$id.append($('<div>',
{class: 'mui-tabs__pane mui--is-active', id: (temp + '-pane')}).append(
blankChart));
this.$id.append(row);
blankChart = this.generateBlankGraph('pressure');
if (/ipad/i.test(device.model)) {
this.$id.append($('<div>',
{
class: 'mui-tabs__pane',
id: (pressure + '-pane')
}).append(blankChart));
}
tabBody = $('<div>', {class: 'mui-row'});
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('temp'))) ;
tabBody.append($('<div>',{class: 'mui-col-md-6'}).append(this.generateBlankGraph('pressure'))) ;
this.$id.append(tabBody);
} else {
var tabBody = $('<ul>',
{class: 'mui-tabs__bar mui-tabs__bar--justified'});
$('<li>', {class: 'mui--is-active tabOnWhite'}).append($('<a>',
{
text: 'Temperature',
'data-mui-toggle': 'tab',
'data-mui-controls': (temp + '-pane')
})).appendTo(tabBody);
$('<li>', {class: 'tabOnWhite'}).append($('<a>',
{
text: 'Pressure',
'data-mui-toggle': 'tab',
'data-mui-controls': (pressure + '-pane')
})).appendTo(tabBody);
this.$id.append(tabBody);
blankChart = this.generateBlankGraph('temp');
this.$id.append($('<div>',
{class: 'mui-tabs__pane mui--is-active', id: (temp + '-pane')}).append(
blankChart));
blankChart = this.generateBlankGraph('pressure');
this.$id.append($('<div>',
{
class: 'mui-tabs__pane',
id: (pressure + '-pane')
}).append(blankChart));
}*/
this.$result.temp = $('#' + temp);
this.$result.pressure = $('#' + pressure);

View File

@ -5,7 +5,7 @@
* Time: 10:13
*
*/
/* global CAPABILITY, inheritsFrom, capabilityManager, device */
/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@ -87,8 +87,15 @@ var CC2650_HUM = function(p) {
};
this.animateGraph = function() {
/*
this.simpleGraph(this.data.temp, 'temp');
this.simpleGraph(this.data.humidity, 'humidity');
*/
var arcTemp = this.frameID + 'temp-arc';
var arcHumidity = this.frameID + 'humidity-arc';
this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
this.updateArc(this.data.humidity, 'humidity' , arcHumidity, '%RH', 100);
};
@ -102,13 +109,35 @@ var CC2650_HUM = function(p) {
var temp = this.frameID + '-t';
var humidity = this.frameID + '-h';
var arcB = this.frameID + 'temp-arcB';
var arcTemp = this.frameID + 'temp-arc';
var humidityArcB = this.frameID + 'humidity-arcB';
var arcHumidity = this.frameID + 'humidity-arc';
var settings = {data: {baseID: this.frameID}};
var html = new EJS({url: './partials/cc2650_humidity_dial.ejs'}).render(settings);
this.$id.append(html);
document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
document.getElementById(humidityArcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcHumidity).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
/*
var row = $('<div />', {class: 'mui-row'});
$('<div />',
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark', id: temp}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light', id: temp}).appendTo(row);
$('<div />',
{
class: 'mui-col-xs-3 mui--text-accent mui--text-right',
@ -116,7 +145,7 @@ var CC2650_HUM = function(p) {
}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark', id: humidity}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light', id: humidity}).appendTo(row);
this.$id.append(row);
@ -157,7 +186,7 @@ var CC2650_HUM = function(p) {
class: 'mui-tabs__pane',
id: (humidity + '-pane')
}).append(blankChart));
}
}*/
this.$result.temp = $('#' + temp);
this.$result.humidity = $('#' + humidity);

View File

@ -95,7 +95,7 @@ var CC2650_LUX = function(p) {
row);
$('<div />',
{class: 'mui-col-xs-8 mui--text-dark', id: lux}).appendTo(row);
{class: 'mui-col-xs-8 mui--text-light', id: lux}).appendTo(row);
this.$id.append(row);

View File

@ -5,7 +5,7 @@
* Time: 10:13
*
*/
/* global CAPABILITY, inheritsFrom, capabilityManager */
/* global CAPABILITY, inheritsFrom, capabilityManager, EJS */
/* global ble */
/* jshint browser: true , devel: true*/
@ -88,53 +88,16 @@ var CC2650_TMP = function(p) {
this.animateGraph = function() {
// This.simpleGraph(this.data.temp, 'temp');
// debugger;
// debugger;
var arcTemp = this.frameID + 'temp-arc';
var arcAmbient = this.frameID + 'ambient-arc';
this.updateArc(this.data.temp, 'temp' , arcTemp);
this.updateArc(this.data.temp, 'temp' , arcTemp, '°C', 50);
this.updateArc(this.data.ambient, 'ambient' , arcAmbient, '°C', 50);
this.updateArc(this.data.ambient, 'ambient' , arcAmbient);
//This.simpleGraph(this.data.ambient, 'ambient');
};
this.updateArc = function(data, subID, elmID) {
var ceilingLimit;
var _subID;
var _data;
var label;
_data = data || this.data;
_subID = subID || '';
if (_data.length > 0) {
ceilingLimit = 50;
var latest = _data[_data.length - 1];
var scale = 100 / ceilingLimit;
var arcP = scale * latest;
// Var xstep = (280 - 46) / 100;
label = this.frameID + subID + '-label';
document.getElementById(elmID).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(arcP)));
// document.getElementById(label).innerText(latest.toFixed(2) + 'ºc');
}
};
this.insertFrame = function() {
var liSetting;
var tabBody;
var blankChart;
var self = this;
// Console.log('Overloading...');
// Call the parent displayForm first...
@ -156,7 +119,6 @@ var CC2650_TMP = function(p) {
this.$id.append(html);
debugger;
document.getElementById(arcB).setAttribute('d', this.describeArc(150, 150, 100, 0, 240));
document.getElementById(arcTemp).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(0)));
@ -170,7 +132,7 @@ debugger;
{class: 'mui-col-xs-3 mui--text-accent mui--text-right', text: 'Temp:'}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark mui--text-left', id: temp}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light mui--text-left', id: temp}).appendTo(row);
$('<div />',
{
class: 'mui-col-xs-3 mui--text-accent mui--text-right',
@ -178,7 +140,7 @@ debugger;
}).appendTo(row);
$('<div />',
{class: 'mui-col-xs-3 mui--text-dark', id: amb}).appendTo(row);
{class: 'mui-col-xs-3 mui--text-light', id: amb}).appendTo(row);
this.$id.append(row);

View File

@ -271,35 +271,44 @@ CAPABILITY.prototype.setArc = function(percent) {
return (240 / 100) * percent;
};
CAPABILITY.prototype.updateArc = function(data, subID, elmID) {
CAPABILITY.prototype.updateArc = function(data, subID, elmID, suffix, limiter) {
var ceilingLimit;
var ceiling;
var _subID;
var _data;
var _limiter = limiter || null;
var _suffix = suffix || '';
var label;
_data = data || this.data;
_subID = subID || '';
label = '#' + this.frameID + _subID + '-label';
if (_data.length > 0) {
ceiling = _data.reduce(function(p, v) {
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
});
if (_limiter === null) {
ceiling = _data.reduce(function(p, v) {
return (Math.abs(p) > Math.abs(v) ? Math.abs(p) : Math.abs(v));
});
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 10) * 10);
if (ceilingLimit > 1000) {
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 50) * 50);
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 10) * 10);
if (ceilingLimit > 1000) {
ceilingLimit = (Math.ceil((Math.round(ceiling) + 1) / 50) * 50);
}
} else {
ceilingLimit = _limiter;
}
var latest = _data[_data.length-1];
var latest = _data[_data.length - 1];
var scale = 100 / ceilingLimit;
var arcP = scale * latest;
// Var xstep = (280 - 46) / 100;
document.getElementById(elmID).setAttribute('d', this.describeArc(150, 150, 100, 0, this.setArc(arcP)));
$(label).text(latest.toFixed(2) + _suffix);
}