Commit e1cbf1a7 authored by Jasem Mutlaq's avatar Jasem Mutlaq

Implement proper update of button status inside each module separately by...

Implement proper update of button status inside each module separately by signals and not directly as it causes many issues and goes against the separation of modules and Ekos manager
parent 17f79418
......@@ -3286,5 +3286,30 @@ bool Align::calcCircle(const QPointF &p1, const QPointF &p2, const QPointF &p3,
return true;
}
void Align::setMountStatus(ISD::Telescope::TelescopeStatus newState)
{
switch (newState)
{
case ISD::Telescope::MOUNT_PARKING:
case ISD::Telescope::MOUNT_SLEWING:
solveB->setEnabled(false);
loadSlewB->setEnabled(false);
PAHFirstCaptureB->setEnabled(false);
PAHSecondCaptureB->setEnabled(false);
PAHThirdCaptureB->setEnabled(false);
break;
case ISD::Telescope::MOUNT_TRACKING:
solveB->setEnabled(true);
loadSlewB->setEnabled(true);
PAHFirstCaptureB->setEnabled(true);
PAHSecondCaptureB->setEnabled(true);
PAHThirdCaptureB->setEnabled(true);
break;
default:
break;
}
}
}
......@@ -299,6 +299,8 @@ public slots:
// Update Capture Module status
void setCaptureStatus(Ekos::CaptureState newState);
// Update Mount module status
void setMountStatus(ISD::Telescope::TelescopeStatus newState);
void slotEditOptions();
void slotUpdateLineEditOptions();
......
......@@ -4139,4 +4139,27 @@ void Capture::setVideoStreamEnabled(bool enabled)
}
}
void Capture::setMountStatus(ISD::Telescope::TelescopeStatus newState)
{
switch (newState)
{
case ISD::Telescope::MOUNT_PARKING:
case ISD::Telescope::MOUNT_SLEWING:
previewB->setEnabled(false);
liveVideoB->setEnabled(false);
startB->setEnabled(false);
break;
case ISD::Telescope::MOUNT_TRACKING:
previewB->setEnabled(true);
if (currentCCD)
liveVideoB->setEnabled(currentCCD->hasVideoStream());
startB->setEnabled(true);
break;
default:
break;
}
}
}
......@@ -255,8 +255,6 @@ public:
/* Capture */
void updateSequencePrefix( const QString &newPrefix, const QString &dir);
bool currentCCDHasVideo() {return currentCCD->hasVideoStream();}
public slots:
/** \addtogroup CaptureDBusInterface
......@@ -386,6 +384,8 @@ public slots:
void setGuideStatus(Ekos::GuideState state);
// Align
void setAlignStatus(Ekos::AlignState state);
// Update Mount module status
void setMountStatus(ISD::Telescope::TelescopeStatus newState);
private slots:
......
......@@ -1471,6 +1471,8 @@ void EkosManager::initCapture()
// Meridian Flip
connect(captureProcess, SIGNAL(meridianFlipStarted()), mountProcess, SLOT(disableAltLimits()), Qt::UniqueConnection);
connect(captureProcess, SIGNAL(meridianFlipCompleted()), mountProcess, SLOT(enableAltLimits()), Qt::UniqueConnection);
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), captureProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
}
if (managedDevices.contains(KSTARS_DOME))
......@@ -1505,6 +1507,9 @@ void EkosManager::initAlign()
connect(focusProcess, SIGNAL(filterLockUpdated(ISD::GDInterface*,int)), alignProcess, SLOT(setLockedFilter(ISD::GDInterface*,int)), Qt::UniqueConnection);
connect(focusProcess, SIGNAL(newStatus(Ekos::FocusState)) , alignProcess, SLOT(setFocusStatus(Ekos::FocusState)), Qt::UniqueConnection);
}
if (mountProcess)
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), alignProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
}
......@@ -1524,7 +1529,8 @@ void EkosManager::initFocus()
focusGroup->setEnabled(true);
if(!focusPI){
if(!focusPI)
{
focusPI = new QProgressIndicator(focusProcess);
focusStatusLayout->insertWidget(0,focusPI);
}
......@@ -1558,13 +1564,18 @@ void EkosManager::initFocus()
connect(focusProcess, SIGNAL(newStatus(Ekos::FocusState)), alignProcess, SLOT(setFocusStatus(Ekos::FocusState)), Qt::UniqueConnection);
}
if (mountProcess)
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), focusProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
}
void EkosManager::updateCurrentHFR(double newHFR){
void EkosManager::updateCurrentHFR(double newHFR)
{
currentHFR->setText(QString("%1").arg(newHFR, 0,'f', 2)+" px");
}
void EkosManager::updateSigmas(double ra, double de){
void EkosManager::updateSigmas(double ra, double de)
{
errRA->setText(QString::number(ra, 'f', 2)+"\"");
errDEC->setText(QString::number(de, 'f', 2)+"\"");
}
......@@ -1583,7 +1594,8 @@ void EkosManager::initMount()
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), this, SLOT(updateMountStatus(ISD::Telescope::TelescopeStatus)));
connect(mountProcess, SIGNAL(newTarget(QString)), mountTarget, SLOT(setText(QString)));
if(!mountPI){
if(!mountPI)
{
mountPI = new QProgressIndicator(mountProcess);
mountStatusLayout->insertWidget(0,mountPI);
}
......@@ -1596,8 +1608,17 @@ void EkosManager::initMount()
// Meridian Flip
connect(captureProcess, SIGNAL(meridianFlipStarted()), mountProcess, SLOT(disableAltLimits()), Qt::UniqueConnection);
connect(captureProcess, SIGNAL(meridianFlipCompleted()), mountProcess, SLOT(enableAltLimits()), Qt::UniqueConnection);
// Mount Status
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), captureProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
}
if (alignProcess)
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), alignProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
if (focusProcess)
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), focusProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
if (guideProcess)
{
connect(mountProcess, SIGNAL(newStatus(ISD::Telescope::TelescopeStatus)), guideProcess, SLOT(setMountStatus(ISD::Telescope::TelescopeStatus)), Qt::UniqueConnection);
......@@ -1909,60 +1930,12 @@ void EkosManager::updateMountStatus(ISD::Telescope::TelescopeStatus status)
mountPI->setColor(QColor( KStarsData::Instance()->colorScheme()->colorNamed("TargetColor" )));
if (mountPI->isAnimated() == false)
mountPI->startAnimation();
//This code will disable a bunch of buttons in the Ekos modules while the scope is slewing.
//Pressing these buttons while slewing will cause problems in the images that result because either the stars will be streaked or they won't be the right stars.
//It might be better to do this in each module, but this is more centralized.
if (alignProcess)
{
alignProcess->solveB->setEnabled(false);
alignProcess->loadSlewB->setEnabled(false);
}
if (captureProcess)
{
captureProcess->previewB->setEnabled(false);
captureProcess->liveVideoB->setEnabled(false);
captureProcess->startB->setEnabled(false);
}
if (focusProcess)
{
focusProcess->captureB->setEnabled(false);
focusProcess->startFocusB->setEnabled(false);
focusProcess->startLoopB->setEnabled(false);
}
if (guideProcess)
{
guideProcess->captureB->setEnabled(false);
guideProcess->calibrateB->setEnabled(false);
}
break;
case ISD::Telescope::MOUNT_TRACKING:
mountPI->setColor(Qt::darkGreen);
if (mountPI->isAnimated() == false)
mountPI->startAnimation();
//This will re-enabled the disabled buttons
if (alignProcess)
{
alignProcess->solveB->setEnabled(true);
alignProcess->loadSlewB->setEnabled(true);
}
if (captureProgress)
{
captureProcess->previewB->setEnabled(true);
captureProcess->liveVideoB->setEnabled(captureProcess->currentCCDHasVideo());
captureProcess->startB->setEnabled(true);
}
if (focusProcess)
{
focusProcess->captureB->setEnabled(true);
focusProcess->startFocusB->setEnabled(true);
focusProcess->startLoopB->setEnabled(true);
}
if (guideProcess)
{
guideProcess->captureB->setEnabled(true);
guideProcess->calibrateB->setEnabled(true);
}
break;
......
......@@ -2594,4 +2594,26 @@ void Focus::toggleFocusingWidgetFullScreen()
}
}
void Focus::setMountStatus(ISD::Telescope::TelescopeStatus newState)
{
switch (newState)
{
case ISD::Telescope::MOUNT_PARKING:
case ISD::Telescope::MOUNT_SLEWING:
captureB->setEnabled(false);
startFocusB->setEnabled(false);
startLoopB->setEnabled(false);
break;
case ISD::Telescope::MOUNT_TRACKING:
captureB->setEnabled(true);
startFocusB->setEnabled(true);
startLoopB->setEnabled(true);
break;
default:
break;
}
}
}
......@@ -21,6 +21,7 @@
#include "indi/indistd.h"
#include "indi/indifocuser.h"
#include "indi/indiccd.h"
#include "indi/inditelescope.h"
namespace Ekos
{
......@@ -161,6 +162,8 @@ public:
*/
void addFilter(ISD::GDInterface *newFilter);
// Update Mount module status
void setMountStatus(ISD::Telescope::TelescopeStatus newState);
void clearLog();
QString getLogText() { return logText.join("\n"); }
......
......@@ -1069,12 +1069,20 @@ void Guide::setCaptureStatus(CaptureState newState)
void Guide::setMountStatus(ISD::Telescope::TelescopeStatus newState)
{
switch (newState)
{
{
case ISD::Telescope::MOUNT_SLEWING:
case ISD::Telescope::MOUNT_PARKING:
captureB->setEnabled(false);
calibrateB->setEnabled(false);
if (newState == ISD::Telescope::MOUNT_PARKING)
abort();
break;
case ISD::Telescope::MOUNT_TRACKING:
captureB->setEnabled(true);
calibrateB->setEnabled(true);
default:
break;
}
......
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