Added tune-by-squelch, extended keyboard shortcuts and help page.

This commit is contained in:
Marat Fayzullin 2024-09-29 23:23:27 -04:00
parent e75e424873
commit daec4bf9a4
3 changed files with 75 additions and 21 deletions

View File

@ -3,9 +3,9 @@
#ks-overlay {
position: fixed;
top: 5vh;
top: 1vh;
left: calc((100vw - 800px) / 2);
max-height: 90vh;
max-height: 95vh;
width: 800px;
color: white;
background-color: #000;
@ -22,7 +22,7 @@
.ks-title {
font-weight: bold;
font-size: 1.5rem;
margin-top: 1rem;
margin-top: 0.8rem;
}
.ks-subtitle {

View File

@ -33,7 +33,7 @@ Shortcuts.init = function(target) {
<div class="ks-item">
<div class="ks-item-txt">change tuning step</div>
<div class="ks-item-kbd">${this.keycap('[')}|${this.keycap(']')}</div>
<div class="ks-item-kbd">${this.keycap('{')}|${this.keycap('}')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">change volume</div>
@ -44,6 +44,19 @@ Shortcuts.init = function(target) {
<div class="ks-item-kbd">${this.keycap('Space')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">toggle noise reduction</div>
<div class="ks-item-kbd">${this.keycap('N')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">adjust bandpass offset</div>
<div class="ks-item-kbd">${this.keycap('Shift')}+${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">adjust bandpass width</div>
<div class="ks-item-kbd">${this.keycap('Shift')}+${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">auto-set squelch</div>
<div class="ks-item-kbd">${this.keycap('A')}</div>
@ -62,17 +75,17 @@ Shortcuts.init = function(target) {
<div class="ks-item-kbd">${this.keycap('S')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">adjust bandpass offset</div>
<div class="ks-item-kbd">${this.keycap('Shift')}+${this.keycap('ArrowLeft')}|${this.keycap('ArrowRight')}</div>
<div class="ks-item-txt">tune by squelch</div>
<div class="ks-item-kbd">${this.keycap('[')}|${this.keycap(']')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">adjust bandpass width</div>
<div class="ks-item-kbd">${this.keycap('Shift')}+${this.keycap('ArrowUp')}|${this.keycap('ArrowDown')}</div>
<div class="ks-item-txt">side-step current profile</div>
<div class="ks-item-kbd">${this.keycap('PageDown')}|${this.keycap('PageUp')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">toggle noise reduction</div>
<div class="ks-item-kbd">${this.keycap('N')}</div>
<div class="ks-item-txt">show this help panel</div>
<div class="ks-item-kbd">${this.keycap('?')}</div>
</div>
<div class="ks-item">
<div class="ks-item-txt">adjust waterfall min level</div>
@ -230,13 +243,35 @@ Shortcuts.handleKey = function(event) {
break;
case 'pagedown':
// PageDown: Shift central frequency down (if allowed)
jumpBySteps(-1);
break;
case 'pageup':
// PageUp: Shift central frequency up (if allowed)
jumpBySteps(1);
break;
case '[':
// [: Tune to a previous signal, by squelch
tuneBySquelch(-1);
break;
case ']':
// ]: Tune to a next signal, by squelch
tuneBySquelch(1);
break;
case '{':
// {: Decrease tuning step
this.moveSelector('#openwebrx-tuning-step-listbox', -1);
break;
case '}':
// }: Increase tuning step
this.moveSelector('#openwebrx-tuning-step-listbox', 1);
break;
case '1': case '2': case '3': case '4': case '5':
case '6': case '7': case '8': case '9': case '0':
// [CTRL+]0-9: Select modulation
@ -247,16 +282,6 @@ Shortcuts.handleKey = function(event) {
if (n < $modes.length) $modes[n].click();
break;
case '[': case '{':
// [: Decrease tuning step
this.moveSelector('#openwebrx-tuning-step-listbox', -1);
break;
case ']': case '}':
// ]: Increase tuning step
this.moveSelector('#openwebrx-tuning-step-listbox', 1);
break;
case 'a':
// A: Set squelch automatically
$('.openwebrx-squelch-auto').click();
@ -351,6 +376,7 @@ Shortcuts.handleKey = function(event) {
break;
case '/': case '?':
// ?: Show keyboard shortcuts help
Shortcuts.overlay.slideToggle(100);
break;

View File

@ -39,7 +39,7 @@ var bandplan = null;
var scanner = null;
var bookmarks = null;
var audioEngine = null;
var waterfall_last = null;
function zoomInOneStep() {
zoom_set(zoom_level + 1);
@ -66,6 +66,32 @@ function tuneBySteps(steps) {
}
}
function tuneBySquelch(dir) {
// Must have a copy of the last received waterfall
if (waterfall_last == null) return;
// Get current squelch threshold from the slider
// (why do we need to subtract ~13dB here to make FFT match the S-meter?)
var $slider = $('#openwebrx-panel-receiver .openwebrx-squelch-slider');
var squelch = $slider.val() - 13.0;
// Start from the current offset within the waterfall
var demodulator = $('#openwebrx-panel-receiver').demodulatorPanel().getDemodulator();
var f = demodulator.get_offset_frequency();
// Scan up or down the waterfall
dir = tuning_step * (dir>=0? 1 : -1);
for(f += dir ; ; f += dir) {
var i = Math.round(waterfall_last.length * (f / bandwidth + 0.5));
if (i < 0 || i >= waterfall_last.length) {
break;
} else if (waterfall_last[i] >= squelch) {
demodulator.set_offset_frequency(f);
break;
}
}
}
function jumpBySteps(steps) {
steps = Math.round(steps);
if (steps != 0) {
@ -1105,6 +1131,8 @@ function on_ws_recv(evt) {
spectrum.update(waterfall_f32);
// Feed scanner with data
scanner.update(waterfall_f32);
// Save waterfall for squelch-based tuning
waterfall_last = waterfall_f32;
break;
case 2:
// audio data