|
4 | 4 | GraphSpectrumPlot, |
5 | 5 | SPECTRUM_TYPE, |
6 | 6 | SPECTRUM_OVERDRAW_TYPE, |
7 | | - MIN_DBM_VALUE, |
8 | | - MAX_DBM_VALUE, |
| 7 | + DEFAULT_MIN_DBM_VALUE, |
| 8 | + DEFAULT_MAX_DBM_VALUE, |
9 | 9 | } from "./graph_spectrum_plot"; |
10 | 10 | import { PrefStorage } from "./pref_storage"; |
11 | 11 | import { SpectrumExporter } from "./spectrum-exporter"; |
@@ -37,11 +37,10 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
37 | 37 | GraphSpectrumPlot.setLogRateWarningInfo(logRateInfo); |
38 | 38 | const analyserZoomXElem = $("#analyserZoomX"); |
39 | 39 | const analyserZoomYElem = $("#analyserZoomY"); |
40 | | - const analyserShiftPSDSlider = $("#analyserShiftPSD"); |
41 | | - const analyserLowLevelPSDSlider = $("#analyserLowLevelPSD"); |
42 | | - const analyserMinPSDText = $("#analyserMinPSD"); |
43 | | - const analyserMaxPSDText = $("#analyserMaxPSD"); |
44 | | - const analyserLowPSDText = $("#analyserLowPSD"); |
| 40 | + const analyserMinPSD = $("#analyserMinPSD"); |
| 41 | + const analyserMaxPSD = $("#analyserMaxPSD"); |
| 42 | + const analyserLowLevelPSD = $("#analyserLowLevelPSD"); |
| 43 | + |
45 | 44 |
|
46 | 45 | const spectrumToolbarElem = $("#spectrumToolbar"); |
47 | 46 | const spectrumTypeElem = $("#spectrumTypeSelect"); |
@@ -102,23 +101,26 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
102 | 101 | $("#analyserZoomY", parentElem).css({ |
103 | 102 | left: `${newSize.width - 20}px`, |
104 | 103 | }); |
105 | | - $("#analyserShiftPSD", parentElem).css({ |
106 | | - left: `${newSize.width - 60}px`, |
107 | | - }); |
108 | | - $("#analyserLowLevelPSD", parentElem).css({ |
109 | | - left: `${newSize.width - 110}px`, |
110 | | - }); |
111 | 104 | $("#analyserResize", parentElem).css({ |
112 | 105 | left: `${newSize.width - 20}px`, |
113 | 106 | }); |
114 | 107 | $("#analyserMaxPSD", parentElem).css({ |
115 | | - left: `${newSize.width - 70}px`, |
| 108 | + left: `${newSize.width - 90}px`, |
116 | 109 | }); |
117 | 110 | $("#analyserMinPSD", parentElem).css({ |
118 | | - left: `${newSize.width - 70}px`, |
| 111 | + left: `${newSize.width - 90}px`, |
119 | 112 | }); |
120 | | - $("#analyserLowPSD", parentElem).css({ |
121 | | - left: `${newSize.width - 125}px`, |
| 113 | + $("#analyserLowLevelPSD", parentElem).css({ |
| 114 | + left: `${newSize.width - 90}px`, |
| 115 | + }); |
| 116 | + $("#analyserMaxPSDLabel", parentElem).css({ |
| 117 | + left: `${newSize.width - 150}px`, |
| 118 | + }); |
| 119 | + $("#analyserMinPSDLabel", parentElem).css({ |
| 120 | + left: `${newSize.width - 150}px`, |
| 121 | + }); |
| 122 | + $("#analyserLowLevelPSDLabel", parentElem).css({ |
| 123 | + left: `${newSize.width - 155}px`, |
122 | 124 | }); |
123 | 125 | }; |
124 | 126 |
|
@@ -231,37 +233,44 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
231 | 233 | }) |
232 | 234 | .val(DEFAULT_ZOOM); |
233 | 235 |
|
234 | | - analyserShiftPSDSlider |
| 236 | + analyserMinPSD |
235 | 237 | .on( |
236 | 238 | "input", |
237 | 239 | debounce(100, function () { |
238 | | - const shift = -parseInt(analyserShiftPSDSlider.val()); |
239 | | - GraphSpectrumPlot.setShiftPSD(shift); |
240 | | - analyserLowLevelPSDSlider.val(0).trigger("input"); |
241 | | - analyserMinPSDText.val(-40 + shift); |
242 | | - analyserMaxPSDText.val(10 + shift); |
| 240 | + const min = parseInt(analyserMinPSD.val()); |
| 241 | + GraphSpectrumPlot.setMinPSD(min); |
| 242 | + analyserLowLevelPSD.val(min).trigger("input"); |
| 243 | + analyserLowLevelPSD.prop("min", min); |
243 | 244 | that.refresh(); |
244 | 245 | }), |
245 | 246 | ).dblclick(function () { |
246 | | - $(this).val(0).trigger("input"); |
247 | | - }).val(0); |
| 247 | + $(this).val(DEFAULT_MIN_DBM_VALUE).trigger("input"); |
| 248 | + }).val(DEFAULT_MIN_DBM_VALUE); |
248 | 249 |
|
249 | | - analyserLowLevelPSDSlider |
| 250 | + analyserMaxPSD |
250 | 251 | .on( |
251 | 252 | "input", |
252 | 253 | debounce(100, function () { |
253 | | - const lowLevelPercent = analyserLowLevelPSDSlider.val(); |
254 | | - GraphSpectrumPlot.setLowLevelPSD(lowLevelPercent); |
255 | | - const shift = -parseInt(analyserShiftPSDSlider.val()); |
256 | | - const dBmValueMin = MIN_DBM_VALUE + shift, |
257 | | - dBmValueMax = MAX_DBM_VALUE + shift, |
258 | | - lowLevel = dBmValueMin + (dBmValueMax - dBmValueMin) * lowLevelPercent / 100; |
259 | | - analyserLowPSDText.val(lowLevel); |
| 254 | + const max = parseInt(analyserMaxPSD.val()); |
| 255 | + GraphSpectrumPlot.setMaxPSD(max); |
| 256 | + analyserLowLevelPSD.prop("max", max); |
260 | 257 | that.refresh(); |
261 | 258 | }), |
262 | 259 | ).dblclick(function () { |
263 | | - $(this).val(0).trigger("input"); |
264 | | - }).val(0); |
| 260 | + $(this).val(DEFAULT_MAX_DBM_VALUE).trigger("input"); |
| 261 | + }).val(DEFAULT_MAX_DBM_VALUE); |
| 262 | + |
| 263 | + analyserLowLevelPSD |
| 264 | + .on( |
| 265 | + "input", |
| 266 | + debounce(100, function () { |
| 267 | + const lowLevel = analyserLowLevelPSD.val(); |
| 268 | + GraphSpectrumPlot.setLowLevelPSD(lowLevel); |
| 269 | + that.refresh(); |
| 270 | + }) |
| 271 | + ).dblclick(function () { |
| 272 | + $(this).val(analyserMinPSD.val()).trigger("input"); |
| 273 | + }).val(analyserMinPSD.val()); |
265 | 274 |
|
266 | 275 | // Spectrum type to show |
267 | 276 | userSettings.spectrumType = |
@@ -303,23 +312,27 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
303 | 312 | "onlyFullScreenException", |
304 | 313 | pidErrorVsSetpointSelected || psdHeatMapSelected, |
305 | 314 | ); |
306 | | - analyserShiftPSDSlider.toggleClass( |
| 315 | + analyserLowLevelPSD.toggleClass( |
307 | 316 | "onlyFullScreenException", |
308 | 317 | !psdHeatMapSelected, |
309 | 318 | ); |
310 | | - analyserLowLevelPSDSlider.toggleClass( |
| 319 | + analyserMinPSD.toggleClass( |
311 | 320 | "onlyFullScreenException", |
312 | 321 | !psdHeatMapSelected, |
313 | 322 | ); |
314 | | - analyserMinPSDText.toggleClass( |
| 323 | + analyserMaxPSD.toggleClass( |
315 | 324 | "onlyFullScreenException", |
316 | 325 | !psdHeatMapSelected, |
317 | 326 | ); |
318 | | - analyserMaxPSDText.toggleClass( |
| 327 | + $("#analyserMaxPSDLabel").toggleClass( |
319 | 328 | "onlyFullScreenException", |
320 | 329 | !psdHeatMapSelected, |
321 | 330 | ); |
322 | | - analyserLowPSDText.toggleClass( |
| 331 | + $("#analyserMinPSDLabel").toggleClass( |
| 332 | + "onlyFullScreenException", |
| 333 | + !psdHeatMapSelected |
| 334 | + ); |
| 335 | + $("#analyserLowLevelPSDLabel").toggleClass( |
323 | 336 | "onlyFullScreenException", |
324 | 337 | !psdHeatMapSelected, |
325 | 338 | ); |
|
0 commit comments