fix spectran http source samplerate detection

This commit is contained in:
AlexandreRouma 2024-04-04 19:42:58 +02:00
parent 12f7efed32
commit 8eaa987d90

View File

@ -113,11 +113,10 @@ void SpectranHTTPClient::worker() {
auto sampleFreqEnd = jsonData.find(',', sampleFreqBegin);
std::string sampleFreqStr = jsonData.substr(sampleFreqBegin + 18, sampleFreqEnd - sampleFreqBegin - 18);
sampleFreq = std::stoll(sampleFreqStr);
//flog::debug("{}", jsonData);
}
// Calculate and update center freq
int64_t samplerate = /* sampleFreqReceived ? sampleFreq : */(endFreq - startFreq);
int64_t samplerate = sampleFreqReceived ? sampleFreq : (endFreq - startFreq);
int64_t centerFreq = round(((double)endFreq + (double)startFreq) / 2.0);
if (centerFreq != _centerFreq) {
flog::debug("New center freq: {}", centerFreq);