From 33739ce669dd12a716025ee9c71018f496900ed3 Mon Sep 17 00:00:00 2001 From: Jon Beniston Date: Thu, 30 Mar 2023 16:48:02 +0100 Subject: [PATCH] Fix settings keys in Star Tracker (Rename to settings to match) --- plugins/feature/startracker/startracker.cpp | 12 ++--- .../feature/startracker/startrackergui.cpp | 12 ++--- .../startracker/startrackersettings.cpp | 49 ++++++++++--------- .../feature/startracker/startrackersettings.h | 4 +- .../feature/startracker/startrackerworker.cpp | 8 +-- 5 files changed, 43 insertions(+), 42 deletions(-) diff --git a/plugins/feature/startracker/startracker.cpp b/plugins/feature/startracker/startracker.cpp index d95945fe5..d0185d5df 100644 --- a/plugins/feature/startracker/startracker.cpp +++ b/plugins/feature/startracker/startracker.cpp @@ -402,8 +402,8 @@ void StarTracker::webapiFormatFeatureSettings( response.getStarTrackerSettings()->setElevation(settings.m_el); response.getStarTrackerSettings()->setL(settings.m_l); response.getStarTrackerSettings()->setB(settings.m_b); - response.getStarTrackerSettings()->setAzimuthOffset(settings.m_azOffset); - response.getStarTrackerSettings()->setElevationOffset(settings.m_elOffset); + response.getStarTrackerSettings()->setAzimuthOffset(settings.m_azimuthOffset); + response.getStarTrackerSettings()->setElevationOffset(settings.m_elevationOffset); if (settings.m_rollupState) { @@ -507,10 +507,10 @@ void StarTracker::webapiUpdateFeatureSettings( settings.m_b = response.getStarTrackerSettings()->getB(); } if (featureSettingsKeys.contains("azimuthOffset")) { - settings.m_azOffset = response.getStarTrackerSettings()->getAzimuthOffset(); + settings.m_azimuthOffset = response.getStarTrackerSettings()->getAzimuthOffset(); } if (featureSettingsKeys.contains("elevationOffset")) { - settings.m_elOffset = response.getStarTrackerSettings()->getElevationOffset(); + settings.m_elevationOffset = response.getStarTrackerSettings()->getElevationOffset(); } if (settings.m_rollupState && featureSettingsKeys.contains("rollupState")) { settings.m_rollupState->updateFrom(featureSettingsKeys, response.getStarTrackerSettings()->getRollupState()); @@ -595,10 +595,10 @@ void StarTracker::webapiReverseSendSettings(const QList& featureSetting swgStarTrackerSettings->setB(settings.m_b); } if (featureSettingsKeys.contains("azimuthOffset") || force) { - swgStarTrackerSettings->setAzimuthOffset(settings.m_azOffset); + swgStarTrackerSettings->setAzimuthOffset(settings.m_azimuthOffset); } if (featureSettingsKeys.contains("elevationOffset") || force) { - swgStarTrackerSettings->setElevationOffset(settings.m_elOffset); + swgStarTrackerSettings->setElevationOffset(settings.m_elevationOffset); } QString channelSettingsURL = QString("http://%1:%2/sdrangel/featureset/%3/feature/%4/settings") diff --git a/plugins/feature/startracker/startrackergui.cpp b/plugins/feature/startracker/startrackergui.cpp index 0663a0865..930b833e3 100644 --- a/plugins/feature/startracker/startrackergui.cpp +++ b/plugins/feature/startracker/startrackergui.cpp @@ -432,8 +432,8 @@ void StarTrackerGUI::displaySettings() ui->elevation->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); ui->galacticLatitude->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); ui->galacticLongitude->setUnits((DMSSpinBox::DisplayUnits)m_settings.m_azElUnits); - ui->azimuthOffset->setValue(m_settings.m_azOffset); - ui->elevationOffset->setValue(m_settings.m_elOffset); + ui->azimuthOffset->setValue(m_settings.m_azimuthOffset); + ui->elevationOffset->setValue(m_settings.m_elevationOffset); if (m_settings.m_target == "Custom RA/Dec") { @@ -578,16 +578,16 @@ void StarTrackerGUI::on_elevation_valueChanged(double value) void StarTrackerGUI::on_azimuthOffset_valueChanged(double value) { - m_settings.m_azOffset = value; - m_settingsKeys.append("azOffset"); + m_settings.m_azimuthOffset = value; + m_settingsKeys.append("azimuthOffset"); applySettings(); plotChart(); } void StarTrackerGUI::on_elevationOffset_valueChanged(double value) { - m_settings.m_elOffset = value; - m_settingsKeys.append("elOffset"); + m_settings.m_elevationOffset = value; + m_settingsKeys.append("elevationOffset"); applySettings(); plotChart(); } diff --git a/plugins/feature/startracker/startrackersettings.cpp b/plugins/feature/startracker/startrackersettings.cpp index fedf5e0a2..9522018a7 100644 --- a/plugins/feature/startracker/startrackersettings.cpp +++ b/plugins/feature/startracker/startrackersettings.cpp @@ -75,11 +75,11 @@ void StarTrackerSettings::resetToDefaults() m_el = 0.0; m_l = 0.0; m_b = 0.0; - m_azOffset = 0.0; - m_elOffset = 0.0; m_link = false; m_owmAPIKey = ""; m_weatherUpdatePeriod = 60; + m_azimuthOffset = 0.0; + m_elevationOffset = 0.0; m_drawSunOnSkyTempChart = true; m_drawMoonOnSkyTempChart = true; m_workspaceIndex = 0; @@ -128,8 +128,8 @@ QByteArray StarTrackerSettings::serialize() const s.writeBool(37, m_link); s.writeString(38, m_owmAPIKey); s.writeS32(39, m_weatherUpdatePeriod); - s.writeDouble(40, m_azOffset); - s.writeDouble(41, m_elOffset); + s.writeDouble(40, m_azimuthOffset); + s.writeDouble(41, m_elevationOffset); s.writeBool(42, m_drawSunOnSkyTempChart); s.writeBool(43, m_drawMoonOnSkyTempChart); @@ -214,8 +214,8 @@ bool StarTrackerSettings::deserialize(const QByteArray& data) d.readBool(37, &m_link, false); d.readString(38, &m_owmAPIKey, ""); d.readS32(39, &m_weatherUpdatePeriod, 60); - d.readDouble(40, &m_azOffset, 0.0); - d.readDouble(41, &m_elOffset, 0.0); + d.readDouble(40, &m_azimuthOffset, 0.0); + d.readDouble(41, &m_elevationOffset, 0.0); d.readBool(42, &m_drawSunOnSkyTempChart, true); d.readBool(43, &m_drawMoonOnSkyTempChart, true); @@ -281,12 +281,12 @@ void StarTrackerSettings::applySettings(const QStringList& settingsKeys, const S if (settingsKeys.contains("beamwidth")) { m_beamwidth = settings.m_beamwidth; } - if (settingsKeys.contains("enableServer")) { - m_enableServer = settings.m_enableServer; - } if (settingsKeys.contains("serverPort")) { m_serverPort = settings.m_serverPort; } + if (settingsKeys.contains("enableServer")) { + m_enableServer = settings.m_enableServer; + } if (settingsKeys.contains("azElUnits")) { m_azElUnits = settings.m_azElUnits; } @@ -350,12 +350,6 @@ void StarTrackerSettings::applySettings(const QStringList& settingsKeys, const S if (settingsKeys.contains("b")) { m_b = settings.m_b; } - if (settingsKeys.contains("azOffset")) { - m_azOffset = settings.m_azOffset; - } - if (settingsKeys.contains("elOffset")) { - m_elOffset = settings.m_elOffset; - } if (settingsKeys.contains("link")) { m_link = settings.m_link; } @@ -365,6 +359,12 @@ void StarTrackerSettings::applySettings(const QStringList& settingsKeys, const S if (settingsKeys.contains("weatherUpdatePeriod")) { m_weatherUpdatePeriod = settings.m_weatherUpdatePeriod; } + if (settingsKeys.contains("azimuthOffset")) { + m_azimuthOffset = settings.m_azimuthOffset; + } + if (settingsKeys.contains("elevationOffset")) { + m_elevationOffset = settings.m_elevationOffset; + } if (settingsKeys.contains("drawSunOnSkyTempChart")) { m_drawSunOnSkyTempChart = settings.m_drawSunOnSkyTempChart; } @@ -422,12 +422,12 @@ QString StarTrackerSettings::getDebugString(const QStringList& settingsKeys, boo if (settingsKeys.contains("beamwidth") || force) { ostr << " m_beamwidth: " << m_beamwidth; } - if (settingsKeys.contains("enableServer") || force) { - ostr << " m_enableServer: " << m_enableServer; - } if (settingsKeys.contains("serverPort") || force) { ostr << " m_serverPort: " << m_serverPort; } + if (settingsKeys.contains("enableServer") || force) { + ostr << " m_enableServer: " << m_enableServer; + } if (settingsKeys.contains("azElUnits") || force) { ostr << " m_azElUnits: " << m_azElUnits; } @@ -488,12 +488,6 @@ QString StarTrackerSettings::getDebugString(const QStringList& settingsKeys, boo if (settingsKeys.contains("b") || force) { ostr << " m_b: " << m_b; } - if (settingsKeys.contains("azOffset") || force) { - ostr << " m_azOffset: " << m_azOffset; - } - if (settingsKeys.contains("elOffset") || force) { - ostr << " m_elOffset: " << m_elOffset; - } if (settingsKeys.contains("link") || force) { ostr << " m_link: " << m_link; } @@ -503,6 +497,12 @@ QString StarTrackerSettings::getDebugString(const QStringList& settingsKeys, boo if (settingsKeys.contains("weatherUpdatePeriod") || force) { ostr << " m_weatherUpdatePeriod: " << m_weatherUpdatePeriod; } + if (settingsKeys.contains("azimuthOffset") || force) { + ostr << " m_azimuthOffset: " << m_azimuthOffset; + } + if (settingsKeys.contains("elevationOffset") || force) { + ostr << " m_elevationOffset: " << m_elevationOffset; + } if (settingsKeys.contains("drawSunOnSkyTempChart") || force) { ostr << " m_drawSunOnSkyTempChart: " << m_drawSunOnSkyTempChart; } @@ -515,3 +515,4 @@ QString StarTrackerSettings::getDebugString(const QStringList& settingsKeys, boo return QString(ostr.str().c_str()); } + diff --git a/plugins/feature/startracker/startrackersettings.h b/plugins/feature/startracker/startrackersettings.h index 2014065f1..f8f2c48a8 100644 --- a/plugins/feature/startracker/startrackersettings.h +++ b/plugins/feature/startracker/startrackersettings.h @@ -67,8 +67,8 @@ struct StarTrackerSettings bool m_link; // Link settings to Radio Astronomy plugin QString m_owmAPIKey; // API key for openweathermap.org int m_weatherUpdatePeriod; // Time in minutes between weather updates - double m_azOffset; - double m_elOffset; + double m_azimuthOffset; + double m_elevationOffset; bool m_drawSunOnSkyTempChart; bool m_drawMoonOnSkyTempChart; Serializable *m_rollupState; diff --git a/plugins/feature/startracker/startrackerworker.cpp b/plugins/feature/startracker/startrackerworker.cpp index 9055c2931..14cbef293 100644 --- a/plugins/feature/startracker/startrackerworker.cpp +++ b/plugins/feature/startracker/startrackerworker.cpp @@ -145,8 +145,8 @@ void StarTrackerWorker::applySettings(const StarTrackerSettings& settings, const || settingsKeys.contains("el") || settingsKeys.contains("l") || settingsKeys.contains("b") - || settingsKeys.contains("azOffset") - || settingsKeys.contains("elOffset") + || settingsKeys.contains("azimuthOffset") + || settingsKeys.contains("elevationOffset") || force) { // Recalculate immediately @@ -563,8 +563,8 @@ void StarTrackerWorker::update() } // Add user-adjustment - aa.alt += m_settings.m_elOffset; - aa.az += m_settings.m_azOffset; + aa.alt += m_settings.m_elevationOffset; + aa.az += m_settings.m_azimuthOffset; // Send to GUI if (getMessageQueueToGUI())