Skip to content

Commit 8c85509

Browse files
committed
The min and max heatmap PSD values are stored for using
1 parent eb507b3 commit 8c85509

File tree

3 files changed

+17
-14
lines changed

3 files changed

+17
-14
lines changed

src/graph_spectrum.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ import {
44
GraphSpectrumPlot,
55
SPECTRUM_TYPE,
66
SPECTRUM_OVERDRAW_TYPE,
7-
DEFAULT_MIN_DBM_VALUE,
8-
DEFAULT_MAX_DBM_VALUE,
97
} from "./graph_spectrum_plot";
108
import { PrefStorage } from "./pref_storage";
119
import { SpectrumExporter } from "./spectrum-exporter";
@@ -17,7 +15,9 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
1715
ANALYSER_LARGE_WIDTH_MARGIN = 20;
1816

1917
const that = this,
20-
prefs = new PrefStorage();
18+
prefs = new PrefStorage(),
19+
DEFAULT_PSD_HEATMAP_MIN = -40,
20+
DEFAULT_PSD_HEATMAP_MAX = 10;
2121
let analyserZoomX = 1.0 /* 100% */,
2222
analyserZoomY = 1.0 /* 100% */,
2323
dataReload = false,
@@ -232,6 +232,7 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
232232
debounce(100, function () {
233233
const min = parseInt(analyserMinPSD.val());
234234
GraphSpectrumPlot.setMinPSD(min);
235+
saveOneUserSetting("psdHeatmapMin", min);
235236
analyserLowLevelPSD.prop("min", min);
236237
analyserMaxPSD.prop("min", min + 5);
237238
if (analyserLowLevelPSD.val() < min) {
@@ -242,17 +243,19 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
242243
)
243244
.dblclick(function (e) {
244245
if (e.ctrlKey) {
245-
$(this).val(DEFAULT_MIN_DBM_VALUE).trigger("input");
246+
$(this).val(userSettings.psdHeatmapMin).trigger("input");
246247
}
247248
})
248-
.val(DEFAULT_MIN_DBM_VALUE);
249+
.val(userSettings.psdHeatmapMin ?? DEFAULT_PSD_HEATMAP_MIN)
250+
.trigger("input");
249251

250252
analyserMaxPSD
251253
.on(
252254
"input",
253255
debounce(100, function () {
254256
const max = parseInt(analyserMaxPSD.val());
255257
GraphSpectrumPlot.setMaxPSD(max);
258+
saveOneUserSetting("psdHeatmapMax", max);
256259
analyserMinPSD.prop("max", max - 5);
257260
analyserLowLevelPSD.prop("max", max);
258261
if (analyserLowLevelPSD.val() > max) {
@@ -263,10 +266,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
263266
)
264267
.dblclick(function (e) {
265268
if (e.ctrlKey) {
266-
$(this).val(DEFAULT_MAX_DBM_VALUE).trigger("input");
269+
$(this).val(userSettings.psdHeatmapMax).trigger("input");
267270
}
268271
})
269-
.val(DEFAULT_MAX_DBM_VALUE);
272+
.val(userSettings.psdHeatmapMax ?? DEFAULT_PSD_HEATMAP_MAX)
273+
.trigger("input");
270274

271275
analyserLowLevelPSD
272276
.on(

src/graph_spectrum_plot.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ const BLUR_FILTER_PIXEL = 1,
1414
ZOOM_X_MAX = 5,
1515
MAX_SPECTRUM_LINE_COUNT = 30000;
1616

17-
export const DEFAULT_MIN_DBM_VALUE = -40,
18-
DEFAULT_MAX_DBM_VALUE = 10;
19-
2017
export const SPECTRUM_TYPE = {
2118
FREQUENCY: 0,
2219
FREQ_VS_THROTTLE: 1,
@@ -51,9 +48,9 @@ export const GraphSpectrumPlot = window.GraphSpectrumPlot || {
5148
_sysConfig: null,
5249
_zoomX: 1.0,
5350
_zoomY: 1.0,
54-
_minPSD: DEFAULT_MIN_DBM_VALUE,
55-
_maxPSD: DEFAULT_MAX_DBM_VALUE,
56-
_lowLevelPSD: DEFAULT_MIN_DBM_VALUE,
51+
_minPSD: -40,
52+
_maxPSD: 10,
53+
_lowLevelPSD: -40,
5754
_drawingParams: {
5855
fontSizeFrameLabel: "6",
5956
fontSizeFrameLabelFullscreen: "9",

src/user_settings_dialog.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,9 @@ export function UserSettingsDialog(dialog, onLoad, onSave) {
213213
analyserHanning: true, // use a hanning window on the analyser sample data
214214
eraseBackground: true, // Set to false if you want the graph to draw on top of an existing canvas image
215215
spectrumType: 0, // By default, frequency Spectrum
216-
overdrawSpectrumType: 0, // By default, show all filters
216+
overdrawSpectrumType: 0, // By default, show all filters,
217+
psdHeatmapMin: -40,
218+
psdHeatmapMax: 10,
217219
craft: {
218220
left: "15%", // position from left (as a percentage of width)
219221
top: "48%", // position from top (as a percentage of height)

0 commit comments

Comments
 (0)