Skip to content

Commit

Permalink
Update graph_spectrum.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mmosca authored Aug 14, 2024
1 parent 3caedd0 commit c12b08a
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions js/graph_spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
var analyserZoomXElem = $("#analyserZoomX");
var analyserZoomYElem = $("#analyserZoomY");

console.log("sysConfig['looptime']:" + sysConfig['looptime']);
console.log("sysConfig['frameIntervalPNum']:" + sysConfig['frameIntervalPNum']);
console.log("sysConfig['frameIntervalPDenom']:" + sysConfig['frameIntervalPDenom']);
var blackBoxRate = (1000000 / sysConfig['looptime']).toFixed(0) * (sysConfig['frameIntervalPNum'] / sysConfig['frameIntervalPDenom']);

var dataBuffer = {
Expand Down Expand Up @@ -192,8 +189,6 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {

var PLOTTED_BUFFER_LENGTH = fftData.fftLength / (analyserZoomX);
var PLOTTED_BLACKBOX_RATE = blackBoxRate / (analyserZoomX);
console.log("blackBoxRate:" + blackBoxRate);
console.log("analyserZoomX:" + analyserZoomX);

canvasCtx.translate(LEFT, TOP);

Expand Down Expand Up @@ -228,7 +223,6 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
}

drawAxisLabel(dataBuffer.fieldName, WIDTH - 4, HEIGHT - 6, 'right');
console.log("PLOTTED_BLACKBO_RATE:" + PLOTTED_BLACKBOX_RATE);
drawGridLines(PLOTTED_BLACKBOX_RATE, LEFT, TOP, WIDTH, HEIGHT, MARGIN);

var offset = 0;
Expand Down Expand Up @@ -322,19 +316,15 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
canvasCtx.lineTo(x, HEIGHT);

canvasCtx.stroke();
console.log("Freq: " + frequency);
if (label != null && isFinite(frequency) && !isNaN(frequency)) drawAxisLabel(label + ' ' + (frequency.toFixed(0)) + "Hz", (x + 2), OFFSET, 'left');

};

var drawGridLines = function (sampleRate, LEFT, TOP, WIDTH, HEIGHT, MARGIN) {

var ticks = 5;
console.log("sampleRate: " + sampleRate);
console.log("ticks: " + ticks);
var frequencyInterval = (sampleRate / ticks) / 2;
var frequency = 0;
console.log("frequencyInterval: " + frequencyInterval);

for (var i = 0; i <= ticks; i++) {
canvasCtx.beginPath();
Expand All @@ -346,7 +336,7 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {

canvasCtx.stroke();
var textAlign = (i == 0) ? 'left' : ((i == ticks) ? 'right' : 'center');
console.log("freq: " + frequency);

if(isFinite(frequency)) {
drawAxisLabel((frequency.toFixed(0)) + "Hz", i * (WIDTH / ticks), HEIGHT + MARGIN, textAlign);
}
Expand Down Expand Up @@ -435,4 +425,4 @@ function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
}
}

}
}

0 comments on commit c12b08a

Please sign in to comment.