From d43c8e6ae9c46edabc3de86f3345defe107c98f6 Mon Sep 17 00:00:00 2001 From: Marat Fayzullin Date: Thu, 31 Oct 2024 21:11:39 -0400 Subject: [PATCH] Removing default underlying modulation from initial bookmark. --- htdocs/lib/BookmarkBar.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/htdocs/lib/BookmarkBar.js b/htdocs/lib/BookmarkBar.js index ffcc06ed..be387ccf 100644 --- a/htdocs/lib/BookmarkBar.js +++ b/htdocs/lib/BookmarkBar.js @@ -108,8 +108,16 @@ BookmarkBar.prototype.showEditDialog = function(bookmark) { if (!bookmark) { var mode1 = this.getDemodulator().get_secondary_demod() var mode2 = this.getDemodulator().get_modulation(); - // if no secondary demod, use the primary one - if (!mode1) { mode1 = mode2; mode2 = ''; } + if (!mode2) mode2 = ''; + if (!mode1) { + // if no secondary demod, use the primary one + mode1 = mode2; + mode2 = ''; + } else { + // check for default underlying demod + var m = Modes.findByModulation(mode1); + if (m && m.underlying.indexOf(mode2) == 0) mode2 = ''; + } bookmark = { name: '', frequency: center_freq + this.getDemodulator().get_offset_frequency(), @@ -118,7 +126,6 @@ BookmarkBar.prototype.showEditDialog = function(bookmark) { description: '', scannable : this.modesToScan.indexOf(mode1) >= 0 } - this.sanitizeBookmark(bookmark); } this.$dialog.bookmarkDialog().setValues(bookmark); this.$dialog.show(); @@ -149,9 +156,6 @@ BookmarkBar.prototype.sanitizeBookmark = function(b) { return "Must not have underlying modulation."; else if (mode.underlying.indexOf(b.underlying) < 0) return "Must have valid underlying modulation."; - else if (mode.underlying.indexOf(b.underlying) == 0) - // default underlying modulation - b.underlying = ''; return null; };