1
0
mirror of https://github.com/f4exb/sdrangel.git synced 2024-11-17 05:41:56 -05:00

Web API: BFM and DSD demod fixes. SSB demod: change clipping limiter constants

This commit is contained in:
f4exb 2018-05-24 18:23:08 +02:00
parent 128ac7ea1f
commit 72e58534e3
7 changed files with 71 additions and 15 deletions

View File

@ -593,13 +593,13 @@ int BFMDemod::webapiSettingsPutPatch(
settings.m_rdsActive = response.getBfmDemodSettings()->getRdsActive() != 0;
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getAmDemodSettings()->getRgbColor();
settings.m_rgbColor = response.getBfmDemodSettings()->getRgbColor();
}
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getAmDemodSettings()->getTitle();
settings.m_title = *response.getBfmDemodSettings()->getTitle();
}
if (channelSettingsKeys.contains("audioDeviceName")) {
settings.m_audioDeviceName = *response.getAmDemodSettings()->getAudioDeviceName();
settings.m_audioDeviceName = *response.getBfmDemodSettings()->getAudioDeviceName();
}
if (frequencyOffsetChanged)

View File

@ -787,13 +787,13 @@ int DSDDemod::webapiSettingsPutPatch(
settings.m_pllLock = response.getDsdDemodSettings()->getPllLock() != 0;
}
if (channelSettingsKeys.contains("rgbColor")) {
settings.m_rgbColor = response.getAmDemodSettings()->getRgbColor();
settings.m_rgbColor = response.getDsdDemodSettings()->getRgbColor();
}
if (channelSettingsKeys.contains("title")) {
settings.m_title = *response.getAmDemodSettings()->getTitle();
settings.m_title = *response.getDsdDemodSettings()->getTitle();
}
if (channelSettingsKeys.contains("audioDeviceName")) {
settings.m_audioDeviceName = *response.getAmDemodSettings()->getAudioDeviceName();
settings.m_audioDeviceName = *response.getDsdDemodSettings()->getAudioDeviceName();
}
if (channelSettingsKeys.contains("highPassFilter")) {
settings.m_highPassFilter = response.getDsdDemodSettings()->getHighPassFilter() != 0;

View File

@ -105,9 +105,35 @@ bool DSDDemodGUI::deserialize(const QByteArray& data)
}
}
bool DSDDemodGUI::handleMessage(const Message& message __attribute__((unused)))
bool DSDDemodGUI::handleMessage(const Message& message)
{
return false;
if (DSDDemod::MsgConfigureDSDDemod::match(message))
{
qDebug("DSDDemodGUI::handleMessage: DSDDemod::MsgConfigureDSDDemod");
const DSDDemod::MsgConfigureDSDDemod& cfg = (DSDDemod::MsgConfigureDSDDemod&) message;
m_settings = cfg.getSettings();
blockApplySettings(true);
displaySettings();
blockApplySettings(false);
return true;
}
else
{
return false;
}
}
void DSDDemodGUI::handleInputMessages()
{
Message* message;
while ((message = getInputMessageQueue()->pop()) != 0)
{
if (handleMessage(*message))
{
delete message;
}
}
}
void DSDDemodGUI::on_deltaFrequency_changed(qint64 value)
@ -290,6 +316,7 @@ DSDDemodGUI::DSDDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
connect(this, SIGNAL(widgetRolled(QWidget*,bool)), this, SLOT(onWidgetRolled(QWidget*,bool)));
connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(onMenuDialogCalled(const QPoint &)));
connect(getInputMessageQueue(), SIGNAL(messageEnqueued()), this, SLOT(handleInputMessages()));
CRightClickEnabler *audioMuteRightClickEnabler = new CRightClickEnabler(ui->audioMute);
connect(audioMuteRightClickEnabler, SIGNAL(rightClick()), this, SLOT(audioSelect()));

View File

@ -133,6 +133,7 @@ private slots:
void onWidgetRolled(QWidget* widget, bool rollDown);
void onMenuDialogCalled(const QPoint& p);
void on_viewStatusLog_clicked();
void handleInputMessages();
void audioSelect();
void tick();
};

View File

@ -105,9 +105,9 @@ double MagAGC::feedAndGetValue(const Complex& ci)
if (m_squared)
{
double u0 = m_R / m_moving_average.average();
double du = (u0*m_magsq) - (m_clampMax/2.0);
double du = (u0*m_magsq) - (m_clampMax/4.0);
if (du > 0) {
m_u0 = (m_clampMax/2.0)*(1.0 + (log10(1+du)/4.0)); // experimental clipping limiter
m_u0 = (m_clampMax/4.0)*(1.0 + (log10(1+du)/8.0)); // experimental clipping limiter
} else {
m_u0 = u0;
}
@ -116,9 +116,9 @@ double MagAGC::feedAndGetValue(const Complex& ci)
else
{
double u02 = m_R2 / m_moving_average.average();
double du = (u02*m_magsq) - (m_clampMax/2.0);
double du = (u02*m_magsq) - (m_clampMax/4.0);
if (du > 0) {
m_u0 = (m_clampMax/2.0)*(1.0 + (log10(1+du)/4.0)); // experimental clipping limiter
m_u0 = (m_clampMax/4.0)*(1.0 + (log10(1+du)/8.0)); // experimental clipping limiter
} else {
m_u0 = sqrt(u02);
}

View File

@ -1889,6 +1889,20 @@ bool WebAPIRequestMapper::validateChannelSettings(
return false;
}
}
else if (*channelType == "DSDDemod")
{
if (channelSettings.getTx() == 0)
{
QJsonObject dsdDemodSettingsJsonObject = jsonObject["DSDDemodSettings"].toObject();
channelSettingsKeys = dsdDemodSettingsJsonObject.keys();
channelSettings.setDsdDemodSettings(new SWGSDRangel::SWGDSDDemodSettings());
channelSettings.getDsdDemodSettings()->fromJsonObject(dsdDemodSettingsJsonObject);
return true;
}
else {
return false;
}
}
else if (*channelType == "NFMDemod")
{
if (channelSettings.getTx() == 0)

View File

@ -65,6 +65,8 @@ def getInputOptions():
parser.add_option("-t", "--settling-time", dest="settling_time", help="Scan step settling time in seconds", metavar="SECONDS", type="float", default=1.0)
parser.add_option("--sq", dest="squelch_db", help="Squelsch threshold in dB", metavar="DECIBEL", type="float", default=-50.0)
parser.add_option("--sq-gate", dest="squelch_gate", help="Squelsch gate in ms", metavar="MILLISECONDS", type="int", default=50)
parser.add_option("--baud-rate", dest="baud_rate", help="Baud rate for digial modulation (DV)", metavar="RATE", type="int", default=4800)
parser.add_option("--fm-dev", dest="fm_dev", help="FM deviation for FM digial modulation (DV)", metavar="FREQUENCY", type="int", default=5400)
parser.add_option("--re-run", dest="rerun", help="re run with given parameters without setting up device and channels", metavar="BOOLEAN", action="store_true", default=False)
parser.add_option("-x", "--excl-list", dest="excl_fstr", help="frequencies (in Hz) exclusion comma separated list", metavar="LIST", type="string")
parser.add_option("--excl-tol", dest="excl_tol", help="match tolerance interval (in Hz) for exclusion frequencies", metavar="FREQUENCY", type="float", default=10.0)
@ -167,11 +169,11 @@ def changeDeviceFrequency(fc, options):
def setupChannels(scan_control, options):
i = 0
for shift in scan_control.channel_shifts:
settings = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": options.channel_id, "tx": 0}, "Create NFM demod")
settings = callAPI(deviceset_url + "/channel", "POST", None, {"channelType": options.channel_id, "tx": 0}, "Create demod")
if settings is None:
exit(-1)
settings = callAPI(deviceset_url + "/channel/%d/settings" % i, "GET", None, None, "Get NFM demod settings")
settings = callAPI(deviceset_url + "/channel/%d/settings" % i, "GET", None, None, "Get demod settings")
if settings is None:
exit(-1)
@ -190,6 +192,14 @@ def setupChannels(scan_control, options):
settings["AMDemodSettings"]["squelch"] = options.squelch_db
settings["AMDemodSettings"]["title"] = "Channel %d" % i
settings["AMDemodSettings"]["bandpassEnable"] = 1 # bandpass filter
elif options.channel_id == "DSDDemod":
settings["DSDDemodSettings"]["inputFrequencyOffset"] = int(shift)
settings["DSDDemodSettings"]["rfBandwidth"] = options.rf_bw
settings["DSDDemodSettings"]["volume"] = options.volume
settings["DSDDemodSettings"]["squelch"] = options.squelch_db
settings["DSDDemodSettings"]["baudRate"] = options.baud_rate
settings["DSDDemodSettings"]["fmDeviation"] = options.fm_dev
settings["DSDDemodSettings"]["title"] = "Channel %d" % i
r = callAPI(deviceset_url + "/channel/%d/settings" % i, "PATCH", None, settings, "Change demod")
if r is None:
@ -207,7 +217,11 @@ def checkScanning(fc, options, display_message):
channel = reports["channels"][i]
if "report" in channel:
if reportKey in channel["report"]:
if channel["report"][reportKey]["squelch"] == 1:
if options.channel_id == "DSDDemod": # DSD is special because it only stops on voice
stopCondition = channel["report"][reportKey]["slot1On"] == 1 or channel["report"][reportKey]["slot2On"] == 1
else:
stopCondition = channel["report"][reportKey]["squelch"] == 1
if stopCondition:
f_channel = channel["deltaFrequency"]+fc
f_frac = round(f_channel/options.excl_tol)
if f_frac not in options.excl_flist: