Skip to content

Commit 38f5694

Browse files
committed
Added text label for the PSD vertical sliders
1 parent ea0b2ff commit 38f5694

File tree

4 files changed

+74
-13
lines changed

4 files changed

+74
-13
lines changed

index.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,12 @@ <h4>Workspace</h4>
497497
/>
498498
<input id="analyserLowLevelPSD" class="onlyFullScreen" type="range" name="analyserLowLevelPSD" value="0" min="0" max="100" step="5"
499499
/>
500+
<input id="analyserMaxPSD" class="onlyFullScreen" type="text" name="analyserMaxPSD" value="10" type="number" readonly
501+
/>
502+
<input id="analyserMinPSD" class="onlyFullScreen" type="text" name="analyserMinPSD" value="-40" type="number" readonly
503+
/>
504+
<input id="analyserLowPSD" class="onlyFullScreen" type="text" name="analyserLowPSD" value="0" type="number" readonly
505+
/>
500506

501507
<datalist id="analyserZoomXTicks">
502508
<option>100</option>

src/css/main.css

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -695,6 +695,27 @@ html.has-analyser-fullscreen.has-analyser
695695
top: 30px;
696696
}
697697

698+
.analyser input#analyserMaxPSD {
699+
width: 30px;
700+
height: 18px;
701+
left: 0px;
702+
top: 30px;
703+
}
704+
705+
.analyser input#analyserMinPSD {
706+
width: 30px;
707+
height: 18px;
708+
left: 0px;
709+
top: 110px;
710+
}
711+
712+
.analyser input#analyserLowPSD {
713+
width: 40px;
714+
height: 18px;
715+
left: 0px;
716+
top: 70px;
717+
}
718+
698719
.analyser input.onlyFullScreen {
699720
display: none;
700721
padding: 3px;

src/graph_spectrum.js

Lines changed: 43 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ import {
44
GraphSpectrumPlot,
55
SPECTRUM_TYPE,
66
SPECTRUM_OVERDRAW_TYPE,
7+
MIN_DBM_VALUE,
8+
MAX_DBM_VALUE,
79
} from "./graph_spectrum_plot";
810
import { PrefStorage } from "./pref_storage";
911
import { 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
);

src/graph_spectrum_plot.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ const BLUR_FILTER_PIXEL = 1,
1212
MAX_SETPOINT_DEFAULT = 100,
1313
PID_ERROR_VERTICAL_CHUNK = 5,
1414
ZOOM_X_MAX = 5,
15-
MIN_DBM_VALUE = -40,
16-
MAX_DBM_VALUE = 10,
1715
MAX_SPECTRUM_LINE_COUNT = 30000;
1816

17+
export const MIN_DBM_VALUE = -40,
18+
MAX_DBM_VALUE = 10;
19+
1920
export const SPECTRUM_TYPE = {
2021
FREQUENCY: 0,
2122
FREQ_VS_THROTTLE: 1,
@@ -531,7 +532,7 @@ GraphSpectrumPlot._drawHeatMap = function (drawPSD = false) {
531532

532533
const dBmValueMin = MIN_DBM_VALUE + this._shiftPSD,
533534
dBmValueMax = MAX_DBM_VALUE + this._shiftPSD,
534-
lowLevel = dBmValueMin + (dBmValueMax - dBmValueMin) * this._lowLevelPSD;
535+
lowLevel = dBmValueMin + (dBmValueMax - dBmValueMin) * this._lowLevelPSD / 100;
535536
// Loop for throttle
536537
for (let j = 0; j < THROTTLE_VALUES_SIZE; j++) {
537538
// Loop for frequency

0 commit comments

Comments
 (0)