From ea9feeefd2239c14ee15f1b3afa44af03ce62af0 Mon Sep 17 00:00:00 2001 From: Jakob Ketterl Date: Sat, 20 Jul 2019 19:53:42 +0200 Subject: [PATCH] complete dial frequency feature frontend --- htdocs/css/openwebrx.css | 16 +++++++++++++++- htdocs/index.html | 10 ++++++++++ htdocs/openwebrx.js | 28 ++++++++++++++++++++++++++++ 3 files changed, 53 insertions(+), 1 deletion(-) diff --git a/htdocs/css/openwebrx.css b/htdocs/css/openwebrx.css index 91e03e8..cd1498b 100644 --- a/htdocs/css/openwebrx.css +++ b/htdocs/css/openwebrx.css @@ -364,6 +364,20 @@ input[type=range]:focus::-ms-fill-upper text-align: center; } +.openwebrx-dial-button svg { + width: 19px; + height: 19px; + vertical-align: bottom; +} + +.openwebrx-dial-button #ph_dial { + fill: #888; +} + +.openwebrx-dial-button.available #ph_dial { + fill: #FFF; +} + .openwebrx-square-button img { height: 27px; @@ -602,7 +616,7 @@ img.openwebrx-mirror-img #openwebrx-secondary-demod-listbox { - width: 201px; + width: 174px; height: 27px; padding-left:3px; } diff --git a/htdocs/index.html b/htdocs/index.html index e2b8010..bcd410e 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -86,6 +86,16 @@ +
+ + + + + + + + +
diff --git a/htdocs/openwebrx.js b/htdocs/openwebrx.js index be79ee5..631b322 100644 --- a/htdocs/openwebrx.js +++ b/htdocs/openwebrx.js @@ -1249,6 +1249,10 @@ function on_ws_recv(evt) case "wsjt_message": update_wsjt_panel(json.value); break; + case "dial_frequencies": + dial_frequencies = json.value; + update_dial_button(); + break; default: console.warn('received message of unknown type: ' + json.type); } @@ -1314,6 +1318,29 @@ function on_ws_recv(evt) } } +var dial_frequencies = []; + +function find_dial_frequencies() { + var sdm = $("#openwebrx-secondary-demod-listbox")[0].value; + return dial_frequencies.filter(function(d){ + return d.mode == sdm; + }); +} + +function update_dial_button() { + var available = find_dial_frequencies(); + $("#openwebrx-secondary-demod-dial-button")[available.length ? "addClass" : "removeClass"]("available"); +} + +function dial_button_click() { + var available = find_dial_frequencies(); + if (!available.length) return; + var frequency = available[0].frequency; + console.info(frequency); + demodulator_set_offset_frequency(0, frequency - center_freq); + $("#webrx-actual-freq").html(format_frequency("{x} MHz", frequency, 1e6, 4)); +} + function update_metadata(meta) { if (meta.protocol) switch (meta.protocol) { case 'DMR': @@ -2897,6 +2924,7 @@ function secondary_demod_listbox_changed() demodulator_digital_replace(sdm); break; } + update_dial_button(); } function secondary_demod_listbox_update()