Change original function to this and you can store :
Freq
Mode
VC level
Squelch
Noise Reduction
CTCSS
Tuning Step Level
function addBookmark() {
const bookmark = {
name: newBookmarkName,
link: link,
frequency: frequencyInputComponent.getFrequency(),
demodulation: demodulation,
volume: volume,
squelch: squelch,
squelchEnable: squelchEnable,
NREnabled: NREnabled,
CTCSSSupressEnabled: CTCSSSupressEnabled,
currentTuneStep: currentTuneStep,
};
frequency = (frequencyInputComponent.getFrequency() / 1e3).toFixed(2);
bookmarks.update((currentBookmarks) => {
const updatedBookmarks = [...currentBookmarks, bookmark];
localStorage.setItem("bookmarks", JSON.stringify(updatedBookmarks));
return updatedBookmarks;
});
newBookmarkName = "";
}
And this next :
function goToBookmark(bookmark) {
// Set frequency
frequencyInputComponent.setFrequency(bookmark.frequency);
handleFrequencyChange({ detail: bookmark.frequency });
// Set demodulation
demodulation = bookmark.demodulation;
handleDemodulationChange(null, true);
// Set Volume
volume = bookmark.volume;
handleVolumeChange();
// Set Squelch
audio.setSquelch(false);
squelch = bookmark.squelch;
squelchEnable = bookmark.squelchEnable;
audio.setSquelch(squelchEnable);
audio.setSquelchThreshold(squelch);
// Set Noise Reduction
audio.decoder.set_nr(false);
NREnabled = bookmark.NREnabled;
audio.decoder.set_nr(NREnabled);
// Set CTCSS
CTCSSSupressEnabled = false
audio.setCTCSSFilter(CTCSSSupressEnabled);
CTCSSSupressEnabled = bookmark.CTCSSSupressEnabled;
audio.setCTCSSFilter(CTCSSSupressEnabled);
// Set Tuning Step
currentTuneStep = bookmark.currentTuneStep;
setStep(currentTuneStep);
// Update the link
updateLink();
}
I HOPE I chased all the bugs but it looks good here so far.
Phil
One more thing:
The users will have to delete their old bookmarks and create new ones.
Phil
Very good work Phil!
May we also have a brightness option to bands buttons, and reset to default when we min-Zoom?
Quote from: Emmanuel SV1BTL on Dec 18, 2024, 01:17 AMVery good work Phil!
May we also have a brightness option to bands buttons, and reset to default when we min-Zoom?
We can do about anything we want to in reality, BUT the next two days for me will be filled with building a new chicken coop for my birds. And Stephen is going to be coding some and may release a new revision.
Phil
Some bugs maybe:
- volume is stored, but at the end of the slider is written unidentified or something like that,
- squelch is stored as expected,
- NR, CTCSS are not stored.
Quote from: Emmanuel SV1BTL on Dec 18, 2024, 01:55 AMSome bugs maybe:
- volume is stored, but at the end of the slider is written unidentified or something like that,
- squelch is stored as expected,
- NR, CTCSS are not stored.
I'm not seeing those errors here Emmanuel. Make you are storing new bookmarks after the compile. Hopefully someone else can chime in with their tests.
Phil
Quote from: Phil -I'm not seeing those errors here Emmanuel. Make you you are storing new bookmarks after the compile. Hopefully someone else can chime in with their tests.
Phil
Yes! It is working. My fault with the copy-paste...
There's a lot more work to do with it, with current band, waterfall settings, etc.
Phill,
I think waterfall brightness is done this way. Please check when you'll be available, maybe you'll find a better way.
https://www.phantomsdr.fun/index.php?topic=110.msg643#msg643
If you want to bookmark waterfall min & max, then this code should do that.
Add to addBookmark() :
min_waterfall: min_waterfall,
max_waterfall: max_waterfall,
and on down add to goToBookmark(bookmark) :
// Set Waterfall brightness
min_waterfall = bookmark.min_waterfall;
max_waterfall = bookmark.max_waterfall;
handleMinMove();
handleMaxMove();
This function update will bookmark everything.
function addBookmark() {
const [currentWaterfallL, currentWaterfallR] = waterfall.getWaterfallRange();
const bookmark = {
name: newBookmarkName,
link: link,
frequency: frequencyInputComponent.getFrequency(),
demodulation: demodulation,
volume: volume,
squelch: squelch,
squelchEnable: squelchEnable,
NREnabled: NREnabled,
ANEnabled: ANEnabled,
NBEnabled: NBEnabled,
CTCSSSupressEnabled: CTCSSSupressEnabled,
currentTuneStep: currentTuneStep,
min_waterfall: min_waterfall,
max_waterfall: max_waterfall,
currentWaterfallR: currentWaterfallR,
currentWaterfallL: currentWaterfallL,
currentColormap: currentColormap,
brightness: brightness,
};
frequency = (frequencyInputComponent.getFrequency() / 1e3).toFixed(2);
bookmarks.update((currentBookmarks) => {
const updatedBookmarks = [...currentBookmarks, bookmark];
localStorage.setItem("bookmarks", JSON.stringify(updatedBookmarks));
return updatedBookmarks;
});
newBookmarkName = "";
}
Then
function goToBookmark(bookmark) {
// Set frequency
frequencyInputComponent.setFrequency(bookmark.frequency);
handleFrequencyChange({ detail: bookmark.frequency });
// Set demodulation
demodulation = bookmark.demodulation;
handleDemodulationChange(null, true);
// Set Volume
volume = bookmark.volume;
handleVolumeChange();
// Set Squelch
audio.setSquelch(false);
squelch = bookmark.squelch;
squelchEnable = bookmark.squelchEnable;
audio.setSquelch(squelchEnable);
audio.setSquelchThreshold(squelch);
// Set Noise Reduction
audio.decoder.set_nr(false);
NREnabled = bookmark.NREnabled;
audio.decoder.set_nr(NREnabled);
// Set Noise Blanker
audio.decoder.set_nb(false);
NBEnabled = bookmark.NBEnabled;
audio.decoder.set_nb(NBEnabled);
// Set Auto Notch
audio.decoder.set_an(false);
ANEnabled = bookmark.ANEnabled;
audio.decoder.set_an(ANEnabled);
// Set CTCSS
CTCSSSupressEnabled = false;
audio.setCTCSSFilter(CTCSSSupressEnabled);
CTCSSSupressEnabled = bookmark.CTCSSSupressEnabled;
audio.setCTCSSFilter(CTCSSSupressEnabled);
// Set Tuning Step
currentTuneStep = bookmark.currentTuneStep;
setStep(currentTuneStep);
// Set Waterfall brightness
min_waterfall = bookmark.min_waterfall;
max_waterfall = bookmark.max_waterfall;
brightness = bookmark.brightness;
handleMinMove();
handleMaxMove();
handleBrightnessMove();
// Set Waterfall Size
let [l, m, r] = audio.getAudioRange();
const [waterfallL, waterfallR] = waterfall.getWaterfallRange();
const offset = ((m - waterfallL) / (waterfallR - waterfallL)) * waterfall.canvasWidth;
m = Math.min(waterfall.waterfallMaxSize - 512, Math.max(512, m));
l = bookmark.currentWaterfallL;
r = bookmark.currentWaterfallR;
waterfall.setWaterfallRange(l, r);
frequencyMarkerComponent.updateFrequencyMarkerPositions();
updatePassband();
// Set Waterfall Colormap
currentColormap = bookmark.currentColormap;
waterfall.setColormap(currentColormap);
// Update the link
updateLink();
}