Commit eee680c6 authored by Jasem Mutlaq's avatar Jasem Mutlaq
Browse files

Move stopEkos after shutdown script is successfully executed and make it configurable

parent 6533eb6c
......@@ -6,8 +6,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>658</width>
<height>508</height>
<width>504</width>
<height>394</height>
</rect>
</property>
<property name="windowTitle">
......@@ -156,6 +156,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="kcfg_StopEkosAfterShutdown">
<property name="toolTip">
<string>After shutdown procedure is successfully executed, stop INDI and Ekos.</string>
</property>
<property name="text">
<string>Stop Ekos After Shutdown</string>
</property>
</widget>
</item>
<item>
<spacer name="verticalSpacer">
<property name="orientation">
......
......@@ -2316,10 +2316,7 @@ bool Scheduler::checkShutdownState()
case SHUTDOWN_SCRIPT:
if (shutdownScriptURL.isEmpty() == false)
{
// Disconnect devices
stopEkos();
{
shutdownState = SHUTDOWN_SCRIPT_RUNNING;
executeScript(shutdownScriptURL.toString(QUrl::PreferLocalFile));
}
......@@ -2330,7 +2327,7 @@ bool Scheduler::checkShutdownState()
case SHUTDOWN_SCRIPT_RUNNING:
return false;
case SHUTDOWN_COMPLETE:
case SHUTDOWN_COMPLETE:
return true;
case SHUTDOWN_ERROR:
......@@ -2448,7 +2445,7 @@ void Scheduler::checkStatus()
appendLogText(i18n("Shutdown procedure failed, aborting..."));
// Stop Ekos if there is no shutdown script since stopEkos is called right before executing the shutdown script
if (shutdownScriptURL.isEmpty())
if (shutdownScriptURL.isEmpty() && Options::stopEkosAfterShutdown())
stopEkos();
// Stop Scheduler
......@@ -4719,12 +4716,17 @@ void Scheduler::checkShutdownProcedure()
else
{
if (shutdownState == SHUTDOWN_COMPLETE)
{
appendLogText(i18n("Manual shutdown procedure completed successfully."));
// Stop Ekos
if (Options::stopEkosAfterShutdown())
stopEkos();
}
else if (shutdownState == SHUTDOWN_ERROR)
appendLogText(i18n("Manual shutdown procedure terminated due to errors."));
shutdownState = SHUTDOWN_IDLE;
shutdownB->setIcon(QIcon::fromTheme("media-playback-start", QIcon(":/icons/breeze/default/media-playback-start.svg")));
shutdownB->setIcon(QIcon::fromTheme("media-playback-start", QIcon(":/icons/breeze/default/media-playback-start.svg")));
}
}
......
......@@ -1748,8 +1748,12 @@
</entry>
</group>
<group name="Scheduler">
<entry name="StopEkosAfterShutdown" type="Bool">
<label>After shutdown procedure is successfully executed, shutdown INDI and Ekos.</label>
<default>true</default>
</entry>
<entry name="PreemptiveShutdown" type="Bool">
<label>Perform pre-emptive strike if no jobs are due for a number of hours.</label>
<label>Perform pre-emptive shutdown if no jobs are due for a number of hours.</label>
<default>false</default>
</entry>
<entry name="PreemptiveShutdownTime" type="Double">
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment