diff --git a/plugins/channelrx/radioastronomy/radioastronomygui.cpp b/plugins/channelrx/radioastronomy/radioastronomygui.cpp index a510fd7a7..58f7ba91a 100644 --- a/plugins/channelrx/radioastronomy/radioastronomygui.cpp +++ b/plugins/channelrx/radioastronomy/radioastronomygui.cpp @@ -106,7 +106,7 @@ public: qint64 minutes = v / (1000*60); v = v % (1000*60); qint64 seconds = v / (1000); - qint64 msec = v % 1000; + //qint64 msec = v % 1000; if (days > 0) { return QString("%1%2 %3:%4:%5").arg(neg ? "-" : "").arg(days).arg(hours, 2, 10, QChar('0')).arg(minutes, 2, 10, QChar('0')).arg(seconds, 2, 10, QChar('0')); @@ -431,6 +431,8 @@ void RadioAstronomyGUI::addToPowerSeries(FFTMeasurement *fft, bool skipCalcs) case RadioAstronomySettings::PY_WATTS: power = fft->m_totalPowerWatts; break; + default: + break; } break; case RadioAstronomySettings::PY_TSYS: @@ -448,8 +450,12 @@ void RadioAstronomyGUI::addToPowerSeries(FFTMeasurement *fft, bool skipCalcs) case RadioAstronomySettings::PY_JANSKY: power = Units::wattsPerMetrePerHertzToJansky(fft->m_flux); break; + default: + break; } break; + default: + break; } QDateTime dateTime = fft->m_dateTime; @@ -477,11 +483,11 @@ void RadioAstronomyGUI::addToPowerSeries(FFTMeasurement *fft, bool skipCalcs) } } - if (m_settings.m_powerYData == RadioAstronomySettings::PY_TSYS) { + if (m_settings.m_powerYUnits == RadioAstronomySettings::PY_KELVIN) { m_powerTsys0Series->append(dateTime.toMSecsSinceEpoch(), fft->m_tSys0); - } else if (m_settings.m_powerYData == RadioAstronomySettings::PY_DBM) { + } else if (m_settings.m_powerYUnits == RadioAstronomySettings::PY_DBM) { m_powerTsys0Series->append(dateTime.toMSecsSinceEpoch(), Astronomy::noisePowerdBm(fft->m_tSys0, fft->m_sampleRate)); - } else if (m_settings.m_powerYData == RadioAstronomySettings::PY_WATTS) { + } else if (m_settings.m_powerYUnits == RadioAstronomySettings::PY_WATTS) { m_powerTsys0Series->append(dateTime.toMSecsSinceEpoch(), Astronomy::m_boltzmann * fft->m_tSys0 * fft->m_sampleRate); } @@ -942,11 +948,6 @@ void RadioAstronomyGUI::updatePipeList() } } -static bool withinBeam(float a, float b, float beamWidth) -{ - return abs(a-b) < beamWidth; -} - bool RadioAstronomyGUI::handleMessage(const Message& message) { if (DSPSignalNotification::match(message)) @@ -1981,6 +1982,7 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI m_powerMarkerSeries(nullptr), m_powerTsys0Series(nullptr), m_powerGaussianSeries(nullptr), + m_powerPeakValid(false), m_2DChart(nullptr), m_2DXAxis(nullptr), m_2DYAxis(nullptr), @@ -2004,7 +2006,6 @@ RadioAstronomyGUI::RadioAstronomyGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUI m_fftXAxis(nullptr), m_fftYAxis(nullptr), m_fftDopplerAxis(nullptr), - m_powerPeakValid(false), m_powerM1Valid(false), m_powerM2Valid(false), m_spectrumM1Valid(false), @@ -2547,7 +2548,6 @@ void RadioAstronomyGUI::tick() int nbMagsqSamples; m_radioAstronomy->getMagSqLevels(magsqAvg, magsqPeak, nbMagsqSamples); double powDbAvg = CalcDb::dbPower(magsqAvg); - double powDbPeak = CalcDb::dbPower(magsqPeak); if (m_tickCount % 4 == 0) { ui->channelPower->setText(QString::number(powDbAvg, 'f', 1)); @@ -2564,7 +2564,7 @@ void RadioAstronomyGUI::updateRotatorList() { // Update list of rotators std::vector featureSets = MainCore::instance()->getFeatureeSets(); - for (int i = 0; i < featureSets.size(); i++) + for (unsigned int i = 0; i < featureSets.size(); i++) { FeatureSet* featureSet = featureSets[i]; for (int j = 0; j < featureSet->getNumberOfFeatures(); j++) @@ -2752,6 +2752,8 @@ void RadioAstronomyGUI::on_powerChartSelect_currentIndexChanged(int index) //ui->powerYUnits->addItem("Watts"); // No watts for now, as range spin boxes can't handle scientific notation ui->powerYUnits->addItem("K"); break; + default: + break; } updatePowerMarkerTableVisibility(); updatePowerChartWidgetsVisibility(); @@ -2806,6 +2808,8 @@ int RadioAstronomyGUI::powerYUnitsToIndex(RadioAstronomySettings::PowerYUnits un void RadioAstronomyGUI::on_powerYUnits_currentIndexChanged(int index) { + (void) index; + QString text = ui->powerYUnits->currentText(); if (text == "dBFS") { @@ -2940,7 +2944,7 @@ QRgb RadioAstronomyGUI::intensityToColor(float intensity) QRgb c1, c2; float scale; - if (isnan(intensity)) { + if (std::isnan(intensity)) { return qRgb(0, 0, 0); } // Get in range 0-1 @@ -3182,6 +3186,8 @@ void RadioAstronomyGUI::update2DImage(FFTMeasurement* fft, bool skipCalcs) case RadioAstronomySettings::PY_KELVIN: intensity = fft->m_tSys; break; + default: + break; } float newMin = std::min(m_2DMapMin, intensity); @@ -3366,7 +3372,7 @@ void RadioAstronomyGUI::powerColourAutoscale() float newMax = -std::numeric_limits::max(); for (int i = 0; i < width * height; i++) { - if (!isnan(m_2DMapIntensity[i])) + if (!std::isnan(m_2DMapIntensity[i])) { newMin = std::min(newMin, m_2DMapIntensity[i]); newMax = std::max(newMax, m_2DMapIntensity[i]); @@ -3528,6 +3534,8 @@ void RadioAstronomyGUI::plotPowerVsTimeChart() case RadioAstronomySettings::PY_WATTS: m_powerYAxis->setTitleText("Power (Watts)"); break; + default: + break; } break; case RadioAstronomySettings::PY_TSYS: @@ -3548,6 +3556,8 @@ void RadioAstronomyGUI::plotPowerVsTimeChart() case RadioAstronomySettings::PY_JANSKY: m_powerYAxis->setTitleText("Flux density (Jy)"); break; + default: + break; } break; } @@ -3999,6 +4009,8 @@ double RadioAstronomyGUI::dopplerToVelocity(double centre, double f, FFTMeasurem case RadioAstronomySettings::LSR: v -= fft->m_vLSR; break; + default: + break; } // Make +ve receeding return -v; @@ -4119,7 +4131,6 @@ void RadioAstronomyGUI::plotFFTMeasurement(int index) } double startFreqMHz = fft->m_centerFrequency/1e6 - m_settings.m_spectrumSpan / 2.0; - double endFreqMHz = fft->m_centerFrequency/1e6 + m_settings.m_spectrumSpan / 2.0; spectrumUpdateXRange(fft); spectrumUpdateYRange(fft); @@ -4311,7 +4322,7 @@ void RadioAstronomyGUI::calcVrAndDistanceToPeak(double freq, FFTMeasurement *fft QString name = ui->spectrumMarkerTable->item(row, SPECTRUM_MARKER_COL_NAME)->text(); if (losMarkerEnabled(name)) { - if ((solutions == 0) || isnan(d1)) + if ((solutions == 0) || std::isnan(d1)) { updateLoSMarker(name, fft->m_l, fft->m_b, 0.0f); } @@ -5900,49 +5911,49 @@ void RadioAstronomyGUI::on_sweepType_currentIndexChanged(int index) void RadioAstronomyGUI::on_sweep1Start_valueChanged(double value) { - m_settings.m_sweep1Start = ui->sweep1Start->value(); + m_settings.m_sweep1Start = value; applySettings(); } void RadioAstronomyGUI::on_sweep1Stop_valueChanged(double value) { - m_settings.m_sweep1Stop = ui->sweep1Stop->value(); + m_settings.m_sweep1Stop = value; applySettings(); } void RadioAstronomyGUI::on_sweep1Step_valueChanged(double value) { - m_settings.m_sweep1Step = ui->sweep1Step->value(); + m_settings.m_sweep1Step = value; applySettings(); } void RadioAstronomyGUI::on_sweep1Delay_valueChanged(double value) { - m_settings.m_sweep1Delay = ui->sweep1Delay->value(); + m_settings.m_sweep1Delay = value; applySettings(); } void RadioAstronomyGUI::on_sweep2Start_valueChanged(double value) { - m_settings.m_sweep2Start = ui->sweep2Start->value(); + m_settings.m_sweep2Start = value; applySettings(); } void RadioAstronomyGUI::on_sweep2Stop_valueChanged(double value) { - m_settings.m_sweep2Stop = ui->sweep2Stop->value(); + m_settings.m_sweep2Stop = value; applySettings(); } void RadioAstronomyGUI::on_sweep2Step_valueChanged(double value) { - m_settings.m_sweep2Step = ui->sweep2Step->value(); + m_settings.m_sweep2Step = value; applySettings(); } void RadioAstronomyGUI::on_sweep2Delay_valueChanged(double value) { - m_settings.m_sweep2Delay = ui->sweep2Delay->value(); + m_settings.m_sweep2Delay = value; applySettings(); } diff --git a/plugins/feature/gs232controller/gs232controller.cpp b/plugins/feature/gs232controller/gs232controller.cpp index 66e105bca..4afdf5f49 100644 --- a/plugins/feature/gs232controller/gs232controller.cpp +++ b/plugins/feature/gs232controller/gs232controller.cpp @@ -16,6 +16,8 @@ // along with this program. If not, see . // /////////////////////////////////////////////////////////////////////////////////// +#include + #include #include #include @@ -181,9 +183,9 @@ bool GS232Controller::getOnTarget() const { float targetAziumth, targetElevation; m_settings.calcTargetAzEl(targetAziumth, targetElevation); - float readTolerance = m_settings.m_tolerance + 0.5f; - bool onTarget = (abs(m_currentAzimuth - targetAziumth) < readTolerance) - && (abs(m_currentElevation - targetElevation) < readTolerance); + float readTolerance = m_settings.m_tolerance + 0.0f; + bool onTarget = (std::fabs(m_currentAzimuth - targetAziumth) < readTolerance) + && (std::fabs(m_currentElevation - targetElevation) < readTolerance); return onTarget; } diff --git a/plugins/feature/gs232controller/gs232controllergui.cpp b/plugins/feature/gs232controller/gs232controllergui.cpp index 087902fcf..ee4d4d443 100644 --- a/plugins/feature/gs232controller/gs232controllergui.cpp +++ b/plugins/feature/gs232controller/gs232controllergui.cpp @@ -221,8 +221,11 @@ void GS232ControllerGUI::updatePipeList() if (currentText.isEmpty()) { - if (m_availablePipes.size() > 0) - ui->sources->setCurrentIndex(0); + // Source feature may be loaded after this, so may not have existed when + // displaySettings was called + if (m_availablePipes.size() > 0) { + ui->sources->setCurrentIndex(ui->sources->findText(m_settings.m_source)); + } } else { diff --git a/sdrbase/channel/channelwebapiutils.cpp b/sdrbase/channel/channelwebapiutils.cpp index 53bbb0557..da25919dd 100644 --- a/sdrbase/channel/channelwebapiutils.cpp +++ b/sdrbase/channel/channelwebapiutils.cpp @@ -106,7 +106,7 @@ bool ChannelWebAPIUtils::getFeatureSettings(unsigned int featureSetIndex, unsign if (featureSetIndex < featureSets.size()) { featureSet = featureSets[featureSetIndex]; - if (featureIndex < featureSet->getNumberOfFeatures()) + if (featureIndex < (unsigned int)featureSet->getNumberOfFeatures()) { feature = featureSet->getFeatureAt(featureIndex); httpRC = feature->webapiSettingsGet(featureSettingsResponse, errorResponse); @@ -522,7 +522,7 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr if (httpRC/100 == 2) { - qDebug("ChannelWebAPIUtils::patchDeviceSetting: set device setting %s OK", setting); + qDebug("ChannelWebAPIUtils::patchDeviceSetting: set device setting %s OK", qPrintable(setting)); return true; } else @@ -534,7 +534,7 @@ bool ChannelWebAPIUtils::patchDeviceSetting(unsigned int deviceIndex, const QStr } else { - qWarning("ChannelWebAPIUtils::patchDeviceSetting: no key %s in device settings", setting); + qWarning("ChannelWebAPIUtils::patchDeviceSetting: no key %s in device settings", qPrintable(setting)); return false; } } @@ -569,7 +569,7 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig if (httpRC/100 == 2) { - qDebug("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %s OK", setting, value); + qDebug("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %s OK", qPrintable(setting), value); return true; } else @@ -581,7 +581,7 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig } else { - qWarning("ChannelWebAPIUtils::patchFeatureSetting: no key %s in feature settings", setting); + qWarning("ChannelWebAPIUtils::patchFeatureSetting: no key %s in feature settings", qPrintable(setting)); return false; } } @@ -596,7 +596,6 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig SWGSDRangel::SWGFeatureSettings featureSettingsResponse; QString errorResponse; int httpRC; - FeatureSet *featureSet; Feature *feature; if (getFeatureSettings(featureSetIndex, featureIndex, featureSettingsResponse, feature)) @@ -617,19 +616,19 @@ bool ChannelWebAPIUtils::patchFeatureSetting(unsigned int featureSetIndex, unsig if (httpRC/100 == 2) { - qDebug("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %f OK", setting, value); + qDebug("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %f OK", qPrintable(setting), value); return true; } else { - qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %s error %d: %s", - setting, value, httpRC, qPrintable(*errorResponse2.getMessage())); + qWarning("ChannelWebAPIUtils::patchFeatureSetting: set feature setting %s to %f error %d: %s", + qPrintable(setting), value, httpRC, qPrintable(*errorResponse2.getMessage())); return false; } } else { - qWarning("ChannelWebAPIUtils::patchFeatureSetting: no key %s in feature settings", setting); + qWarning("ChannelWebAPIUtils::patchFeatureSetting: no key %s in feature settings", qPrintable(setting)); return false; } } @@ -652,7 +651,7 @@ bool ChannelWebAPIUtils::getFeatureReportValue(unsigned int featureSetIndex, uns if (featureSetIndex < featureSets.size()) { featureSet = featureSets[featureSetIndex]; - if (featureIndex < featureSet->getNumberOfFeatures()) + if (featureIndex < (unsigned int)featureSet->getNumberOfFeatures()) { feature = featureSet->getFeatureAt(featureIndex); httpRC = feature->webapiReportGet(featureReport, errorResponse); @@ -685,7 +684,7 @@ bool ChannelWebAPIUtils::getFeatureReportValue(unsigned int featureSetIndex, uns } else { - qWarning("ChannelWebAPIUtils::getFeatureReportValue: no key %s in feature report", key); + qWarning("ChannelWebAPIUtils::getFeatureReportValue: no key %s in feature report", qPrintable(key)); return false; } } diff --git a/sdrbase/util/weather.cpp b/sdrbase/util/weather.cpp index b9ac69bcc..20c4aa8d0 100644 --- a/sdrbase/util/weather.cpp +++ b/sdrbase/util/weather.cpp @@ -88,7 +88,7 @@ void OpenWeatherMap::getWeather(float latitude, float longitude) query.addQueryItem("appid", m_apiKey); url.setQuery(query); - QNetworkReply *reply = m_networkManager->get(QNetworkRequest(url)); + m_networkManager->get(QNetworkRequest(url)); } void OpenWeatherMap::handleReply(QNetworkReply* reply)