dial frequencies as bookmarks

This commit is contained in:
Jakob Ketterl 2019-10-12 17:14:28 +02:00
parent 378c574eed
commit 98217b1745
3 changed files with 22 additions and 2 deletions

View File

@ -243,6 +243,14 @@ input[type=range]:focus::-ms-fill-upper
border-top-color: #0FF; border-top-color: #0FF;
} }
#openwebrx-bookmarks-container .bookmark[data-source=dial_frequencies] {
background-color: #0F0;
}
#openwebrx-bookmarks-container .bookmark[data-source=dial_frequencies]:after {
border-top-color: #0F0;
}
#webrx-canvas-container #webrx-canvas-container
{ {
position: relative; position: relative;

View File

@ -8,9 +8,13 @@ function BookmarkBar() {
var $bookmark = $(e.target).closest('.bookmark'); var $bookmark = $(e.target).closest('.bookmark');
me.$container.find('.bookmark').removeClass('selected'); me.$container.find('.bookmark').removeClass('selected');
var b = $bookmark.data(); var b = $bookmark.data();
if (!b || !b.frequency || !b.modulation) return; if (!b || !b.frequency || (!b.modulation && !b.digital_modulation)) return;
demodulator_set_offset_frequency(0, b.frequency - center_freq); demodulator_set_offset_frequency(0, b.frequency - center_freq);
demodulator_analog_replace(b.modulation); if (b.modulation) {
demodulator_analog_replace(b.modulation);
} else if (b.digital_modulation) {
demodulator_digital_replace(b.digital_modulation);
}
$bookmark.addClass('selected'); $bookmark.addClass('selected');
}); });

View File

@ -1261,6 +1261,14 @@ function on_ws_recv(evt)
case "dial_frequencies": case "dial_frequencies":
dial_frequencies = json.value; dial_frequencies = json.value;
update_dial_button(); update_dial_button();
var as_bookmarks = dial_frequencies.map(function(d){
return {
name: d.mode.toUpperCase(),
digital_modulation: d.mode,
frequency: d.frequency
};
});
bookmarks.replace_bookmarks(as_bookmarks, 'dial_frequencies');
break; break;
case "aprs_data": case "aprs_data":
update_packet_panel(json.value); update_packet_panel(json.value);