[education/kstars] kstars/ekos: Correctly wait for the remote drivers and add contributation of all seqeunce files
Jasem Mutlaq <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 971c784b09af6765d88b1d4c5ba7594666c768d4 by Jasem Mutlaq.
Committed on 22/07/2026 at 19:50.
Pushed by mutlaqja into branch 'master'.
Correctly wait for the remote drivers and add contributation of all seqeunce files
M +17 -12 kstars/ekos/manager.cpp
https://invent.kde.org/education/kstars/-/commit/971c784b09af6765d88b1d4c5ba7594666c768d4
diff --git a/kstars/ekos/manager.cpp b/kstars/ekos/manager.cpp
index a53728b318..9a39784bd1 100644
--- a/kstars/ekos/manager.cpp
+++ b/kstars/ekos/manager.cpp
@@ -75,7 +75,6 @@
#include <ekos_debug.h>
-#define MAX_REMOTE_INDI_TIMEOUT 15000
#define MAX_LOCAL_INDI_TIMEOUT 10000
namespace Ekos
@@ -1553,25 +1552,25 @@ void Manager::setClientStarted(const QString &host, int port)
}
}
- auto maxTimeout = MAX_LOCAL_INDI_TIMEOUT;
+ auto maxTimeout = m_LocalMode ? MAX_LOCAL_INDI_TIMEOUT : (MAX_LOCAL_INDI_TIMEOUT * 2);
- // Parse script, if any
+ // Parse script, if any, and sum all rule delays to determine if we need to extend the timeout.
+ // If the total delay from all profile script rules exceeds the base timeout, extend accordingly.
QJsonParseError jsonError;
QJsonArray profileScripts;
QJsonDocument doc = QJsonDocument::fromJson(m_CurrentProfile->scripts, &jsonError);
- // If we have any rules that delay startup of drivers, we need to take that into account
- // otherwise Ekos would prematurely declare that drivers failed to connect.
if (jsonError.error == QJsonParseError::NoError)
{
profileScripts = doc.array();
+ double totalScriptDelay = 0;
for (const auto &oneRule : std::as_const(profileScripts))
{
const auto &oneRuleObj = oneRule.toObject();
- auto totalDelay = (oneRuleObj["PreDelay"].toDouble(0) + oneRuleObj["PostDelay"].toDouble(0)) * 1000;
- if (totalDelay >= maxTimeout)
- maxTimeout = totalDelay + MAX_LOCAL_INDI_TIMEOUT;
+ totalScriptDelay += (oneRuleObj["PreDelay"].toDouble(0) + oneRuleObj["PostDelay"].toDouble(0)) * 1000;
}
+ if (totalScriptDelay >= maxTimeout)
+ maxTimeout += totalScriptDelay;
}
QTimer::singleShot(maxTimeout, this, &Ekos::Manager::checkINDITimeout);
@@ -1672,10 +1671,16 @@ void Manager::checkINDITimeout()
appendLogText(message);
KSNotification::event(QLatin1String("IndiServerMessage"), message, KSNotification::General, KSNotification::Warn);
- m_ekosStatus = Ekos::Error;
- Q_EMIT ekosStatusChanged(m_ekosStatus);
- m_indiStatus = Ekos::Error;
- Q_EMIT indiStatusChanged(m_indiStatus);
+ // Only set ekosStatus to Error if the profile is not already running successfully.
+ // When a single peripheral device fails to connect after all modules are initialized,
+ // the profile should remain operational and the button should stay as Stop.
+ if (m_ekosStatus != Ekos::Success)
+ {
+ m_ekosStatus = Ekos::Error;
+ Q_EMIT ekosStatusChanged(m_ekosStatus);
+ m_indiStatus = Ekos::Error;
+ Q_EMIT indiStatusChanged(m_indiStatus);
+ }
return;
}