44 GraphSpectrumPlot ,
55 SPECTRUM_TYPE ,
66 SPECTRUM_OVERDRAW_TYPE ,
7+ MIN_DBM_VALUE ,
8+ MAX_DBM_VALUE ,
79} from "./graph_spectrum_plot" ;
810import { PrefStorage } from "./pref_storage" ;
911import { SpectrumExporter } from "./spectrum-exporter" ;
@@ -35,8 +37,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
3537 GraphSpectrumPlot . setLogRateWarningInfo ( logRateInfo ) ;
3638 const analyserZoomXElem = $ ( "#analyserZoomX" ) ;
3739 const analyserZoomYElem = $ ( "#analyserZoomY" ) ;
38- const analyserShiftPSDElem = $ ( "#analyserShiftPSD" ) ;
39- const analyserLowLevelPSDElem = $ ( "#analyserLowLevelPSD" ) ;
40+ const analyserShiftPSDSlider = $ ( "#analyserShiftPSD" ) ;
41+ const analyserLowLevelPSDSlider = $ ( "#analyserLowLevelPSD" ) ;
42+ const analyserMinPSDText = $ ( "#analyserMinPSD" ) ;
43+ const analyserMaxPSDText = $ ( "#analyserMaxPSD" ) ;
44+ const analyserLowPSDText = $ ( "#analyserLowPSD" ) ;
4045
4146 const spectrumToolbarElem = $ ( "#spectrumToolbar" ) ;
4247 const spectrumTypeElem = $ ( "#spectrumTypeSelect" ) ;
@@ -106,6 +111,15 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
106111 $ ( "#analyserResize" , parentElem ) . css ( {
107112 left : `${ newSize . width - 20 } px` ,
108113 } ) ;
114+ $ ( "#analyserMaxPSD" , parentElem ) . css ( {
115+ left : `${ newSize . width - 50 } px` ,
116+ } ) ;
117+ $ ( "#analyserMinPSD" , parentElem ) . css ( {
118+ left : `${ newSize . width - 50 } px` ,
119+ } ) ;
120+ $ ( "#analyserLowPSD" , parentElem ) . css ( {
121+ left : `${ newSize . width - 120 } px` ,
122+ } ) ;
109123 } ;
110124
111125 let dataLoad = function ( ) {
@@ -220,13 +234,15 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
220234 } )
221235 . val ( DEFAULT_ZOOM ) ;
222236
223- analyserShiftPSDElem
237+ analyserShiftPSDSlider
224238 . on (
225239 "input" ,
226240 debounce ( 100 , function ( ) {
227- const shift = - parseInt ( analyserShiftPSDElem . val ( ) ) ;
241+ const shift = - parseInt ( analyserShiftPSDSlider . val ( ) ) ;
228242 GraphSpectrumPlot . setShiftPSD ( shift ) ;
229- analyserLowLevelPSDElem . val ( 0 ) . trigger ( "input" ) ;
243+ analyserLowLevelPSDSlider . val ( 0 ) . trigger ( "input" ) ;
244+ analyserMinPSDText . val ( - 40 + shift ) ;
245+ analyserMaxPSDText . val ( 10 + shift ) ;
230246 that . refresh ( ) ;
231247 } )
232248 )
@@ -235,12 +251,17 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
235251 } )
236252 . val ( 0 ) ;
237253
238- analyserLowLevelPSDElem
254+ analyserLowLevelPSDSlider
239255 . on (
240256 "input" ,
241257 debounce ( 100 , function ( ) {
242- const lowLevel = analyserLowLevelPSDElem . val ( ) / 100 ;
243- GraphSpectrumPlot . setLowLevelPSD ( lowLevel ) ;
258+ const lowLevelPercent = analyserLowLevelPSDSlider . val ( ) ;
259+ GraphSpectrumPlot . setLowLevelPSD ( lowLevelPercent ) ;
260+ const shift = - parseInt ( analyserShiftPSDSlider . val ( ) ) ;
261+ const dBmValueMin = MIN_DBM_VALUE + shift ,
262+ dBmValueMax = MAX_DBM_VALUE + shift ,
263+ lowLevel = dBmValueMin + ( dBmValueMax - dBmValueMin ) * lowLevelPercent / 100 ;
264+ analyserLowPSDText . val ( lowLevel ) ;
244265 that . refresh ( ) ;
245266 } )
246267 )
@@ -282,11 +303,23 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
282303 "onlyFullScreenException" ,
283304 pidErrorVsSetpointSelected || psdHeatMapSelected
284305 ) ;
285- analyserShiftPSDElem . toggleClass (
306+ analyserShiftPSDSlider . toggleClass (
307+ "onlyFullScreenException" ,
308+ ! psdHeatMapSelected
309+ ) ;
310+ analyserLowLevelPSDSlider . toggleClass (
311+ "onlyFullScreenException" ,
312+ ! psdHeatMapSelected
313+ ) ;
314+ analyserMinPSDText . toggleClass (
315+ "onlyFullScreenException" ,
316+ ! psdHeatMapSelected
317+ ) ;
318+ analyserMaxPSDText . toggleClass (
286319 "onlyFullScreenException" ,
287320 ! psdHeatMapSelected
288321 ) ;
289- analyserLowLevelPSDElem . toggleClass (
322+ analyserLowPSDText . toggleClass (
290323 "onlyFullScreenException" ,
291324 ! psdHeatMapSelected
292325 ) ;
0 commit comments