Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
Merge pull request #135 from gmfc/Code-fix-2
Browse files Browse the repository at this point in the history
Mais correções
  • Loading branch information
gmfc committed Jan 10, 2017
2 parents f22c951 + 17451d7 commit dce17ce
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 24 deletions.
7 changes: 3 additions & 4 deletions src/Data.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ var sm = require('simple-statistics');

/**
* Classe responsável por administrar e receber os dados da plataforma.
* Faz todos os cálculos com os dados da plataforma e gera os e o relatorio
* Faz todos os cálculos com os dados da plataforma e gera relatórios.
* @constructor
* @param {number} pa - Medida entre o centro da plataforma e o centro de medição no eixo x.
* @param {number} pb - Medida entre o centro da plataforma e o centro de medição no eixo y.
Expand Down Expand Up @@ -139,10 +139,10 @@ PlatData.prototype.limiter = function(ti, tr, tl, br, bl) {
BL: bl
};
}
}
};

/**
* Recebe uma string formatada e splita a mesma em parametros.
* Recebe uma string formatada e separa a mesma em parametros.
* Aplica os filtros.
* @param {string} data - String formatada: 'TI;TR;TL;BR;BL'
* @param {boolean} realtime - Flag que sinaliza se a leitura estará sendo
Expand Down Expand Up @@ -246,7 +246,6 @@ PlatData.prototype.RTCOP = function(data) {
TL = phrased.TL,
BR = phrased.BR,
BL = phrased.BL;

var result = {};
result.t = TI - this.tempDeltaTime;
this.tempDeltaTime = TI;
Expand Down
5 changes: 0 additions & 5 deletions src/DebugController.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ var isConnected = false;
///////////////////////////////

function btConnecting() {
console.log('Conectando...');
$('#label').switchClass('yellow green red', 'blue');
$('#status').switchClass('yellow green red', 'blue');
$('#labeltxt').text('Conectando');
Expand All @@ -60,7 +59,6 @@ function btConnecting() {
}

function btDisconnected() {
console.log('desconectado!');
$('#label').switchClass('blue green red', 'yellow');
$('#status').switchClass('blue green red', 'yellow');
$('#labeltxt').text('Conectar');
Expand All @@ -81,7 +79,6 @@ function btConnected(freq) {
}

function btERR(err) {
console.log('ERRO! ' + err);
$('#label').switchClass('blue yellow green', 'red');
$('#status').switchClass('blue yellow green', 'red');
$('#labeltxt').text('Reset');
Expand Down Expand Up @@ -138,7 +135,6 @@ function connect(name) {
} else {
port.on('data', function(data) {
coleta(data);
//console.log('data received: ' + data);
});
port.on('close', function(data) {
port = null;
Expand Down Expand Up @@ -176,7 +172,6 @@ function findPlat() {

if (port.manufacturer.indexOf('Arduino') !== -1 && !found) {
connect(port.comName);
console.log(port.comName);
found = true;
}
if (counter === ports.length && !found) {
Expand Down
4 changes: 0 additions & 4 deletions src/RealTimeController.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ var isConnected = false;
///////////////////////////////

function btConnecting() {
console.log('Conectando...');
$('#label').switchClass('yellow green red', 'blue');
$('#status').switchClass('yellow green red', 'blue');
$('#labeltxt').text('Conectando');
Expand All @@ -66,7 +65,6 @@ function btConnecting() {
}

function btDisconnected() {
console.log('desconectado!');
$('#label').switchClass('blue green red', 'yellow');
$('#status').switchClass('blue green red', 'yellow');
$('#labeltxt').text('Conectar');
Expand All @@ -87,7 +85,6 @@ function btConnected(freq) {
}

function btERR(err) {
console.log('ERRO! ' + err);
$('#label').switchClass('blue yellow green', 'red');
$('#status').switchClass('blue yellow green', 'red');
$('#labeltxt').text('Reset');
Expand Down Expand Up @@ -147,7 +144,6 @@ function connect(name) {
} else {
port.on('data', function(data) {
coleta(data);
//console.log('data received: ' + data);
});
port.on('close', function(data) {
port = null;
Expand Down
16 changes: 5 additions & 11 deletions src/ReportController.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var browserserialport = require('browser-serialport');
var Plataforma = require('./Data.js');

/**
* Referência estática ao construtor SerialPort
* Refêrencia estática ao construtor SerialPort
* @member {external:SerialPort} SerialPort
*/
var SerialPort = browserserialport.SerialPort;
Expand Down Expand Up @@ -79,7 +79,6 @@ function ACTUpdateTime() {
}

function btConnecting() {
console.log('Conectando...');
$('#label').switchClass('yellow green red', 'blue');
$('#status').switchClass('yellow green red', 'blue');
$('#labeltxt').text('Conectando');
Expand All @@ -88,7 +87,6 @@ function btConnecting() {
}

function btDisconnected() {
console.log('desconectado!');
$('#play').switchClass('green', 'disabled');
$('#label').switchClass('blue green red', 'yellow');
$('#status').switchClass('blue green red', 'yellow');
Expand All @@ -98,7 +96,6 @@ function btDisconnected() {
}

function btConnected() {
console.time('btConnected');
if (!resultReady) {
$('#connect').switchClass('active', 'completed');
$('#stepduracao').switchClass('disabled', 'active');
Expand All @@ -110,11 +107,9 @@ function btConnected() {
$('#status').switchClass('blue yellow red', 'green');
$('#labeltxt').text('Conectado');
$('#bt').addClass('disabled');
console.timeEnd('btConnected');
}

function btERR(err) {
console.log('ERRO! ' + err);
$('#label').switchClass('blue yellow green', 'red');
$('#status').switchClass('blue yellow green', 'red');
$('#labeltxt').text('Reset');
Expand Down Expand Up @@ -163,7 +158,6 @@ function drawGraph(vetX, vetY) {
for (var i = 0; i < vetX.length; i++) {
addPoint(vetX[i], vetY[i]);
}
console.log('prepara download links');
prepImgDownload();
}

Expand All @@ -177,8 +171,9 @@ function coleta(dados) {
var linhas = acc.split('#');
acc = linhas.pop();
linhas.forEach(function(part) {
if (recording)
if (recording) {
calc.pushData(part);
}
});
}

Expand Down Expand Up @@ -304,7 +299,7 @@ function genReport(result) {
*/
function processData() {
resultReady = true;
var result = calc.fullReport(); //JSON.stringify(, null, 2);
var result = calc.fullReport();
drawGraph(result.CPx, result.CPy);
genReport(result);
}
Expand Down Expand Up @@ -344,15 +339,13 @@ function startReading(temp) {
$('#progress').progress('increment');
}
} else {
console.log('ACABOU! ' + count);
$('#status').html('Gerando relatório');
recording = false;
processData();
}
};
var callback = function() {
$('#status').html('Medindo');
console.log(count + ' of ' + temp);
clearInterval(timer);
timer = null;
count--;
Expand Down Expand Up @@ -380,3 +373,4 @@ function ACTPlay() {
$('#bt').click(findPlat);
$('#play').click(ACTPlay);
$('#tempo').on('input', ACTUpdateTime);
);

0 comments on commit dce17ce

Please sign in to comment.