Skip to content

Commit 9489e3e

Browse files
committed
Added text label for the PSD vertical sliders
1 parent 51a9ea7 commit 9489e3e

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 () {
@@ -218,13 +232,15 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
218232
})
219233
.val(DEFAULT_ZOOM);
220234

221-
analyserShiftPSDElem
235+
analyserShiftPSDSlider
222236
.on(
223237
"input",
224238
debounce(100, function () {
225-
const shift = -parseInt(analyserShiftPSDElem.val());
239+
const shift = -parseInt(analyserShiftPSDSlider.val());
226240
GraphSpectrumPlot.setShiftPSD(shift);
227-
analyserLowLevelPSDElem.val(0).trigger("input");
241+
analyserLowLevelPSDSlider.val(0).trigger("input");
242+
analyserMinPSDText.val(-40 + shift);
243+
analyserMaxPSDText.val(10 + shift);
228244
that.refresh();
229245
})
230246
)
@@ -233,12 +249,17 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
233249
})
234250
.val(0);
235251

236-
analyserLowLevelPSDElem
252+
analyserLowLevelPSDSlider
237253
.on(
238254
"input",
239255
debounce(100, function () {
240-
const lowLevel = analyserLowLevelPSDElem.val() / 100;
241-
GraphSpectrumPlot.setLowLevelPSD(lowLevel);
256+
const lowLevelPercent = analyserLowLevelPSDSlider.val();
257+
GraphSpectrumPlot.setLowLevelPSD(lowLevelPercent);
258+
const shift = -parseInt(analyserShiftPSDSlider.val());
259+
const dBmValueMin = MIN_DBM_VALUE + shift,
260+
dBmValueMax = MAX_DBM_VALUE + shift,
261+
lowLevel = dBmValueMin + (dBmValueMax - dBmValueMin) * lowLevelPercent / 100;
262+
analyserLowPSDText.val(lowLevel);
242263
that.refresh();
243264
})
244265
)
@@ -287,11 +308,23 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
287308
"onlyFullScreenException",
288309
pidErrorVsSetpointSelected || psdHeatMapSelected
289310
);
290-
analyserShiftPSDElem.toggleClass(
311+
analyserShiftPSDSlider.toggleClass(
312+
"onlyFullScreenException",
313+
!psdHeatMapSelected
314+
);
315+
analyserLowLevelPSDSlider.toggleClass(
316+
"onlyFullScreenException",
317+
!psdHeatMapSelected
318+
);
319+
analyserMinPSDText.toggleClass(
320+
"onlyFullScreenException",
321+
!psdHeatMapSelected
322+
);
323+
analyserMaxPSDText.toggleClass(
291324
"onlyFullScreenException",
292325
!psdHeatMapSelected
293326
);
294-
analyserLowLevelPSDElem.toggleClass(
327+
analyserLowPSDText.toggleClass(
295328
"onlyFullScreenException",
296329
!psdHeatMapSelected
297330
);

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)