Skip to content

Commit 234f34f

Browse files
committed
Improved PSD range values validation logic
1 parent fe46dfe commit 234f34f

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,9 @@ <h4>Workspace</h4>
495495
/>
496496
<input id="analyserLowLevelPSD" class="onlyFullScreen" type="number" name="analyserLowLevelPSD" value="-40" min="-40" max="10" step="5"
497497
/>
498-
<input id="analyserMaxPSD" class="onlyFullScreen" type="number" name="analyserMaxPSD" value="10" min="-20" max="100" step="5"
498+
<input id="analyserMaxPSD" class="onlyFullScreen" type="number" name="analyserMaxPSD" value="10" min="-35" max="100" step="5"
499499
/>
500-
<input id="analyserMinPSD" class="onlyFullScreen" type="number" name="analyserMinPSD" value="-40" min="-100" max="20" step="5"
500+
<input id="analyserMinPSD" class="onlyFullScreen" type="number" name="analyserMinPSD" value="-40" min="-100" max="5" step="5"
501501
/>
502502
<label id="analyserMaxPSDLabel" name="analyserMaxPSDLabel" class="onlyFullScreen" >
503503
Max&nbsp;dBm

src/graph_spectrum.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
238238
debounce(100, function () {
239239
const min = parseInt(analyserMinPSD.val());
240240
GraphSpectrumPlot.setMinPSD(min);
241-
analyserLowLevelPSD.val(min).trigger("input");
242241
analyserLowLevelPSD.prop("min", min);
242+
analyserMaxPSD.prop("min", min + 5);
243+
if (analyserLowLevelPSD.val() < min) {
244+
analyserLowLevelPSD.val(min).trigger("input");
245+
}
243246
that.refresh();
244247
}),
245248
).dblclick(function (e) {
@@ -254,7 +257,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
254257
debounce(100, function () {
255258
const max = parseInt(analyserMaxPSD.val());
256259
GraphSpectrumPlot.setMaxPSD(max);
260+
analyserMinPSD.prop("max", max - 5);
257261
analyserLowLevelPSD.prop("max", max);
262+
if (analyserLowLevelPSD.val() > max) {
263+
analyserLowLevelPSD.val(max).trigger("input");
264+
}
258265
that.refresh();
259266
}),
260267
).dblclick(function (e) {

0 commit comments

Comments
 (0)