packet decoding as secondary demodulator, finally displayin something on

the webpage
This commit is contained in:
Jakob Ketterl 2019-08-11 13:52:19 +02:00
parent 2fed83659f
commit e63569e3e9
4 changed files with 38 additions and 42 deletions

24
csdr.py
View File

@ -150,7 +150,13 @@ class dsp(object):
if which == "nfm": if which == "nfm":
chain += ["csdr fmdemod_quadri_cf", "csdr limit_ff"] chain += ["csdr fmdemod_quadri_cf", "csdr limit_ff"]
chain += last_decimation_block chain += last_decimation_block
chain += ["csdr deemphasis_nfm_ff {output_rate}", "csdr convert_f_s16"] chain += ["csdr deemphasis_nfm_ff {output_rate}"]
if self.get_audio_rate() != self.get_output_rate():
chain += [
"sox -t raw -r {audio_rate} -e floating-point -b 32 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - "
]
else:
chain += ["csdr convert_f_s16"]
elif self.isDigitalVoice(which): elif self.isDigitalVoice(which):
chain += ["csdr fmdemod_quadri_cf", "dc_block "] chain += ["csdr fmdemod_quadri_cf", "dc_block "]
chain += last_decimation_block chain += last_decimation_block
@ -179,13 +185,6 @@ class dsp(object):
"CSDR_FIXED_BUFSIZE=32 csdr agc_ff 160000 0.8 1 0.0000001 {max_gain}".format(max_gain=max_gain), "CSDR_FIXED_BUFSIZE=32 csdr agc_ff 160000 0.8 1 0.0000001 {max_gain}".format(max_gain=max_gain),
"sox -t raw -r 8000 -e floating-point -b 32 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - ", "sox -t raw -r 8000 -e floating-point -b 32 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - ",
] ]
elif which == "packet":
chain += ["csdr fmdemod_quadri_cf"]
chain += last_decimation_block
chain += [
"csdr convert_f_s16",
"direwolf -r {audio_rate} -t 0 - 1>&2"
]
elif which == "am": elif which == "am":
chain += ["csdr amdemod_cf", "csdr fastdcblock_ff"] chain += ["csdr amdemod_cf", "csdr fastdcblock_ff"]
chain += last_decimation_block chain += last_decimation_block
@ -195,7 +194,7 @@ class dsp(object):
chain += last_decimation_block chain += last_decimation_block
chain += ["csdr agc_ff", "csdr limit_ff"] chain += ["csdr agc_ff", "csdr limit_ff"]
# fixed sample rate necessary for the wsjt-x tools. fix with sox... # fixed sample rate necessary for the wsjt-x tools. fix with sox...
if self.isWsjtMode() and self.get_audio_rate() != self.get_output_rate(): if self.get_audio_rate() != self.get_output_rate():
chain += [ chain += [
"sox -t raw -r {audio_rate} -e floating-point -b 32 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - " "sox -t raw -r {audio_rate} -e floating-point -b 32 -c 1 --buffer 32 - -t raw -r {output_rate} -e signed-integer -b 16 -c 1 - "
] ]
@ -230,6 +229,12 @@ class dsp(object):
chain += "csdr fractional_decimator_ff {last_decimation} | " chain += "csdr fractional_decimator_ff {last_decimation} | "
chain += "csdr agc_ff | csdr limit_ff | csdr convert_f_s16" chain += "csdr agc_ff | csdr limit_ff | csdr convert_f_s16"
return chain return chain
elif which == "packet":
chain = secondary_chain_base + "csdr fmdemod_quadri_cf | "
if self.last_decimation != 1.0:
chain += "csdr fractional_decimator_ff {last_decimation} | "
chain += "csdr convert_f_s16 | direwolf -r {audio_rate} -t 0 -"
return chain
def set_secondary_demodulator(self, what): def set_secondary_demodulator(self, what):
if self.get_secondary_demodulator() == what: if self.get_secondary_demodulator() == what:
@ -281,6 +286,7 @@ class dsp(object):
secondary_bpf_transition_bw=self.secondary_bpf_transition_bw(), secondary_bpf_transition_bw=self.secondary_bpf_transition_bw(),
if_samp_rate=self.if_samp_rate(), if_samp_rate=self.if_samp_rate(),
last_decimation=self.last_decimation, last_decimation=self.last_decimation,
audio_rate=self.get_audio_rate(),
) )
logger.debug("secondary command (demod) = %s", secondary_command_demod) logger.debug("secondary command (demod) = %s", secondary_command_demod)

View File

@ -698,11 +698,6 @@ img.openwebrx-mirror-img
transform-origin: 0% 50%; transform-origin: 0% 50%;
} }
#openwebrx-digimode-content .part .subpart
{
}
@keyframes new-digimode-data @keyframes new-digimode-data
{ {
0%{ opacity: 0; } 0%{ opacity: 0; }
@ -862,7 +857,8 @@ img.openwebrx-mirror-img
#openwebrx-panel-digimodes[data-mode="wspr"] #openwebrx-digimode-select-channel, #openwebrx-panel-digimodes[data-mode="wspr"] #openwebrx-digimode-select-channel,
#openwebrx-panel-digimodes[data-mode="jt65"] #openwebrx-digimode-select-channel, #openwebrx-panel-digimodes[data-mode="jt65"] #openwebrx-digimode-select-channel,
#openwebrx-panel-digimodes[data-mode="jt9"] #openwebrx-digimode-select-channel, #openwebrx-panel-digimodes[data-mode="jt9"] #openwebrx-digimode-select-channel,
#openwebrx-panel-digimodes[data-mode="ft4"] #openwebrx-digimode-select-channel #openwebrx-panel-digimodes[data-mode="ft4"] #openwebrx-digimode-select-channel,
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-select-channel
{ {
display: none; display: none;
} }
@ -876,3 +872,7 @@ img.openwebrx-mirror-img
height: 200px; height: 200px;
margin: -10px; margin: -10px;
} }
#openwebrx-panel-digimodes[data-mode="packet"] #openwebrx-digimode-content-container {
height: 250px;
}

View File

@ -74,9 +74,6 @@
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-ysf" <div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-ysf"
style="display:none;" data-feature="digital_voice_digiham" style="display:none;" data-feature="digital_voice_digiham"
onclick="demodulator_analog_replace('ysf');">YSF</div> onclick="demodulator_analog_replace('ysf');">YSF</div>
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-packet"
style="display:none;" data-feature="packet"
onclick="demodulator_analog_replace('packet');">Packet</div>
</div> </div>
<div class="openwebrx-panel-line"> <div class="openwebrx-panel-line">
<div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-dig" onclick="demodulator_digital_replace_last();">DIG</div> <div class="openwebrx-button openwebrx-demodulator-button" id="openwebrx-button-dig" onclick="demodulator_digital_replace_last();">DIG</div>
@ -88,6 +85,7 @@
<option value="jt65" data-feature="wsjt-x">JT65</option> <option value="jt65" data-feature="wsjt-x">JT65</option>
<option value="jt9" data-feature="wsjt-x">JT9</option> <option value="jt9" data-feature="wsjt-x">JT9</option>
<option value="ft4" data-feature="wsjt-x">FT4</option> <option value="ft4" data-feature="wsjt-x">FT4</option>
<option value="packet" data-feature="packet">Packet</option>
</select> </select>
<div id="openwebrx-secondary-demod-dial-button" class="openwebrx-button openwebrx-dial-button" onclick="dial_button_click();"> <div id="openwebrx-secondary-demod-dial-button" class="openwebrx-button openwebrx-dial-button" onclick="dial_button_click();">
<svg version="1.1" id="Layer_1" x="0px" y="0px" width="246px" height="246px" viewBox="0 0 246 246" xmlns="http://www.w3.org/2000/svg"> <svg version="1.1" id="Layer_1" x="0px" y="0px" width="246px" height="246px" viewBox="0 0 246 246" xmlns="http://www.w3.org/2000/svg">

View File

@ -444,11 +444,6 @@ function demodulator_default_analog(offset_frequency,subtype)
{ {
this.low_cut=-3250; this.low_cut=-3250;
this.high_cut=3250; this.high_cut=3250;
}
else if(subtype=="packet")
{
this.low_cut=-4000;
this.high_cut=4000;
} }
else if(subtype=="am") else if(subtype=="am")
{ {
@ -2748,6 +2743,11 @@ function demodulator_digital_replace(subtype)
demodulator_analog_replace('usb', true); demodulator_analog_replace('usb', true);
demodulator_buttons_update(); demodulator_buttons_update();
break; break;
case "packet":
secondary_demod_start(subtype);
demodulator_analog_replace('nfm', true);
demodulator_buttons_update();
break;
} }
$('#openwebrx-panel-digimodes').attr('data-mode', subtype); $('#openwebrx-panel-digimodes').attr('data-mode', subtype);
toggle_panel("openwebrx-panel-digimodes", true); toggle_panel("openwebrx-panel-digimodes", true);
@ -2848,19 +2848,20 @@ function secondary_demod_push_binary_data(x)
function secondary_demod_push_data(x) function secondary_demod_push_data(x)
{ {
x=Array.from(x).map((y)=>{ x=Array.from(x).filter((y) => {
var c=y.charCodeAt(0); var c=y.charCodeAt(0);
if(y=="\r") return "&nbsp;"; return (c == 10 || (c >= 32 && c <= 126));
if(y=="\n") return "&nbsp;"; }).map((y) => {
//if(y=="\n") return "<br />";
if(c<32||c>126) return "";
if(y=="&") return "&amp;"; if(y=="&") return "&amp;";
if(y=="<") return "&lt;"; if(y=="<") return "&lt;";
if(y==">") return "&gt;"; if(y==">") return "&gt;";
if(y==" ") return "&nbsp;"; if(y==" ") return "&nbsp;";
return y; return y;
}).map((y) => {
if (y == "\n") return "<br />";
return "<span class=\"part\">"+y+"</span>";
}).join(""); }).join("");
$("#openwebrx-cursor-blink").before("<span class=\"part\"><span class=\"subpart\">"+x+"</span></span>"); $("#openwebrx-cursor-blink").before(x);
} }
function secondary_demod_data_clear() function secondary_demod_data_clear()
@ -2915,19 +2916,10 @@ function secondary_demod_listbox_changed()
{ {
if (secondary_demod_listbox_updating) return; if (secondary_demod_listbox_updating) return;
var sdm = $("#openwebrx-secondary-demod-listbox")[0].value; var sdm = $("#openwebrx-secondary-demod-listbox")[0].value;
switch (sdm) { if (sdm == "none") {
case "none": demodulator_analog_replace_last();
demodulator_analog_replace_last(); } else {
break; demodulator_digital_replace(sdm);
case "bpsk31":
case "rtty":
case "ft8":
case "wspr":
case "jt65":
case "jt9":
case "ft4":
demodulator_digital_replace(sdm);
break;
} }
update_dial_button(); update_dial_button();
} }