|
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"; |
@@ -38,11 +38,10 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
38 | 38 | GraphSpectrumPlot.setLogRateWarningInfo(logRateInfo); |
39 | 39 | const analyserZoomXElem = $("#analyserZoomX"); |
40 | 40 | const analyserZoomYElem = $("#analyserZoomY"); |
41 | | - const analyserShiftPSDSlider = $("#analyserShiftPSD"); |
42 | | - const analyserLowLevelPSDSlider = $("#analyserLowLevelPSD"); |
43 | | - const analyserMinPSDText = $("#analyserMinPSD"); |
44 | | - const analyserMaxPSDText = $("#analyserMaxPSD"); |
45 | | - const analyserLowPSDText = $("#analyserLowPSD"); |
| 41 | + const analyserMinPSD = $("#analyserMinPSD"); |
| 42 | + const analyserMaxPSD = $("#analyserMaxPSD"); |
| 43 | + const analyserLowLevelPSD = $("#analyserLowLevelPSD"); |
| 44 | + |
46 | 45 |
|
47 | 46 | const spectrumToolbarElem = $("#spectrumToolbar"); |
48 | 47 | const spectrumTypeElem = $("#spectrumTypeSelect"); |
@@ -103,23 +102,26 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
103 | 102 | $("#analyserZoomY", parentElem).css({ |
104 | 103 | left: `${newSize.width - 20}px`, |
105 | 104 | }); |
106 | | - $("#analyserShiftPSD", parentElem).css({ |
107 | | - left: `${newSize.width - 60}px`, |
108 | | - }); |
109 | | - $("#analyserLowLevelPSD", parentElem).css({ |
110 | | - left: `${newSize.width - 110}px`, |
111 | | - }); |
112 | 105 | $("#analyserResize", parentElem).css({ |
113 | 106 | left: `${newSize.width - 20}px`, |
114 | 107 | }); |
115 | 108 | $("#analyserMaxPSD", parentElem).css({ |
116 | | - left: `${newSize.width - 70}px`, |
| 109 | + left: `${newSize.width - 90}px`, |
117 | 110 | }); |
118 | 111 | $("#analyserMinPSD", parentElem).css({ |
119 | | - left: `${newSize.width - 70}px`, |
| 112 | + left: `${newSize.width - 90}px`, |
120 | 113 | }); |
121 | | - $("#analyserLowPSD", parentElem).css({ |
122 | | - left: `${newSize.width - 125}px`, |
| 114 | + $("#analyserLowLevelPSD", parentElem).css({ |
| 115 | + left: `${newSize.width - 90}px`, |
| 116 | + }); |
| 117 | + $("#analyserMaxPSDLabel", parentElem).css({ |
| 118 | + left: `${newSize.width - 150}px`, |
| 119 | + }); |
| 120 | + $("#analyserMinPSDLabel", parentElem).css({ |
| 121 | + left: `${newSize.width - 150}px`, |
| 122 | + }); |
| 123 | + $("#analyserLowLevelPSDLabel", parentElem).css({ |
| 124 | + left: `${newSize.width - 155}px`, |
123 | 125 | }); |
124 | 126 | }; |
125 | 127 |
|
@@ -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 = |
@@ -296,23 +305,27 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
296 | 305 | "onlyFullScreenException", |
297 | 306 | pidErrorVsSetpointSelected || psdHeatMapSelected, |
298 | 307 | ); |
299 | | - analyserShiftPSDSlider.toggleClass( |
| 308 | + analyserLowLevelPSD.toggleClass( |
300 | 309 | "onlyFullScreenException", |
301 | 310 | !psdHeatMapSelected, |
302 | 311 | ); |
303 | | - analyserLowLevelPSDSlider.toggleClass( |
| 312 | + analyserMinPSD.toggleClass( |
304 | 313 | "onlyFullScreenException", |
305 | 314 | !psdHeatMapSelected, |
306 | 315 | ); |
307 | | - analyserMinPSDText.toggleClass( |
| 316 | + analyserMaxPSD.toggleClass( |
308 | 317 | "onlyFullScreenException", |
309 | 318 | !psdHeatMapSelected, |
310 | 319 | ); |
311 | | - analyserMaxPSDText.toggleClass( |
| 320 | + $("#analyserMaxPSDLabel").toggleClass( |
312 | 321 | "onlyFullScreenException", |
313 | 322 | !psdHeatMapSelected, |
314 | 323 | ); |
315 | | - analyserLowPSDText.toggleClass( |
| 324 | + $("#analyserMinPSDLabel").toggleClass( |
| 325 | + "onlyFullScreenException", |
| 326 | + !psdHeatMapSelected |
| 327 | + ); |
| 328 | + $("#analyserLowLevelPSDLabel").toggleClass( |
316 | 329 | "onlyFullScreenException", |
317 | 330 | !psdHeatMapSelected, |
318 | 331 | ); |
|
0 commit comments