Skip to content

The min and max heatmap PSD values settings are stored for continous using #843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 30, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/graph_spectrum.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import {
GraphSpectrumPlot,
SPECTRUM_TYPE,
SPECTRUM_OVERDRAW_TYPE,
DEFAULT_MIN_DBM_VALUE,
DEFAULT_MAX_DBM_VALUE,
} from "./graph_spectrum_plot";
import { PrefStorage } from "./pref_storage";
import { SpectrumExporter } from "./spectrum-exporter";
Expand All @@ -17,7 +15,9 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
ANALYSER_LARGE_WIDTH_MARGIN = 20;

const that = this,
prefs = new PrefStorage();
prefs = new PrefStorage(),
DEFAULT_PSD_HEATMAP_MIN = -40,
DEFAULT_PSD_HEATMAP_MAX = 10;
let analyserZoomX = 1.0 /* 100% */,
analyserZoomY = 1.0 /* 100% */,
dataReload = false,
Expand Down Expand Up @@ -232,6 +232,7 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
debounce(100, function () {
const min = parseInt(analyserMinPSD.val());
GraphSpectrumPlot.setMinPSD(min);
saveOneUserSetting("psdHeatmapMin", min);
analyserLowLevelPSD.prop("min", min);
analyserMaxPSD.prop("min", min + 5);
if (analyserLowLevelPSD.val() < min) {
Expand All @@ -242,17 +243,19 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
)
.dblclick(function (e) {
if (e.ctrlKey) {
$(this).val(DEFAULT_MIN_DBM_VALUE).trigger("input");
$(this).val(userSettings.psdHeatmapMin).trigger("input");
}
})
.val(DEFAULT_MIN_DBM_VALUE);
.val(userSettings.psdHeatmapMin ?? DEFAULT_PSD_HEATMAP_MIN)
.trigger("input");

analyserMaxPSD
.on(
"input",
debounce(100, function () {
const max = parseInt(analyserMaxPSD.val());
GraphSpectrumPlot.setMaxPSD(max);
saveOneUserSetting("psdHeatmapMax", max);
analyserMinPSD.prop("max", max - 5);
analyserLowLevelPSD.prop("max", max);
if (analyserLowLevelPSD.val() > max) {
Expand All @@ -263,10 +266,11 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
)
.dblclick(function (e) {
if (e.ctrlKey) {
$(this).val(DEFAULT_MAX_DBM_VALUE).trigger("input");
$(this).val(userSettings.psdHeatmapMax).trigger("input");
}
})
.val(DEFAULT_MAX_DBM_VALUE);
.val(userSettings.psdHeatmapMax ?? DEFAULT_PSD_HEATMAP_MAX)
.trigger("input");

analyserLowLevelPSD
.on(
Expand All @@ -282,7 +286,8 @@ export function FlightLogAnalyser(flightLog, canvas, analyserCanvas) {
$(this).val(analyserMinPSD.val()).trigger("input");
}
})
.val(analyserMinPSD.val());
.val(analyserMinPSD.val())
.trigger("input");

// Spectrum type to show
userSettings.spectrumType =
Expand Down
10 changes: 4 additions & 6 deletions src/graph_spectrum_plot.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ const BLUR_FILTER_PIXEL = 1,
ZOOM_X_MAX = 5,
MAX_SPECTRUM_LINE_COUNT = 30000;

export const DEFAULT_MIN_DBM_VALUE = -40,
DEFAULT_MAX_DBM_VALUE = 10;

export const SPECTRUM_TYPE = {
FREQUENCY: 0,
FREQ_VS_THROTTLE: 1,
Expand Down Expand Up @@ -51,9 +48,10 @@ export const GraphSpectrumPlot = window.GraphSpectrumPlot || {
_sysConfig: null,
_zoomX: 1.0,
_zoomY: 1.0,
_minPSD: DEFAULT_MIN_DBM_VALUE,
_maxPSD: DEFAULT_MAX_DBM_VALUE,
_lowLevelPSD: DEFAULT_MIN_DBM_VALUE,
// _minPSD, _maxPSD, _lowLevelPSD will initialize later in FlightLogAnalyser from stored settings
_minPSD: 0,
_maxPSD: 0,
_lowLevelPSD: 0,
_drawingParams: {
fontSizeFrameLabel: "6",
fontSizeFrameLabelFullscreen: "9",
Expand Down
2 changes: 2 additions & 0 deletions src/user_settings_dialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ export function UserSettingsDialog(dialog, onLoad, onSave) {
eraseBackground: true, // Set to false if you want the graph to draw on top of an existing canvas image
spectrumType: 0, // By default, frequency Spectrum
overdrawSpectrumType: 0, // By default, show all filters
psdHeatmapMin: -40,
psdHeatmapMax: 10,
craft: {
left: "15%", // position from left (as a percentage of width)
top: "48%", // position from top (as a percentage of height)
Expand Down