sdr profile selection frontend

This commit is contained in:
Jakob Ketterl
2019-05-10 16:14:16 +02:00
parent 1cf4a879f7
commit 7427fa3608
6 changed files with 118 additions and 23 deletions

View File

@ -82,6 +82,10 @@
<div class="openwebrx-panel" id="openwebrx-panel-receiver" data-panel-name="client-params" data-panel-pos="right" data-panel-order="0" data-panel-size="259,115">
<div id="webrx-actual-freq">---.--- MHz</div>
<div id="webrx-mouse-freq">---.--- MHz</div>
<div class="openwebrx-panel-line">
<select id="openwebrx-sdr-profiles-listbox" onchange="sdr_profile_changed();">
</select>
</div>
<div class="openwebrx-panel-line">
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-nfm"
onclick="demodulator_analog_replace('nfm');">FM</div>

View File

@ -790,10 +790,7 @@ img.openwebrx-mirror-img
transition: width 500ms, left 500ms;
}
#openwebrx-secondary-demod-listbox
{
width: 201px;
height: 27px;
.openwebrx-panel select {
border-radius: 5px;
background-color: #373737;
color: White;
@ -805,16 +802,27 @@ img.openwebrx-mirror-img
border-color: transparent;
border-width: 0px;
-moz-appearance: none;
padding-left:3px;
}
#openwebrx-secondary-demod-listbox option
{
.openwebrx-panel select option {
border-width: 0px;
background-color: #373737;
color: White;
}
#openwebrx-secondary-demod-listbox
{
width: 201px;
height: 27px;
padding-left:3px;
}
#openwebrx-sdr-profiles-listbox {
width: 100%;
font-size: 10pt;
height: 27px;
}
#openwebrx-cursor-blink
{
animation: cursor-blink 1s infinite;

View File

@ -1208,6 +1208,12 @@ function on_ws_recv(evt)
var server_cpu_usage = json.value;
progressbar_set(e("openwebrx-bar-server-cpu"),server_cpu_usage/100,"Server CPU [" + server_cpu_usage + "%]",server_cpu_usage>85);
break;
case "profiles":
var listbox = e("openwebrx-sdr-profiles-listbox");
listbox.innerHTML = json.value.map(function(profile){
return '<option value="' + profile.id + '">' + profile.name + "</option>";
}).join("");
break;
default:
console.warn('received message of unknown type: ' + json.type);
}
@ -2749,3 +2755,8 @@ function secondary_demod_waterfall_set_zoom(low_cut, high_cut)
secondary_demod_canvases.map((x)=>{$(x).css("left",secondary_demod_canvas_left+"px").css("width",secondary_demod_canvas_width+"px");});
secondary_demod_update_channel_freq_from_event();
}
function sdr_profile_changed() {
value = $('#openwebrx-sdr-profiles-listbox').val();
ws.send(JSON.stringify({ type:"selectprofile", params:{ profile:value }}));
}