Skip to content

Commit 8f664d7

Browse files
committed
Added missing slices of data samples arrays in spectrum calc
1 parent 58ccb0b commit 8f664d7

File tree

1 file changed

+18
-17
lines changed

1 file changed

+18
-17
lines changed

src/graph_spectrum_calc.js

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,13 @@ GraphSpectrumCalc._dataLoadFrequencyVsX = function(vsFieldNames, minValue = Infi
178178
// blur algorithm to the heat map image
179179

180180
const fftData = {
181-
fieldIndex : this._dataBuffer.fieldIndex,
182-
fieldName : this._dataBuffer.fieldName,
183-
fftLength : fftChunkLength,
184-
fftOutput : matrixFftOutput,
185-
maxNoise : maxNoise,
186-
blackBoxRate : this._blackBoxRate,
187-
vsRange : { min: flightSamples.minValue, max: flightSamples.maxValue},
181+
fieldIndex : this._dataBuffer.fieldIndex,
182+
fieldName : this._dataBuffer.fieldName,
183+
fftLength : fftChunkLength,
184+
fftOutput : matrixFftOutput,
185+
maxNoise : maxNoise,
186+
blackBoxRate : this._blackBoxRate,
187+
vsRange : { min: flightSamples.minValue, max: flightSamples.maxValue},
188188
};
189189

190190
return fftData;
@@ -287,7 +287,7 @@ GraphSpectrumCalc._getFlightSamplesFreq = function() {
287287

288288
const allChunks = this._getFlightChunks();
289289

290-
const samples = new Float64Array(MAX_ANALYSER_LENGTH / (1000 * 1000) * this._blackBoxRate);
290+
let samples = new Float64Array(MAX_ANALYSER_LENGTH / (1000 * 1000) * this._blackBoxRate);
291291

292292
// Loop through all the samples in the chunks and assign them to a sample array ready to pass to the FFT.
293293
let samplesCount = 0;
@@ -299,7 +299,7 @@ GraphSpectrumCalc._getFlightSamplesFreq = function() {
299299
}
300300

301301
return {
302-
samples : samples,
302+
samples : samples.slice(0, samplesCount),
303303
count : samplesCount,
304304
};
305305
};
@@ -379,13 +379,14 @@ GraphSpectrumCalc._getFlightSamplesFreqVsX = function(vsFieldNames, minValue = I
379379
for (const vsValueArray of vsValues) {
380380
slicedVsValues.push(vsValueArray.slice(0, samplesCount));
381381
}
382+
382383
return {
383-
samples : samples.slice(0, samplesCount),
384-
vsValues : slicedVsValues,
385-
count : samplesCount,
386-
minValue : minValue,
387-
maxValue : maxValue,
388-
};
384+
samples : samples.slice(0, samplesCount),
385+
vsValues : slicedVsValues,
386+
count : samplesCount,
387+
minValue : minValue,
388+
maxValue : maxValue,
389+
};
389390
};
390391

391392
GraphSpectrumCalc._getFlightSamplesPidErrorVsSetpoint = function(axisIndex) {
@@ -414,8 +415,8 @@ GraphSpectrumCalc._getFlightSamplesPidErrorVsSetpoint = function(axisIndex) {
414415
}
415416

416417
return {
417-
piderror,
418-
setpoint,
418+
piderror: piderror.slice(0, samplesCount),
419+
setpoint: setpoint.slice(0, samplesCount),
419420
maxSetpoint,
420421
count: samplesCount,
421422
};

0 commit comments

Comments
 (0)