Commit 3abb7e8a authored by Jasem Mutlaq's avatar Jasem Mutlaq

Use TELESCOPE_TYPE from CCD driver, no need to save list of guide drivers

parent 1cd268f1
......@@ -227,8 +227,8 @@ Align::Align()
// Which telescope info to use for FOV calculations
//kcfg_solverOTA->setChecked(Options::solverOTA());
guideScopeCCDs = Options::guideScopeCCDs();
connect(FOVScopeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateGuideScopeCCDs(int)));
//guideScopeCCDs = Options::guideScopeCCDs();
connect(FOVScopeCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(updateTelescopeType(int)));
accuracySpin->setValue(Options::solverAccuracyThreshold());
alignDarkFrameCheck->setChecked(Options::alignDarkFrame());
......@@ -1582,7 +1582,7 @@ void Align::setDefaultCCD(QString ccd)
void Align::checkCCD(int ccdNum)
{
if (ccdNum == -1)
if (ccdNum == -1 || ccdNum >= CCDs.count())
{
ccdNum = CCDCaptureCombo->currentIndex();
......@@ -1590,18 +1590,20 @@ void Align::checkCCD(int ccdNum)
return;
}
if (ccdNum <= CCDs.count())
{
currentCCD = CCDs.at(ccdNum);
if (currentCCD)
disconnect(currentCCD, SIGNAL(switchUpdated(ISwitchVectorProperty*)), this, SLOT(processCCDSwitch(ISwitchVectorProperty*)));
//if (solverTypeGroup->checkedId() == SOLVER_REMOTE)
//(dynamic_cast<RemoteAstrometryParser*>(parser))->setCCD(currentCCD);
}
currentCCD = CCDs.at(ccdNum);
FOVScopeCombo->setCurrentIndex(guideScopeCCDs.contains(currentCCD->getDeviceName()) ? ISD::CCD::TELESCOPE_GUIDE : ISD::CCD::TELESCOPE_PRIMARY);
connect(currentCCD, SIGNAL(switchUpdated(ISwitchVectorProperty*)), this, SLOT(processCCDSwitch(ISwitchVectorProperty*)));
syncCCDInfo();
FOVScopeCombo->blockSignals(true);
FOVScopeCombo->setCurrentIndex(currentCCD->getTelescopeType());
FOVScopeCombo->blockSignals(false);
syncTelescopeInfo();
}
void Align::addCCD(ISD::GDInterface *newCCD)
......@@ -1659,7 +1661,7 @@ void Align::syncTelescopeInfo()
aperture = primaryAperture;
if (currentCCD && Options::guideScopeCCDs().contains(currentCCD->getDeviceName()))
if (currentCCD && currentCCD->getTelescopeType() == ISD::CCD::TELESCOPE_GUIDE)
aperture = guideAperture;
np = IUFindNumber(nvp, "TELESCOPE_FOCAL_LENGTH");
......@@ -1672,7 +1674,7 @@ void Align::syncTelescopeInfo()
focal_length = primaryFL;
if (currentCCD && Options::guideScopeCCDs().contains(currentCCD->getDeviceName()))
if (currentCCD && currentCCD->getTelescopeType() == ISD::CCD::TELESCOPE_GUIDE)
focal_length = guideFL;
}
......@@ -2346,7 +2348,7 @@ void Align::startSolving(const QString &filename, bool isGenerated)
Options::setSolverType(solverTypeGroup->checkedId());
//Options::setSolverOptions(solverOptions->text());
Options::setGuideScopeCCDs(guideScopeCCDs);
//Options::setGuideScopeCCDs(guideScopeCCDs);
Options::setSolverAccuracyThreshold(accuracySpin->value());
Options::setAlignDarkFrame(alignDarkFrameCheck->isChecked());
Options::setSolverGotoOption(currentGotoMode);
......@@ -4264,29 +4266,25 @@ void Align::processPAHStage(double orientation, double ra, double dec, double pi
}
}
void Align::syncGuideScopeCCDs()
void Align::processCCDSwitch(ISwitchVectorProperty *svp)
{
updateGuideScopeCCDs(FOVScopeCombo->currentIndex());
if (currentCCD && !strcmp(svp->name, "TELESCOPE_TYPE"))
{
FOVScopeCombo->blockSignals(true);
FOVScopeCombo->setCurrentIndex(currentCCD->getTelescopeType());
FOVScopeCombo->blockSignals(false);
syncTelescopeInfo();
}
}
void Align::updateGuideScopeCCDs(int index)
void Align::updateTelescopeType(int index)
{
if (currentCCD == NULL)
return;
if (index == ISD::CCD::TELESCOPE_GUIDE && guideScopeCCDs.contains(currentCCD->getDeviceName()) == false)
guideScopeCCDs.append(currentCCD->getDeviceName());
else if (index == ISD::CCD::TELESCOPE_PRIMARY)
guideScopeCCDs.removeOne(currentCCD->getDeviceName());
if (guideScopeCCDs.contains(currentCCD->getDeviceName()))
currentCCD->setTelescopeType(ISD::CCD::TELESCOPE_GUIDE);
else
currentCCD->setTelescopeType(ISD::CCD::TELESCOPE_PRIMARY);
Options::setGuideScopeCCDs(guideScopeCCDs);
syncTelescopeInfo();
currentCCD->setTelescopeType(static_cast<ISD::CCD::TelescopeType>(index));
}
// Function adapted from https://rosettacode.org/wiki/Circles_of_given_radius_through_two_points
......
......@@ -196,12 +196,6 @@ public:
*/
bool isParserOK();
/**
* @brief syncGuideScopeCCDs When TELESCOPE_TYPE is first defined by the CCD driver, update its value given the current state of useGuideScope checkbox
* If checked, we set TELESCOPE_TYPE to GUIDE, otherwise it is set to PRIMARY
*/
void syncGuideScopeCCDs();
// Log
QString getLogText() { return logText.join("\n"); }
void clearLog();
......@@ -341,6 +335,7 @@ private slots:
void correctAltError();
void processFilterNumber(INumberVectorProperty *nvp);
void processCCDSwitch(ISwitchVectorProperty *svp);
void setDefaultCCD(QString ccd);
......@@ -349,7 +344,7 @@ private slots:
// Solver timeout
void checkAlignmentTimeout();
void updateGuideScopeCCDs(int index);
void updateTelescopeType(int index);
// External View
void showFITSViewer();
......@@ -599,7 +594,7 @@ private:
QLineF correctionVector;
// CCDs using Guide Scope for parameters
QStringList guideScopeCCDs;
//QStringList guideScopeCCDs;
// Which hemisphere are we located on?
HemisphereType hemisphere;
......
......@@ -1279,16 +1279,6 @@ void EkosManager::processNewProperty(INDI::Property* prop)
return;
}
if (!strcmp(prop->getName(), "TELESCOPE_TYPE"))
{
if (alignProcess)
{
alignProcess->syncGuideScopeCCDs();
}
return;
}
if (!strcmp(prop->getName(), "GUIDER_EXPOSURE"))
{
foreach(ISD::GDInterface *device, findDevices(KSTARS_CCD))
......
......@@ -2083,6 +2083,8 @@ bool CCD::setTelescopeType(TelescopeType type)
clientManager->sendNewSwitch(svp);
setConfig(SAVE_CONFIG);
return true;
}
......
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