|
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 |
|
@@ -230,37 +232,44 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
230 | 232 | }) |
231 | 233 | .val(DEFAULT_ZOOM); |
232 | 234 |
|
233 | | - analyserShiftPSDSlider |
| 235 | + analyserMinPSD |
234 | 236 | .on( |
235 | 237 | "input", |
236 | 238 | debounce(100, function () { |
237 | | - const shift = -parseInt(analyserShiftPSDSlider.val()); |
238 | | - GraphSpectrumPlot.setShiftPSD(shift); |
239 | | - analyserLowLevelPSDSlider.val(0).trigger("input"); |
240 | | - analyserMinPSDText.val(-40 + shift); |
241 | | - analyserMaxPSDText.val(10 + shift); |
| 239 | + const min = parseInt(analyserMinPSD.val()); |
| 240 | + GraphSpectrumPlot.setMinPSD(min); |
| 241 | + analyserLowLevelPSD.val(min).trigger("input"); |
| 242 | + analyserLowLevelPSD.prop("min", min); |
242 | 243 | that.refresh(); |
243 | 244 | }), |
244 | 245 | ).dblclick(function () { |
245 | | - $(this).val(0).trigger("input"); |
246 | | - }).val(0); |
| 246 | + $(this).val(DEFAULT_MIN_DBM_VALUE).trigger("input"); |
| 247 | + }).val(DEFAULT_MIN_DBM_VALUE); |
247 | 248 |
|
248 | | - analyserLowLevelPSDSlider |
| 249 | + analyserMaxPSD |
249 | 250 | .on( |
250 | 251 | "input", |
251 | 252 | debounce(100, function () { |
252 | | - const lowLevelPercent = analyserLowLevelPSDSlider.val(); |
253 | | - GraphSpectrumPlot.setLowLevelPSD(lowLevelPercent); |
254 | | - const shift = -parseInt(analyserShiftPSDSlider.val()); |
255 | | - const dBmValueMin = MIN_DBM_VALUE + shift, |
256 | | - dBmValueMax = MAX_DBM_VALUE + shift, |
257 | | - lowLevel = dBmValueMin + (dBmValueMax - dBmValueMin) * lowLevelPercent / 100; |
258 | | - analyserLowPSDText.val(lowLevel); |
| 253 | + const max = parseInt(analyserMaxPSD.val()); |
| 254 | + GraphSpectrumPlot.setMaxPSD(max); |
| 255 | + analyserLowLevelPSD.prop("max", max); |
259 | 256 | that.refresh(); |
260 | 257 | }), |
261 | 258 | ).dblclick(function () { |
262 | | - $(this).val(0).trigger("input"); |
263 | | - }).val(0); |
| 259 | + $(this).val(DEFAULT_MAX_DBM_VALUE).trigger("input"); |
| 260 | + }).val(DEFAULT_MAX_DBM_VALUE); |
| 261 | + |
| 262 | + analyserLowLevelPSD |
| 263 | + .on( |
| 264 | + "input", |
| 265 | + debounce(100, function () { |
| 266 | + const lowLevel = analyserLowLevelPSD.val(); |
| 267 | + GraphSpectrumPlot.setLowLevelPSD(lowLevel); |
| 268 | + that.refresh(); |
| 269 | + }) |
| 270 | + ).dblclick(function () { |
| 271 | + $(this).val(analyserMinPSD.val()).trigger("input"); |
| 272 | + }).val(analyserMinPSD.val()); |
264 | 273 |
|
265 | 274 | // Spectrum type to show |
266 | 275 | userSettings.spectrumType = |
@@ -295,23 +304,27 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) { |
295 | 304 | "onlyFullScreenException", |
296 | 305 | pidErrorVsSetpointSelected || psdHeatMapSelected, |
297 | 306 | ); |
298 | | - analyserShiftPSDSlider.toggleClass( |
| 307 | + analyserLowLevelPSD.toggleClass( |
299 | 308 | "onlyFullScreenException", |
300 | 309 | !psdHeatMapSelected, |
301 | 310 | ); |
302 | | - analyserLowLevelPSDSlider.toggleClass( |
| 311 | + analyserMinPSD.toggleClass( |
303 | 312 | "onlyFullScreenException", |
304 | 313 | !psdHeatMapSelected, |
305 | 314 | ); |
306 | | - analyserMinPSDText.toggleClass( |
| 315 | + analyserMaxPSD.toggleClass( |
307 | 316 | "onlyFullScreenException", |
308 | 317 | !psdHeatMapSelected, |
309 | 318 | ); |
310 | | - analyserMaxPSDText.toggleClass( |
| 319 | + $("#analyserMaxPSDLabel").toggleClass( |
311 | 320 | "onlyFullScreenException", |
312 | 321 | !psdHeatMapSelected, |
313 | 322 | ); |
314 | | - analyserLowPSDText.toggleClass( |
| 323 | + $("#analyserMinPSDLabel").toggleClass( |
| 324 | + "onlyFullScreenException", |
| 325 | + !psdHeatMapSelected |
| 326 | + ); |
| 327 | + $("#analyserLowLevelPSDLabel").toggleClass( |
315 | 328 | "onlyFullScreenException", |
316 | 329 | !psdHeatMapSelected, |
317 | 330 | ); |
|
0 commit comments