Skip to content

Commit 4e04ee5

Browse files
committed
Improved PSD range values validation logic
1 parent 6cd8ef9 commit 4e04ee5

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
@@ -239,8 +239,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
239239
debounce(100, function () {
240240
const min = parseInt(analyserMinPSD.val());
241241
GraphSpectrumPlot.setMinPSD(min);
242-
analyserLowLevelPSD.val(min).trigger("input");
243242
analyserLowLevelPSD.prop("min", min);
243+
analyserMaxPSD.prop("min", min + 5);
244+
if (analyserLowLevelPSD.val() < min) {
245+
analyserLowLevelPSD.val(min).trigger("input");
246+
}
244247
that.refresh();
245248
}),
246249
).dblclick(function (e) {
@@ -255,7 +258,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
255258
debounce(100, function () {
256259
const max = parseInt(analyserMaxPSD.val());
257260
GraphSpectrumPlot.setMaxPSD(max);
261+
analyserMinPSD.prop("max", max - 5);
258262
analyserLowLevelPSD.prop("max", max);
263+
if (analyserLowLevelPSD.val() > max) {
264+
analyserLowLevelPSD.val(max).trigger("input");
265+
}
259266
that.refresh();
260267
}),
261268
).dblclick(function (e) {

0 commit comments

Comments
 (0)