allow initial_squelch_level to be set per profile

This commit is contained in:
Jakob Ketterl 2019-11-23 16:56:29 +01:00
parent d5b7338531
commit b27caf2405
3 changed files with 13 additions and 6 deletions

10
csdr.py
View File

@ -25,6 +25,7 @@ import subprocess
import os
import signal
import threading
import math
from functools import partial
from owrx.kiss import KissClient, DirewolfConfig
@ -85,7 +86,7 @@ class dsp(object):
self.csdr_dynamic_bufsize = False
self.csdr_print_bufsizes = False
self.csdr_through = False
self.squelch_level = 0
self.squelch_level = -150
self.fft_averages = 50
self.iqtee = False
self.iqtee2 = False
@ -521,13 +522,16 @@ class dsp(object):
def get_bpf(self):
return [self.low_cut, self.high_cut]
def convertToLinear(self, db):
return float(math.pow(10, db / 10))
def set_squelch_level(self, squelch_level):
self.squelch_level = squelch_level
# no squelch required on digital voice modes
actual_squelch = 0 if self.isDigitalVoice() or self.isPacket() else self.squelch_level
actual_squelch = -150 if self.isDigitalVoice() or self.isPacket() else self.squelch_level
if self.running:
self.modification_lock.acquire()
self.squelch_pipe_file.write("%g\n" % (float(actual_squelch)))
self.squelch_pipe_file.write("%g\n" % (self.convertToLinear(actual_squelch)))
self.squelch_pipe_file.flush()
self.modification_lock.release()

View File

@ -141,9 +141,8 @@ function setSquelchToAuto() {
}
function updateSquelch() {
var sliderValue = parseInt(e("openwebrx-panel-squelch").value);
var outputValue = (sliderValue === parseInt(e("openwebrx-panel-squelch").min)) ? 0 : getLinearSmeterValue(sliderValue);
ws.send(JSON.stringify({"type": "dspcontrol", "params": {"squelch_level": outputValue}}));
var sliderValue = parseInt($("#openwebrx-panel-squelch").val());
ws.send(JSON.stringify({"type": "dspcontrol", "params": {"squelch_level": sliderValue}}));
}
var waterfall_min_level;
@ -1058,6 +1057,9 @@ function on_ws_recv(evt) {
mathbox_waterfall_colors = config['mathbox_waterfall_colors'];
mathbox_waterfall_frequency_resolution = config['mathbox_waterfall_frequency_resolution'];
mathbox_waterfall_history_length = config['mathbox_waterfall_history_length'];
var sql = Number.isInteger(config['initial_squelch_level']) ? config['initial_squelch_level'] : -150;
$("#openwebrx-panel-squelch").val(sql);
updateSquelch();
waterfall_init();
initialize_demodulator();

View File

@ -69,6 +69,7 @@ class OpenWebRxReceiverClient(Client):
"mathbox_waterfall_colors",
"mathbox_waterfall_history_length",
"mathbox_waterfall_frequency_resolution",
"initial_squelch_level",
]
def __init__(self, conn):