Merge branch 'develop' into daylight-scheduler

This commit is contained in:
Jakob Ketterl 2020-01-25 23:53:10 +01:00
commit 840f624b21
7 changed files with 141 additions and 53 deletions

View File

@ -23,6 +23,6 @@ apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
git clone https://github.com/jketterl/owrx_connector.git git clone https://github.com/jketterl/owrx_connector.git
cmakebuild owrx_connector 84909c53cde78cbf4be408037e31209fbc702ad3 cmakebuild owrx_connector df35e33e42c2e4527853ca18bf04981848860317
apk del .build-deps apk del .build-deps

View File

@ -24,6 +24,6 @@ apk add --no-cache $STATIC_PACKAGES
apk add --no-cache --virtual .build-deps $BUILD_PACKAGES apk add --no-cache --virtual .build-deps $BUILD_PACKAGES
git clone https://github.com/pothosware/SoapySDR git clone https://github.com/pothosware/SoapySDR
cmakebuild SoapySDR a489f3dca9d3ccd9b276b95a608ac3ef0299f635 cmakebuild SoapySDR f722f9ce5b629c3c44401a9bf628b3f8e67a9695
apk del .build-deps apk del .build-deps

View File

@ -38,7 +38,7 @@ git clone https://github.com/szechyjs/mbelib.git
cmakebuild mbelib 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f cmakebuild mbelib 9a04ed5c78176a9965f3d43f7aa1b1f5330e771f
git clone https://github.com/jketterl/digiham.git git clone https://github.com/jketterl/digiham.git
cmakebuild digiham b229990927922e977cecaa9369740790cff5c31e cmakebuild digiham e5e11ce9611e3d8f5f9dce7dee97f86a31af107c
git clone https://github.com/f4exb/dsd.git git clone https://github.com/f4exb/dsd.git
cmakebuild dsd f6939f9edbbc6f66261833616391a4e59cb2b3d7 cmakebuild dsd f6939f9edbbc6f66261833616391a4e59cb2b3d7

View File

@ -311,16 +311,25 @@ input[type=range]:focus::-ms-fill-upper
font-style: normal; font-style: normal;
} }
#webrx-actual-freq #webrx-actual-freq {
{
width: 100%; width: 100%;
text-align: left; text-align: left;
font-size: 16pt;
font-family: 'roboto-mono';
padding: 0; padding: 0;
margin: 0; margin: 0;
line-height:22px; }
#webrx-actual-freq input {
font-family: 'roboto-mono';
width: 98%;
box-sizing: border-box;
border: 0;
padding: 0;
}
#webrx-actual-freq, #webrx-actual-freq input {
font-size: 16pt;
font-family: 'roboto-mono';
line-height: 22px;
} }
#webrx-mouse-freq #webrx-mouse-freq

View File

@ -144,8 +144,8 @@
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" style="width: 259px;"> <div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" style="width: 259px;">
<div class="openwebrx-panel-line frequencies-container"> <div class="openwebrx-panel-line frequencies-container">
<div class="frequencies"> <div class="frequencies">
<div id="webrx-actual-freq">---.--- MHz</div> <div id="webrx-actual-freq"></div>
<div id="webrx-mouse-freq">---.--- MHz</div> <div id="webrx-mouse-freq"></div>
</div> </div>
<div class="openwebrx-button openwebrx-square-button openwebrx-bookmark-button" style="display:none;" title="Add bookmark..."> <div class="openwebrx-button openwebrx-square-button openwebrx-bookmark-button" style="display:none;" title="Add bookmark...">
<img src="static/gfx/openwebrx-bookmark.png"> <img src="static/gfx/openwebrx-bookmark.png">

View File

@ -1,12 +1,17 @@
function FrequencyDisplay(element) { function FrequencyDisplay(element) {
this.element = $(element); this.element = $(element);
this.digits = []; this.digits = [];
this.digitContainer = $('<span>'); this.setupElements();
this.element.html([this.digitContainer, $('<span> MHz</span>')]);
this.decimalSeparator = (0.1).toLocaleString().substring(1, 2);
this.setFrequency(0); this.setFrequency(0);
} }
FrequencyDisplay.prototype.setupElements = function() {
this.displayContainer = $('<div>');
this.digitContainer = $('<span>');
this.displayContainer.html([this.digitContainer, $('<span> MHz</span>')]);
this.element.html(this.displayContainer);
};
FrequencyDisplay.prototype.setFrequency = function(freq) { FrequencyDisplay.prototype.setFrequency = function(freq) {
this.frequency = freq; this.frequency = freq;
var formatted = (freq / 1e6).toLocaleString(undefined, {maximumFractionDigits: 4, minimumFractionDigits: 4}); var formatted = (freq / 1e6).toLocaleString(undefined, {maximumFractionDigits: 4, minimumFractionDigits: 4});
@ -36,9 +41,18 @@ function TuneableFrequencyDisplay(element) {
TuneableFrequencyDisplay.prototype = new FrequencyDisplay(); TuneableFrequencyDisplay.prototype = new FrequencyDisplay();
TuneableFrequencyDisplay.prototype.setupElements = function() {
FrequencyDisplay.prototype.setupElements.call(this);
this.input = $('<input>');
this.input.hide();
this.element.append(this.input);
};
TuneableFrequencyDisplay.prototype.setupEvents = function() { TuneableFrequencyDisplay.prototype.setupEvents = function() {
var me = this; var me = this;
this.element.on('wheel', function(e){ me.listeners = [];
me.element.on('wheel', function(e){
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
@ -53,7 +67,29 @@ TuneableFrequencyDisplay.prototype.setupEvents = function() {
l(newFrequency); l(newFrequency);
}); });
}); });
this.listeners = [];
var submit = function(){
var freq = parseInt(me.input.val());
if (!isNaN(freq)) {
me.listeners.forEach(function(l) {
l(freq);
});
}
me.input.hide();
me.displayContainer.show();
};
me.input.on('blur', submit).on('keyup', function(e){
if (e.keyCode == 13) return submit();
});
me.input.on('click', function(e){
e.stopPropagation();
});
me.element.on('click', function(){
me.input.val(me.frequency);
me.input.show();
me.displayContainer.hide();
me.input.focus();
});
}; };
TuneableFrequencyDisplay.prototype.onFrequencyChange = function(listener){ TuneableFrequencyDisplay.prototype.onFrequencyChange = function(listener){

View File

@ -549,6 +549,7 @@ function demodulator_analog_replace(subtype, for_digital) { //this function shou
secondary_demod_close_window(); secondary_demod_close_window();
secondary_demod_listbox_update(); secondary_demod_listbox_update();
} }
if (!demodulators || !demodulators[0] || demodulators[0].subtype !== subtype) {
last_analog_demodulator_subtype = subtype; last_analog_demodulator_subtype = subtype;
var temp_offset = 0; var temp_offset = 0;
if (demodulators.length) { if (demodulators.length) {
@ -556,8 +557,10 @@ function demodulator_analog_replace(subtype, for_digital) { //this function shou
demodulator_remove(0); demodulator_remove(0);
} }
demodulator_add(new Demodulator_default_analog(temp_offset, subtype)); demodulator_add(new Demodulator_default_analog(temp_offset, subtype));
}
demodulator_buttons_update(); demodulator_buttons_update();
update_digitalvoice_panels("openwebrx-panel-metadata-" + subtype); update_digitalvoice_panels("openwebrx-panel-metadata-" + subtype);
updateHash();
} }
Demodulator.prototype.set_offset_frequency = function(to_what) { Demodulator.prototype.set_offset_frequency = function(to_what) {
@ -566,6 +569,11 @@ Demodulator.prototype.set_offset_frequency = function(to_what) {
this.set(); this.set();
mkenvelopes(get_visible_freq_range()); mkenvelopes(get_visible_freq_range());
tunedFrequencyDisplay.setFrequency(center_freq + to_what); tunedFrequencyDisplay.setFrequency(center_freq + to_what);
updateHash();
}
Demodulator.prototype.get_offset_frequency = function() {
return this.offset_frequency;
} }
function waterfallWidth() { function waterfallWidth() {
@ -1050,8 +1058,11 @@ function on_ws_recv(evt) {
waterfall_auto_level_margin = config['waterfall_auto_level_margin']; waterfall_auto_level_margin = config['waterfall_auto_level_margin'];
waterfallColorsDefault(); waterfallColorsDefault();
starting_mod = config['start_mod']; var initial_demodulator_params = {
starting_offset_frequency = config['start_offset_freq']; mod: config['start_mod'],
offset_frequency: config['start_offset_freq']
};
bandwidth = config['samp_rate']; bandwidth = config['samp_rate'];
center_freq = config['center_freq']; center_freq = config['center_freq'];
fft_size = config['fft_size']; fft_size = config['fft_size'];
@ -1067,7 +1078,7 @@ function on_ws_recv(evt) {
updateSquelch(); updateSquelch();
waterfall_init(); waterfall_init();
initialize_demodulator(); initialize_demodulator(initial_demodulator_params);
bookmarks.loadLocalBookmarks(); bookmarks.loadLocalBookmarks();
waterfall_clear(); waterfall_clear();
@ -1489,28 +1500,52 @@ function webrx_set_param(what, value) {
ws.send(JSON.stringify({"type": "dspcontrol", "params": params})); ws.send(JSON.stringify({"type": "dspcontrol", "params": params}));
} }
var starting_offset_frequency;
var starting_mod;
function parseHash() { function parseHash() {
var h; if (!window.location.hash) {
if (h = window.location.hash) { return {};
h.substring(1).split(",").forEach(function (x) {
var harr = x.split("=");
if (harr[0] === "mute") toggleMute();
else if (harr[0] === "mod") starting_mod = harr[1];
else if (harr[0] === "sql") {
e("openwebrx-panel-squelch").value = harr[1];
updateSquelch();
} }
else if (harr[0] === "freq") { return window.location.hash.substring(1).split(",").map(function(x) {
console.log(parseInt(harr[1])); var harr = x.split('=');
console.log(center_freq); return [harr[0], harr.slice(1).join('=')];
starting_offset_frequency = parseInt(harr[1]) - center_freq; }).reduce(function(params, p){
} params[p[0]] = p[1];
}); return params;
}, {});
}
function validateHash() {
var params = parseHash();
params = Object.keys(params).filter(function(key) {
if (key == 'freq') {
return Math.abs(params[key] - center_freq) < bandwidth;
} }
return true;
}).reduce(function(p, key) {
p[key] = params[key];
return p;
}, {});
if (params['freq']) {
params['offset_frequency'] = params['freq'] - center_freq;
delete params['freq'];
}
return params;
}
function updateHash() {
var demod = demodulators[0];
if (!demod) return;
window.location.hash = $.map({
freq: demod.get_offset_frequency() + center_freq,
mod: demod.subtype,
secondary_mod: secondary_demod
}, function(value, key){
if (!value) return undefined;
return key + '=' + value;
}).filter(function(v) {
return !!v;
}).join(',');
} }
function onAudioStart(success, apiType){ function onAudioStart(success, apiType){
@ -1528,13 +1563,16 @@ function onAudioStart(success, apiType){
updateVolume(); updateVolume();
} }
function initialize_demodulator() { function initialize_demodulator(initialParams) {
demodulator_analog_replace(starting_mod);
if (starting_offset_frequency) {
demodulators[0].offset_frequency = starting_offset_frequency;
tunedFrequencyDisplay.setFrequency(center_freq + starting_offset_frequency);
demodulators[0].set();
mkscale(); mkscale();
var params = $.extend(initialParams || {}, validateHash());
if (params.secondary_mod) {
demodulator_digital_replace(params.secondary_mod);
} else if (params.mod) {
demodulator_analog_replace(params.mod);
}
if (params.offset_frequency) {
demodulators[0].set_offset_frequency(params.offset_frequency);
} }
} }
@ -1794,8 +1832,10 @@ function openwebrx_init() {
check_top_bar_congestion(); check_top_bar_congestion();
init_header(); init_header();
bookmarks = new BookmarkBar(); bookmarks = new BookmarkBar();
parseHash();
initSliders(); initSliders();
window.addEventListener('hashchange', function() {
initialize_demodulator();
});
} }
function initSliders() { function initSliders() {
@ -1920,6 +1960,7 @@ function initPanels() {
function demodulator_buttons_update() { function demodulator_buttons_update() {
$(".openwebrx-demodulator-button").removeClass("highlighted"); $(".openwebrx-demodulator-button").removeClass("highlighted");
if (!demodulators.length) return;
if (secondary_demod) { if (secondary_demod) {
$("#openwebrx-button-dig").addClass("highlighted"); $("#openwebrx-button-dig").addClass("highlighted");
$('#openwebrx-secondary-demod-listbox').val(secondary_demod); $('#openwebrx-secondary-demod-listbox').val(secondary_demod);
@ -1982,6 +2023,7 @@ function demodulator_digital_replace_last() {
} }
function demodulator_digital_replace(subtype) { function demodulator_digital_replace(subtype) {
if (secondary_demod === subtype) return;
switch (subtype) { switch (subtype) {
case "bpsk31": case "bpsk31":
case "bpsk63": case "bpsk63":
@ -2019,6 +2061,7 @@ function demodulator_digital_replace(subtype) {
toggle_panel("openwebrx-panel-wsjt-message", ['ft8', 'wspr', 'jt65', 'jt9', 'ft4'].indexOf(subtype) >= 0); toggle_panel("openwebrx-panel-wsjt-message", ['ft8', 'wspr', 'jt65', 'jt9', 'ft4'].indexOf(subtype) >= 0);
toggle_panel("openwebrx-panel-packet-message", subtype === "packet"); toggle_panel("openwebrx-panel-packet-message", subtype === "packet");
toggle_panel("openwebrx-panel-pocsag-message", subtype === "pocsag"); toggle_panel("openwebrx-panel-pocsag-message", subtype === "pocsag");
updateHash();
} }
function secondary_demod_create_canvas() { function secondary_demod_create_canvas() {