[education/kstars] kstars/ekos/guide: Add PID Autotune message to the dialog
Jasem Mutlaq <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit a779ca8d37e0cb4775b3483b0f45a7311a48c25e by Jasem Mutlaq.
Committed on 04/08/2026 at 03:59.
Pushed by mutlaqja into branch 'master'.
Add PID Autotune message to the dialog
M +2 -2 kstars/ekos/guide/aiguideprotocol.h
M +39 -6 kstars/ekos/guide/aiguidewizard.cpp
M +7 -1 kstars/ekos/guide/aiguidewizard.h
M +11 -1 kstars/ekos/guide/aiguidewizard.ui
https://invent.kde.org/education/kstars/-/commit/a779ca8d37e0cb4775b3483b0f45a7311a48c25e
diff --git a/kstars/ekos/guide/aiguideprotocol.h b/kstars/ekos/guide/aiguideprotocol.h
index f55b248b9d..1fd9f916d1 100644
--- a/kstars/ekos/guide/aiguideprotocol.h
+++ b/kstars/ekos/guide/aiguideprotocol.h
@@ -82,8 +82,8 @@ class AIGuideProtocol : public QObject
/**
* @brief Auto-detect the mount class from the connected mount's device name via
* mount_types.json (MountGuiderFactory::detectMountType()).
- * @return "WORM_GEAR" / "HARMONIC_DRIVE" / "DIRECT_DRIVE" / "NOT_FOUND" -- "NOT_FOUND"
- * if no mount is connected or the name has no entry in the lookup table.
+ * @return "WORM_GEAR" / "HARMONIC_DRIVE" / "DIRECT_DRIVE" / "NOT_FOUND". Returns
+ * "NOT_FOUND" if no mount is connected or the name has no entry in the lookup table.
*/
QString detectMountType() const;
diff --git a/kstars/ekos/guide/aiguidewizard.cpp b/kstars/ekos/guide/aiguidewizard.cpp
index adaf8dd8bd..ad74ebc5c4 100644
--- a/kstars/ekos/guide/aiguidewizard.cpp
+++ b/kstars/ekos/guide/aiguidewizard.cpp
@@ -9,6 +9,7 @@
#include "aiguideprotocol.h"
#include "guide.h"
#include "kspaths.h"
+#include "Options.h"
#include <QDateTime>
#include <QDebug>
#include <QDesktopServices>
@@ -258,17 +259,44 @@ AIGuideWizard::AIGuideWizard(AIGuideProtocol *protocol, QWidget *parent) : QWiza
});
progressBar->setValue(0);
+ updateLockedSettingsLabel();
+}
+
+// The exposure/aggressiveness/pulse settings active when the protocol runs get baked into
+// the model fingerprint. Which of those the user needs to have set correctly beforehand
+// depends on whether PID Auto-Tune is enabled: with it on, the protocol determines and
+// locks the RA/DEC aggressiveness itself, so the user only needs exposure and pulse
+// settings right; with it off, all three need to already match what they normally guide
+// with. Re-run every time the wizard is shown so toggling the option in Guide Options
+// between wizard runs is reflected without needing to reopen KStars.
+void AIGuideWizard::updateLockedSettingsLabel()
+{
+ QString text;
+ if (Options::aIPIDAutoTune())
+ {
+ text = i18n("PID Auto-Tune is enabled, so this run will measure your mount's response "
+ "and automatically determine and lock in the RA/DEC aggressiveness for "
+ "you; there is no need to set it beforehand. The AI model is still "
+ "trained and locked to your current guide exposure and pulse settings, "
+ "so use the values you normally guide with for those.");
+ }
+ else
+ {
+ text = i18n("The AI model is trained and locked to your current guide exposure, "
+ "aggressiveness, and pulse settings; use the values you normally guide with.");
+ }
+ lockedSettingsLabel->setText(QString("<html><body><p><span style=\" color:#ff5500;\">%1</span></p></body></html>").arg(text));
}
void AIGuideWizard::showEvent(QShowEvent *event)
{
QWizard::showEvent(event);
+ updateLockedSettingsLabel();
- // Suggest a mount type from the connected mount's device name (mount_types.json), once.
- // The user can still change the selection manually -- this only sets the initial value.
- if (!m_MountTypeAutoDetectAttempted)
+ // Suggest a mount type from the connected mount's device name (mount_types.json).
+ // Re-attempted every time the wizard is shown; see m_LastAutoDetectedMountType's
+ // comment for why this is safe to redo without fighting a manual selection.
{
- m_MountTypeAutoDetectAttempted = true;
QString comboText;
const QString detected = m_Protocol->detectMountType();
if (detected == "WORM_GEAR")
@@ -278,12 +306,17 @@ void AIGuideWizard::showEvent(QShowEvent *event)
else if (detected == "DIRECT_DRIVE")
comboText = "Direct Drive";
- if (!comboText.isEmpty())
+ const QString current = mountTypeCombo->currentText();
+ const bool untouchedSinceLastDetect = (current == "Worm Gear" && m_LastAutoDetectedMountType.isEmpty())
+ || current == m_LastAutoDetectedMountType;
+
+ if (!comboText.isEmpty() && untouchedSinceLastDetect)
{
mountTypeCombo->setCurrentText(comboText);
+ m_LastAutoDetectedMountType = comboText;
appendLog(i18n("Detected mount type: %1. Change the selection above if this is incorrect.", comboText));
}
- else
+ else if (comboText.isEmpty() && untouchedSinceLastDetect)
appendLog(i18n("Could not auto-detect the mount type. Please select it manually above."));
}
diff --git a/kstars/ekos/guide/aiguidewizard.h b/kstars/ekos/guide/aiguidewizard.h
index d255494a04..bdc76b9cca 100644
--- a/kstars/ekos/guide/aiguidewizard.h
+++ b/kstars/ekos/guide/aiguidewizard.h
@@ -63,10 +63,16 @@ class AIGuideWizard : public QWizard, public Ui::AIGuideWizard
private:
void appendLog(const QString &message);
+ void updateLockedSettingsLabel();
AIGuideProtocol *m_Protocol { nullptr };
bool m_AutoNavigating { false };
- bool m_MountTypeAutoDetectAttempted { false };
+ // Combo text we last auto-set (empty if detection never succeeded yet). Re-checked
+ // every time the wizard is shown, but only applied if the combo still shows either
+ // the untouched Designer default or exactly this value, so a manual override
+ // survives reopening the dialog, while a failed/missing detection can "heal" itself
+ // (e.g. after mount_types.json gains an entry) without requiring an app restart.
+ QString m_LastAutoDetectedMountType;
};
}
\ No newline at end of file
diff --git a/kstars/ekos/guide/aiguidewizard.ui b/kstars/ekos/guide/aiguidewizard.ui
index 77bedd54b1..ab136445ae 100644
--- a/kstars/ekos/guide/aiguidewizard.ui
+++ b/kstars/ekos/guide/aiguidewizard.ui
@@ -74,7 +74,17 @@
<item>
<widget class="QLabel" name="exposureLabel">
<property name="text">
[suppressed due to size limit]
[suppressed due to size limit]
+ </property>
+ <property name="wordWrap">
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLabel" name="lockedSettingsLabel">
+ <property name="text">
+ <string/>
</property>
<property name="wordWrap">
<bool>true</bool>