More spyserver bugfix

This commit is contained in:
Ryzerth
2021-07-19 22:23:03 +02:00
parent c9f1ec0a8a
commit e877844768
2 changed files with 29 additions and 16 deletions

View File

@@ -120,10 +120,10 @@ private:
return;
}
int digiGain = 0;
_this->digiGain = 0;
int srvBits = streamFormatsBitCount[_this->iqType];
if (srvBits < _this->client->devInfo.Resolution) {
digiGain = std::ceil(((double)_this->client->devInfo.Resolution - (double)srvBits)*6.02);
_this->digiGain = std::ceil(((double)_this->client->devInfo.Resolution - (double)srvBits)*6.02);
}
_this->client->setSetting(SPYSERVER_SETTING_IQ_FORMAT, streamFormats[_this->iqType]);
@@ -131,11 +131,11 @@ private:
_this->client->setSetting(SPYSERVER_SETTING_IQ_FREQUENCY, _this->freq);
_this->client->setSetting(SPYSERVER_SETTING_STREAMING_MODE, SPYSERVER_STREAM_MODE_IQ_ONLY);
_this->client->setSetting(SPYSERVER_SETTING_GAIN, _this->gain);
_this->client->setSetting(SPYSERVER_SETTING_IQ_DIGITAL_GAIN, digiGain);
_this->client->setSetting(SPYSERVER_SETTING_IQ_DIGITAL_GAIN, _this->digiGain);
_this->client->startStream();
_this->running = true;
spdlog::info("AirspyHFSourceModule '{0}': Start with gain {1} !", _this->name, digiGain);
spdlog::info("AirspyHFSourceModule '{0}': Start with gain {1} !", _this->name, _this->digiGain);
}
static void stop(void* ctx) {
@@ -253,14 +253,14 @@ private:
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::Combo("##spyserver_source_type", &_this->iqType, streamFormatStr)) {
int digiGain = 0;
_this->digiGain = 0;
int srvBits = streamFormatsBitCount[_this->iqType];
if (srvBits < _this->client->devInfo.Resolution) {
digiGain = std::ceil(((double)_this->client->devInfo.Resolution - (double)srvBits)*6.02);
spdlog::info("Switched the digital gain to {0}dB", digiGain);
_this->digiGain = std::ceil(((double)_this->client->devInfo.Resolution - (double)srvBits)*6.02);
spdlog::info("Switched the digital gain to {0}dB", _this->digiGain);
}
_this->client->setSetting(SPYSERVER_SETTING_IQ_FORMAT, streamFormats[_this->iqType]);
_this->client->setSetting(SPYSERVER_SETTING_IQ_DIGITAL_GAIN, digiGain);
_this->client->setSetting(SPYSERVER_SETTING_IQ_DIGITAL_GAIN, _this->digiGain);
config.acquire();
config.conf["devices"][_this->devRef]["sampleBitDepthId"] = _this->iqType;
@@ -269,13 +269,20 @@ private:
if (_this->client->devInfo.MaximumGainIndex) {
ImGui::SetNextItemWidth(menuWidth);
if (ImGui::SliderInt("##spyserver_source_gain", &_this->gain, 0, _this->client->devInfo.MaximumGainIndex)) {
if (ImGui::SliderInt("##spyserver_source_gain", (int*)&_this->gain, 0, _this->client->devInfo.MaximumGainIndex)) {
_this->client->setSetting(SPYSERVER_SETTING_GAIN, _this->gain);
config.acquire();
config.conf["devices"][_this->devRef]["gainId"] = _this->gain;
config.release(true);
}
}
}
ImGui::Text("Digital Gain");
ImGui::SameLine();
ImGui::SetNextItemWidth(menuWidth - ImGui::GetCursorPosX());
if (ImGui::InputInt("##spyserver_source_dgain", (int*)&_this->digiGain, 1, 10)) {
_this->client->setSetting(SPYSERVER_SETTING_IQ_DIGITAL_GAIN, _this->digiGain);
}
ImGui::Text("Status:");
ImGui::SameLine();
@@ -302,7 +309,8 @@ private:
std::vector<double> sampleRates;
std::string sampleRatesTxt;
int gain = 0;
uint32_t gain = 0;
uint32_t digiGain = 0;
std::string devRef = "";