@@ -17,7 +17,8 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
1717 const that = this ,
1818 prefs = new PrefStorage ( ) ,
1919 DEFAULT_PSD_HEATMAP_MIN = - 40 ,
20- DEFAULT_PSD_HEATMAP_MAX = 10 ;
20+ DEFAULT_PSD_HEATMAP_MAX = 10 ,
21+ DEFAULT_PSD_SEGMENT_LENGTH = 512 ;
2122 let analyserZoomX = 1.0 /* 100% */ ,
2223 analyserZoomY = 1.0 /* 100% */ ,
2324 dataReload = false ,
@@ -122,7 +123,7 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
122123 left : `${ newSize . width - 150 } px` ,
123124 } ) ;
124125 $ ( "#analyserSegmentLengthPSDLabel" , parentElem ) . css ( {
125- left : `${ newSize . width - 150 } px` ,
126+ left : `${ newSize . width - 170 } px` ,
126127 } ) ;
127128 } ;
128129
@@ -297,30 +298,41 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
297298 } )
298299 . val ( analyserMinPSD . val ( ) ) ;
299300
300- let previousSegLenValue = 512 ;
301+ let segmentLenghtPSD = DEFAULT_PSD_SEGMENT_LENGTH ;
302+ GraphSpectrumCalc . setPointsPerSegmentPSD ( segmentLenghtPSD ) ;
301303 analyserSegmentLengthPSD
302304 . on (
303305 "input" ,
304306 function ( ) {
305307 const currentValue = parseInt ( $ ( this ) . val ( ) ) ;
306- if ( currentValue > previousSegLenValue ) {
307- previousSegLenValue *= 2 ;
308- } else {
309- previousSegLenValue /= 2 ;
308+ if ( currentValue > segmentLenghtPSD ) {
309+ segmentLenghtPSD *= 2 ;
310+ } else if ( currentValue < segmentLenghtPSD ) {
311+ segmentLenghtPSD /= 2 ;
310312 }
311- $ ( this ) . val ( previousSegLenValue ) ;
313+ $ ( this ) . val ( segmentLenghtPSD ) ;
312314 // Recalculate PSD with updated samples per segment count
315+ GraphSpectrumCalc . setPointsPerSegmentPSD ( segmentLenghtPSD ) ;
313316 dataLoad ( ) ;
314317 GraphSpectrumPlot . setData ( fftData , userSettings . spectrumType ) ;
315318 that . refresh ( ) ;
316319 } ,
317320 )
318321 . dblclick ( function ( e ) {
319322 if ( e . ctrlKey ) {
320- $ ( this ) . val ( userSettings . psdHeatmapMax ) . trigger ( "input" ) ;
323+ segmentLenghtPSD = DEFAULT_PSD_SEGMENT_LENGTH ;
324+ $ ( this ) . val ( DEFAULT_PSD_SEGMENT_LENGTH ) . trigger ( "input" ) ;
321325 }
322326 } )
323- . val ( 512 ) ;
327+ . val ( DEFAULT_PSD_SEGMENT_LENGTH ) ;
328+
329+ analyserSegmentLengthPSD
330+ . on (
331+ "keydown" ,
332+ function ( e ) {
333+ e . preventDefault ( ) ;
334+ }
335+ ) ;
324336
325337 // Spectrum type to show
326338 userSettings . spectrumType =
0 commit comments