Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/guide/guide.cpp
Show First 20 Lines • Show All 747 Lines • ▼ Show 20 Line(s) | 747 | { | |||
---|---|---|---|---|---|
748 | syncCCDInfo(); | 748 | syncCCDInfo(); | ||
749 | return; | 749 | return; | ||
750 | } | 750 | } | ||
751 | 751 | | |||
752 | //connect(currentCCD, SIGNAL(FITSViewerClosed()), this, &Ekos::Guide::viewerClosed()), Qt::UniqueConnection); | 752 | //connect(currentCCD, SIGNAL(FITSViewerClosed()), this, &Ekos::Guide::viewerClosed()), Qt::UniqueConnection); | ||
753 | connect(currentCCD, &ISD::CCD::numberUpdated, this, &Ekos::Guide::processCCDNumber, Qt::UniqueConnection); | 753 | connect(currentCCD, &ISD::CCD::numberUpdated, this, &Ekos::Guide::processCCDNumber, Qt::UniqueConnection); | ||
754 | connect(currentCCD, &ISD::CCD::newExposureValue, this, &Ekos::Guide::checkExposureValue, Qt::UniqueConnection); | 754 | connect(currentCCD, &ISD::CCD::newExposureValue, this, &Ekos::Guide::checkExposureValue, Qt::UniqueConnection); | ||
755 | 755 | | |||
756 | // If guider is external and already connected and remote images option was disabled AND it was already | | |||
757 | // disabled, then let's go ahead and disable it. | | |||
758 | #if 0 | | |||
759 | if (guiderType != GUIDE_INTERNAL && Options::guideRemoteImagesEnabled() == false && guider->isConnected()) | | |||
760 | { | | |||
761 | for (int i = 0; i < CCDs.count(); i++) | | |||
762 | { | | |||
763 | ISD::CCD * oneCCD = CCDs[i]; | | |||
764 | if (i == ccdNum && oneCCD->getDriverInfo()->getClientManager()->getBLOBMode(oneCCD->getDeviceName(), "CCD1") != B_NEVER) | | |||
765 | { | | |||
766 | appendLogText(i18n("Disabling remote image reception from %1", oneCCD->getDeviceName())); | | |||
767 | oneCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, oneCCD->getDeviceName(), "CCD1"); | | |||
768 | oneCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_NEVER, oneCCD->getDeviceName(), "CCD2"); | | |||
769 | } | | |||
770 | // If it was already disabled, enable it back | | |||
771 | else if (i != ccdNum && oneCCD->getDriverInfo()->getClientManager()->getBLOBMode(oneCCD->getDeviceName(), "CCD1") == B_NEVER) | | |||
772 | { | | |||
773 | appendLogText(i18n("Enabling remote image reception from %1", oneCCD->getDeviceName())); | | |||
774 | oneCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_ALSO, oneCCD->getDeviceName(), "CCD1"); | | |||
775 | oneCCD->getDriverInfo()->getClientManager()->setBLOBMode(B_ALSO, oneCCD->getDeviceName(), "CCD2"); | | |||
776 | } | | |||
777 | } | | |||
778 | } | | |||
779 | #endif | | |||
780 | | ||||
781 | targetChip->setImageView(guideView, FITS_GUIDE); | 756 | targetChip->setImageView(guideView, FITS_GUIDE); | ||
782 | 757 | | |||
783 | syncCCDInfo(); | 758 | syncCCDInfo(); | ||
784 | } | 759 | } | ||
785 | } | 760 | } | ||
786 | 761 | | |||
787 | void Guide::syncCCDInfo() | 762 | void Guide::syncCCDInfo() | ||
788 | { | 763 | { | ||
▲ Show 20 Lines • Show All 297 Lines • ▼ Show 20 Line(s) | 1031 | { | |||
1086 | 1061 | | |||
1087 | if (frameSettings.contains(targetChip)) | 1062 | if (frameSettings.contains(targetChip)) | ||
1088 | { | 1063 | { | ||
1089 | QVariantMap settings = frameSettings[targetChip]; | 1064 | QVariantMap settings = frameSettings[targetChip]; | ||
1090 | targetChip->setFrame(settings["x"].toInt(), settings["y"].toInt(), settings["w"].toInt(), | 1065 | targetChip->setFrame(settings["x"].toInt(), settings["y"].toInt(), settings["w"].toInt(), | ||
1091 | settings["h"].toInt()); | 1066 | settings["h"].toInt()); | ||
1092 | } | 1067 | } | ||
1093 | 1068 | | |||
1094 | #if 0 | | |||
1095 | switch (state) | | |||
1096 | { | | |||
1097 | case GUIDE_GUIDING: | | |||
1098 | if (Options::rapidGuideEnabled() == false) | | |||
1099 | connect(currentCCD, SIGNAL(BLOBUpdated(IBLOB*)), this, &Ekos::Guide::newFITS(IBLOB *)), Qt::UniqueConnection); | | |||
1100 | targetChip->capture(seqExpose); | | |||
1101 | return true; | | |||
1102 | break; | | |||
1103 | | ||||
1104 | default: | | |||
1105 | break; | | |||
1106 | } | | |||
1107 | #endif | | |||
1108 | | ||||
1109 | currentCCD->setTransformFormat(ISD::CCD::FORMAT_FITS); | 1069 | currentCCD->setTransformFormat(ISD::CCD::FORMAT_FITS); | ||
1110 | 1070 | | |||
1111 | connect(currentCCD, &ISD::CCD::BLOBUpdated, this, &Ekos::Guide::newFITS, Qt::UniqueConnection); | 1071 | connect(currentCCD, &ISD::CCD::BLOBUpdated, this, &Ekos::Guide::newFITS, Qt::UniqueConnection); | ||
1112 | qCDebug(KSTARS_EKOS_GUIDE) << "Capturing frame..."; | 1072 | qCDebug(KSTARS_EKOS_GUIDE) << "Capturing frame..."; | ||
1113 | 1073 | | |||
1114 | double finalExposure = seqExpose; | 1074 | double finalExposure = seqExpose; | ||
1115 | 1075 | | |||
1116 | // Increase exposure for calibration frame if we need auto-select a star | 1076 | // Increase exposure for calibration frame if we need auto-select a star | ||
▲ Show 20 Lines • Show All 283 Lines • ▼ Show 20 Line(s) | 1359 | { | |||
1400 | QStringList devices; | 1360 | QStringList devices; | ||
1401 | 1361 | | |||
1402 | foreach (ISD::ST4 *driver, ST4List) | 1362 | foreach (ISD::ST4 *driver, ST4List) | ||
1403 | devices << driver->getDeviceName(); | 1363 | devices << driver->getDeviceName(); | ||
1404 | 1364 | | |||
1405 | return devices; | 1365 | return devices; | ||
1406 | } | 1366 | } | ||
1407 | 1367 | | |||
1408 | #if 0 | | |||
1409 | void Guide::processRapidStarData(ISD::CCDChip * targetChip, double dx, double dy, double fit) | | |||
1410 | { | | |||
1411 | // Check if guide star is lost | | |||
1412 | if (dx == -1 && dy == -1 && fit == -1) | | |||
1413 | { | | |||
1414 | KSNotification::error(i18n("Lost track of the guide star. Rapid guide aborted.")); | | |||
1415 | guider->abort(); | | |||
1416 | return; | | |||
1417 | } | | |||
1418 | | ||||
1419 | FITSView * targetImage = targetChip->getImage(FITS_GUIDE); | | |||
1420 | | ||||
1421 | if (targetImage == nullptr) | | |||
1422 | { | | |||
1423 | pmath->setImageView(nullptr); | | |||
1424 | guider->setImageView(nullptr); | | |||
1425 | calibration->setImageView(nullptr); | | |||
1426 | } | | |||
1427 | | ||||
1428 | if (rapidGuideReticleSet == false) | | |||
1429 | { | | |||
1430 | // Let's set reticle parameter on first capture to those of the star, then we check if there | | |||
1431 | // is any set | | |||
1432 | double x, y, angle; | | |||
1433 | pmath->getReticleParameters(&x, &y, &angle); | | |||
1434 | pmath->setReticleParameters(dx, dy, angle); | | |||
1435 | rapidGuideReticleSet = true; | | |||
1436 | } | | |||
1437 | | ||||
1438 | pmath->setRapidStarData(dx, dy); | | |||
1439 | | ||||
1440 | if (guider->isDithering()) | | |||
1441 | { | | |||
1442 | pmath->performProcessing(); | | |||
1443 | if (guider->dither() == false) | | |||
1444 | { | | |||
1445 | appendLogText(i18n("Dithering failed. Autoguiding aborted.")); | | |||
1446 | emit newStatus(GUIDE_DITHERING_ERROR); | | |||
1447 | guider->abort(); | | |||
1448 | //emit ditherFailed(); | | |||
1449 | } | | |||
1450 | } | | |||
1451 | else | | |||
1452 | { | | |||
1453 | guider->guide(); | | |||
1454 | capture(); | | |||
1455 | } | | |||
1456 | | ||||
1457 | } | | |||
1458 | | ||||
1459 | void Guide::startRapidGuide() | | |||
1460 | { | | |||
1461 | ISD::CCDChip * targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD); | | |||
1462 | | ||||
1463 | if (currentCCD->setRapidGuide(targetChip, true) == false) | | |||
1464 | { | | |||
1465 | appendLogText(i18n("The CCD does not support Rapid Guiding. Aborting...")); | | |||
1466 | guider->abort(); | | |||
1467 | return; | | |||
1468 | } | | |||
1469 | | ||||
1470 | rapidGuideReticleSet = false; | | |||
1471 | | ||||
1472 | pmath->setRapidGuide(true); | | |||
1473 | currentCCD->configureRapidGuide(targetChip, true); | | |||
1474 | connect(currentCCD, SIGNAL(newGuideStarData(ISD::CCDChip*, double, double, double)), this, &Ekos::Guide::processRapidStarData(ISD::CCDChip *, double, double, double))); | | |||
1475 | } | | |||
1476 | | ||||
1477 | void Guide::stopRapidGuide() | | |||
1478 | { | | |||
1479 | ISD::CCDChip * targetChip = currentCCD->getChip(useGuideHead ? ISD::CCDChip::GUIDE_CCD : ISD::CCDChip::PRIMARY_CCD); | | |||
1480 | | ||||
1481 | pmath->setRapidGuide(false); | | |||
1482 | | ||||
1483 | rapidGuideReticleSet = false; | | |||
1484 | | ||||
1485 | currentCCD->disconnect(SIGNAL(newGuideStarData(ISD::CCDChip*, double, double, double))); | | |||
1486 | | ||||
1487 | currentCCD->configureRapidGuide(targetChip, false, false, false); | | |||
1488 | | ||||
1489 | currentCCD->setRapidGuide(targetChip, false); | | |||
1490 | } | | |||
1491 | #endif | | |||
1492 | 1368 | | |||
1493 | bool Guide::calibrate() | 1369 | bool Guide::calibrate() | ||
1494 | { | 1370 | { | ||
1495 | // Set status to idle and let the operations change it as they get executed | 1371 | // Set status to idle and let the operations change it as they get executed | ||
1496 | state = GUIDE_IDLE; | 1372 | state = GUIDE_IDLE; | ||
1497 | emit newStatus(state); | 1373 | emit newStatus(state); | ||
1498 | 1374 | | |||
1499 | if (guiderType == GUIDE_INTERNAL) | 1375 | if (guiderType == GUIDE_INTERNAL) | ||
▲ Show 20 Lines • Show All 261 Lines • ▼ Show 20 Line(s) | |||||
1761 | { | 1637 | { | ||
1762 | Options::setGuideSubframeEnabled(enable); | 1638 | Options::setGuideSubframeEnabled(enable); | ||
1763 | if (subFrameCheck->isChecked() != enable) | 1639 | if (subFrameCheck->isChecked() != enable) | ||
1764 | subFrameCheck->setChecked(enable); | 1640 | subFrameCheck->setChecked(enable); | ||
1765 | if(guiderType == GUIDE_PHD2) | 1641 | if(guiderType == GUIDE_PHD2) | ||
1766 | setExternalGuiderBLOBEnabled(!enable); | 1642 | setExternalGuiderBLOBEnabled(!enable); | ||
1767 | } | 1643 | } | ||
1768 | 1644 | | |||
1769 | #if 0 | | |||
1770 | void Guide::setGuideRapidEnabled(bool enable) | | |||
1771 | { | | |||
1772 | //guider->setGuideOptions(guider->getAlgorithm(), guider->useSubFrame() , enable); | | |||
1773 | } | | |||
1774 | #endif | | |||
1775 | 1645 | | |||
1776 | void Guide::setDitherSettings(bool enable, double value) | 1646 | void Guide::setDitherSettings(bool enable, double value) | ||
1777 | { | 1647 | { | ||
1778 | Options::setDitherEnabled(enable); | 1648 | Options::setDitherEnabled(enable); | ||
1779 | Options::setDitherPixels(value); | 1649 | Options::setDitherPixels(value); | ||
1780 | } | 1650 | } | ||
1781 | 1651 | | |||
1782 | #if 0 | | |||
1783 | void Guide::startAutoCalibrateGuide() | | |||
1784 | { | | |||
1785 | // A must for auto stuff | | |||
1786 | Options::setGuideAutoStarEnabled(true); | | |||
1787 | | ||||
1788 | if (Options::resetGuideCalibration()) | | |||
1789 | clearCalibration(); | | |||
1790 | | ||||
1791 | guide(); | | |||
1792 | | ||||
1793 | #if 0 | | |||
1794 | if (guiderType == GUIDE_INTERNAL) | | |||
1795 | { | | |||
1796 | calibrationComplete = false; | | |||
1797 | autoCalibrateGuide = true; | | |||
1798 | calibrate(); | | |||
1799 | } | | |||
1800 | else | | |||
1801 | { | | |||
1802 | calibrationComplete = true; | | |||
1803 | autoCalibrateGuide = true; | | |||
1804 | guide(); | | |||
1805 | } | | |||
1806 | #endif | | |||
1807 | } | | |||
1808 | #endif | | |||
1809 | 1652 | | |||
1810 | void Guide::clearCalibration() | 1653 | void Guide::clearCalibration() | ||
1811 | { | 1654 | { | ||
1812 | calibrationComplete = false; | 1655 | calibrationComplete = false; | ||
1813 | 1656 | | |||
1814 | guider->clearCalibration(); | 1657 | guider->clearCalibration(); | ||
1815 | 1658 | | |||
1816 | appendLogText(i18n("Calibration is cleared.")); | 1659 | appendLogText(i18n("Calibration is cleared.")); | ||
▲ Show 20 Lines • Show All 646 Lines • ▼ Show 20 Line(s) | 2277 | { | |||
2463 | } | 2306 | } | ||
2464 | 2307 | | |||
2465 | //Re-enable connections | 2308 | //Re-enable connections | ||
2466 | connect(checkBox_DirDEC, &QCheckBox::toggled, this, &Ekos::Guide::onEnableDirDEC); | 2309 | connect(checkBox_DirDEC, &QCheckBox::toggled, this, &Ekos::Guide::onEnableDirDEC); | ||
2467 | connect(northControlCheck, &QCheckBox::toggled, this, &Ekos::Guide::onControlDirectionChanged); | 2310 | connect(northControlCheck, &QCheckBox::toggled, this, &Ekos::Guide::onControlDirectionChanged); | ||
2468 | connect(southControlCheck, &QCheckBox::toggled, this, &Ekos::Guide::onControlDirectionChanged); | 2311 | connect(southControlCheck, &QCheckBox::toggled, this, &Ekos::Guide::onControlDirectionChanged); | ||
2469 | } | 2312 | } | ||
2470 | 2313 | | |||
2471 | #if 0 | | |||
2472 | void Guide::onRapidGuideChanged(bool enable) | | |||
2473 | { | | |||
2474 | if (m_isStarted) | | |||
2475 | { | | |||
2476 | guideModule->appendLogText(i18n("You must stop auto guiding before changing this setting.")); | | |||
2477 | return; | | |||
2478 | } | | |||
2479 | | ||||
2480 | m_useRapidGuide = enable; | | |||
2481 | | ||||
2482 | if (m_useRapidGuide) | | |||
2483 | { | | |||
2484 | guideModule->appendLogText(i18n("Rapid Guiding is enabled. Guide star will be determined automatically by the CCD driver. No frames are sent to Ekos unless explicitly enabled by the user in the CCD driver settings.")); | | |||
2485 | } | | |||
2486 | else | | |||
2487 | guideModule->appendLogText(i18n("Rapid Guiding is disabled.")); | | |||
2488 | } | | |||
2489 | #endif | | |||
2490 | 2314 | | |||
2491 | void Guide::loadSettings() | 2315 | void Guide::loadSettings() | ||
2492 | { | 2316 | { | ||
2493 | // Exposure | 2317 | // Exposure | ||
2494 | exposureIN->setValue(Options::guideExposure()); | 2318 | exposureIN->setValue(Options::guideExposure()); | ||
2495 | // Box Size | 2319 | // Box Size | ||
2496 | boxSizeCombo->setCurrentIndex(Options::guideSquareSizeIndex()); | 2320 | boxSizeCombo->setCurrentIndex(Options::guideSquareSizeIndex()); | ||
2497 | // Dark frame? | 2321 | // Dark frame? | ||
▲ Show 20 Lines • Show All 1202 Lines • Show Last 20 Lines |