File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -117,13 +117,14 @@ GraphSpectrumCalc.dataLoadPSD = function(analyserZoomY) {
117117 const multiplier = Math . floor ( 1 / analyserZoomY ) ; // 0. ... 10
118118 let pointsPerSegment = 2 ** ( 8 + multiplier ) ; //256, 512, 1024 ...
119119
120- // Use power 2 fft size what is not bigger flightSamples.samples.length
120+ let overlapCount ;
121121 if ( pointsPerSegment > flightSamples . samples . length ) {
122- pointsPerSegment = this . getNearPower2Value ( flightSamples . samples . length ) ;
122+ pointsPerSegment = flightSamples . samples . length ; // Use actual sample length. It will transform to power at 2 value inside the _psd() - fft_segmented
123+ overlapCount = 0 ;
124+ } else {
125+ overlapCount = pointsPerSegment / 2 ;
123126 }
124127
125- const overlapCount = pointsPerSegment / 2 ;
126-
127128 const psd = this . _psd ( flightSamples . samples , pointsPerSegment , overlapCount ) ;
128129
129130 const psdData = {
Original file line number Diff line number Diff line change @@ -350,7 +350,10 @@ GraphSpectrumPlot._drawPowerSpectralDensityGraph = function (canvasCtx) {
350350 // Allign y axis range by 10db
351351 const dbStep = 10 ;
352352 const minY = Math . floor ( this . _fftData . minimum / dbStep ) * dbStep ;
353- const maxY = ( Math . floor ( this . _fftData . maximum / dbStep ) + 1 ) * dbStep ;
353+ let maxY = ( Math . floor ( this . _fftData . maximum / dbStep ) + 1 ) * dbStep ;
354+ if ( minY == maxY ) {
355+ maxY = minY + 1 ; // prevent divide by zero
356+ }
354357 const ticksCount = ( maxY - minY ) / dbStep ;
355358 const scaleY = HEIGHT / ( maxY - minY ) ;
356359 //Store vsRange for _drawMousePosition
You can’t perform that action at this time.
0 commit comments