Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/focus/focus.cpp
Show First 20 Lines • Show All 638 Lines • ▼ Show 20 Line(s) | 576 | { | |||
---|---|---|---|---|---|
639 | if (firstGaus) | 639 | if (firstGaus) | ||
640 | { | 640 | { | ||
641 | profilePlot->removeGraph(firstGaus); | 641 | profilePlot->removeGraph(firstGaus); | ||
642 | firstGaus = nullptr; | 642 | firstGaus = nullptr; | ||
643 | } | 643 | } | ||
644 | 644 | | |||
645 | // Options::setFocusTicks(stepIN->value()); | 645 | // Options::setFocusTicks(stepIN->value()); | ||
646 | // Options::setFocusTolerance(toleranceIN->value()); | 646 | // Options::setFocusTolerance(toleranceIN->value()); | ||
647 | // //Options::setFocusExposure(exposureIN->value()); | 647 | // Options::setFocusExposure(exposureIN->value()); | ||
648 | // Options::setFocusMaxTravel(maxTravelIN->value()); | 648 | // Options::setFocusMaxTravel(maxTravelIN->value()); | ||
649 | // Options::setFocusBoxSize(focusBoxSize->value()); | 649 | // Options::setFocusBoxSize(focusBoxSize->value()); | ||
650 | // Options::setFocusSubFrame(useSubFrame->isChecked()); | 650 | // Options::setFocusSubFrame(useSubFrame->isChecked()); | ||
651 | // Options::setFocusAutoStarEnabled(useAutoStar->isChecked()); | 651 | // Options::setFocusAutoStarEnabled(useAutoStar->isChecked()); | ||
652 | // Options::setSuspendGuiding(suspendGuideCheck->isChecked()); | 652 | // Options::setSuspendGuiding(suspendGuideCheck->isChecked()); | ||
653 | // Options::setUseFocusDarkFrame(darkFrameCheck->isChecked()); | 653 | // Options::setUseFocusDarkFrame(darkFrameCheck->isChecked()); | ||
654 | // Options::setFocusFramesCount(focusFramesSpin->value()); | 654 | // Options::setFocusFramesCount(focusFramesSpin->value()); | ||
655 | // Options::setFocusUseFullField(useFullField->isChecked()); | 655 | // Options::setFocusUseFullField(useFullField->isChecked()); | ||
656 | 656 | | |||
657 | qCDebug(KSTARS_EKOS_FOCUS) << "Starting focus with box size: " << focusBoxSize->value() | 657 | qCDebug(KSTARS_EKOS_FOCUS) << "Starting focus with box size: " << focusBoxSize->value() | ||
658 | << " Subframe: " << ( useSubFrame->isChecked() ? "yes" : "no" ) | 658 | << " Subframe: " << ( useSubFrame->isChecked() ? "yes" : "no" ) | ||
659 | << " Autostar: " << ( useAutoStar->isChecked() ? "yes" : "no" ) | 659 | << " Autostar: " << ( useAutoStar->isChecked() ? "yes" : "no" ) | ||
660 | << " Full frame: " << ( useFullField->isChecked() ? "yes" : "no " ) | 660 | << " Full frame: " << ( useFullField->isChecked() ? "yes" : "no " ) | ||
661 | << " [" << fullFieldInnerRing->value() << "%," << fullFieldOuterRing->value() << "%]" | 661 | << " [" << fullFieldInnerRing->value() << "%," << fullFieldOuterRing->value() << "%]" | ||
662 | << " Step Size: " << stepIN->value() << " Threshold: " << thresholdSpin->value() | 662 | << " Step Size: " << stepIN->value() << " Threshold: " << thresholdSpin->value() | ||
663 | << " Gaussian Sigma: " << gaussianSigmaSpin->value() | ||||
664 | << " Gaussian Kernel size: " << gaussianKernelSizeSpin->value() | ||||
665 | << " Multi row average: " << multiRowAverageSpin->value() | ||||
663 | << " Tolerance: " << toleranceIN->value() | 666 | << " Tolerance: " << toleranceIN->value() | ||
664 | << " Frames: " << 1 /*focusFramesSpin->value()*/ << " Maximum Travel: " << maxTravelIN->value(); | 667 | << " Frames: " << 1 /*focusFramesSpin->value()*/ << " Maximum Travel: " << maxTravelIN->value(); | ||
665 | 668 | | |||
666 | if (useAutoStar->isChecked()) | 669 | if (useAutoStar->isChecked()) | ||
667 | appendLogText(i18n("Autofocus in progress...")); | 670 | appendLogText(i18n("Autofocus in progress...")); | ||
668 | else | 671 | else | ||
669 | appendLogText(i18n("Please wait until image capture is complete...")); | 672 | appendLogText(i18n("Please wait until image capture is complete...")); | ||
670 | 673 | | |||
▲ Show 20 Lines • Show All 2620 Lines • ▼ Show 20 Line(s) | 3274 | { | |||
3291 | else if (dsb == GuideSettleTime) | 3294 | else if (dsb == GuideSettleTime) | ||
3292 | Options::setGuideSettleTime(dsb->value()); | 3295 | Options::setGuideSettleTime(dsb->value()); | ||
3293 | else if (dsb == maxTravelIN) | 3296 | else if (dsb == maxTravelIN) | ||
3294 | Options::setFocusMaxTravel(dsb->value()); | 3297 | Options::setFocusMaxTravel(dsb->value()); | ||
3295 | else if (dsb == toleranceIN) | 3298 | else if (dsb == toleranceIN) | ||
3296 | Options::setFocusTolerance(dsb->value()); | 3299 | Options::setFocusTolerance(dsb->value()); | ||
3297 | else if (dsb == thresholdSpin) | 3300 | else if (dsb == thresholdSpin) | ||
3298 | Options::setFocusThreshold(dsb->value()); | 3301 | Options::setFocusThreshold(dsb->value()); | ||
3302 | else if (dsb == gaussianSigmaSpin) | ||||
3303 | Options::setFocusGaussianSigma(dsb->value()); | ||||
3299 | } | 3304 | } | ||
3300 | else if ( (sb = qobject_cast<QSpinBox*>(sender()))) | 3305 | else if ( (sb = qobject_cast<QSpinBox*>(sender()))) | ||
3301 | { | 3306 | { | ||
3302 | /////////////////////////////////////////////////////////////////////////// | 3307 | /////////////////////////////////////////////////////////////////////////// | ||
3303 | /// Settings Group | 3308 | /// Settings Group | ||
3304 | /////////////////////////////////////////////////////////////////////////// | 3309 | /////////////////////////////////////////////////////////////////////////// | ||
3305 | if (sb == focusBoxSize) | 3310 | if (sb == focusBoxSize) | ||
3306 | Options::setFocusBoxSize(sb->value()); | 3311 | Options::setFocusBoxSize(sb->value()); | ||
3307 | else if (sb == stepIN) | 3312 | else if (sb == stepIN) | ||
3308 | Options::setFocusTicks(sb->value()); | 3313 | Options::setFocusTicks(sb->value()); | ||
3309 | else if (sb == maxSingleStepIN) | 3314 | else if (sb == maxSingleStepIN) | ||
3310 | Options::setFocusMaxSingleStep(sb->value()); | 3315 | Options::setFocusMaxSingleStep(sb->value()); | ||
3311 | else if (sb == focusFramesSpin) | 3316 | else if (sb == focusFramesSpin) | ||
3312 | Options::setFocusFramesCount(sb->value()); | 3317 | Options::setFocusFramesCount(sb->value()); | ||
3318 | else if (sb == gaussianKernelSizeSpin) | ||||
3319 | Options::setFocusGaussianKernelSize(sb->value()); | ||||
3320 | else if (sb == multiRowAverageSpin) | ||||
3321 | Options::setFocusMultiRowAverage(sb->value()); | ||||
3313 | } | 3322 | } | ||
3314 | else if ( (cb = qobject_cast<QCheckBox*>(sender()))) | 3323 | else if ( (cb = qobject_cast<QCheckBox*>(sender()))) | ||
3315 | { | 3324 | { | ||
3316 | /////////////////////////////////////////////////////////////////////////// | 3325 | /////////////////////////////////////////////////////////////////////////// | ||
3317 | /// Settings Group | 3326 | /// Settings Group | ||
3318 | /////////////////////////////////////////////////////////////////////////// | 3327 | /////////////////////////////////////////////////////////////////////////// | ||
3319 | if (cb == useAutoStar) | 3328 | if (cb == useAutoStar) | ||
3320 | Options::setFocusAutoStarEnabled(cb->isChecked()); | 3329 | Options::setFocusAutoStarEnabled(cb->isChecked()); | ||
▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | 3368 | { | |||
3372 | activeBin = Options::focusXBin(); | 3381 | activeBin = Options::focusXBin(); | ||
3373 | binningCombo->setCurrentIndex(activeBin - 1); | 3382 | binningCombo->setCurrentIndex(activeBin - 1); | ||
3374 | // Gain | 3383 | // Gain | ||
3375 | gainIN->setValue(Options::focusGain()); | 3384 | gainIN->setValue(Options::focusGain()); | ||
3376 | 3385 | | |||
3377 | /////////////////////////////////////////////////////////////////////////// | 3386 | /////////////////////////////////////////////////////////////////////////// | ||
3378 | /// Settings Group | 3387 | /// Settings Group | ||
3379 | /////////////////////////////////////////////////////////////////////////// | 3388 | /////////////////////////////////////////////////////////////////////////// | ||
3380 | // Auto Star? | | |||
3381 | useAutoStar->setChecked(Options::focusAutoStarEnabled()); | | |||
3382 | // Subframe? | 3389 | // Subframe? | ||
3383 | useSubFrame->setChecked(Options::focusSubFrame()); | 3390 | useSubFrame->setChecked(Options::focusSubFrame()); | ||
3384 | // Dark frame? | 3391 | // Dark frame? | ||
3385 | darkFrameCheck->setChecked(Options::useFocusDarkFrame()); | 3392 | darkFrameCheck->setChecked(Options::useFocusDarkFrame()); | ||
3386 | // Use full field? | 3393 | // Use full field? | ||
3387 | useFullField->setChecked(Options::focusUseFullField()); | 3394 | useFullField->setChecked(Options::focusUseFullField()); | ||
3388 | // full field inner ring | 3395 | // full field inner ring | ||
3389 | fullFieldInnerRing->setValue(Options::focusFullFieldInnerRadius()); | 3396 | fullFieldInnerRing->setValue(Options::focusFullFieldInnerRadius()); | ||
Show All 22 Lines | |||||
3412 | focusAlgorithm = static_cast<FocusAlgorithm>(Options::focusAlgorithm()); | 3419 | focusAlgorithm = static_cast<FocusAlgorithm>(Options::focusAlgorithm()); | ||
3413 | focusAlgorithmCombo->setCurrentIndex(focusAlgorithm); | 3420 | focusAlgorithmCombo->setCurrentIndex(focusAlgorithm); | ||
3414 | // Frames Count | 3421 | // Frames Count | ||
3415 | focusFramesSpin->setValue(Options::focusFramesCount()); | 3422 | focusFramesSpin->setValue(Options::focusFramesCount()); | ||
3416 | // Focus Detection | 3423 | // Focus Detection | ||
3417 | focusDetection = static_cast<StarAlgorithm>(Options::focusDetection()); | 3424 | focusDetection = static_cast<StarAlgorithm>(Options::focusDetection()); | ||
3418 | thresholdSpin->setEnabled(focusDetection == ALGORITHM_THRESHOLD); | 3425 | thresholdSpin->setEnabled(focusDetection == ALGORITHM_THRESHOLD); | ||
3419 | focusDetectionCombo->setCurrentIndex(focusDetection); | 3426 | focusDetectionCombo->setCurrentIndex(focusDetection); | ||
3427 | // Gaussian blur | ||||
3428 | gaussianSigmaSpin->setValue(Options::focusGaussianSigma()); | ||||
3429 | gaussianKernelSizeSpin->setValue(Options::focusGaussianKernelSize()); | ||||
3430 | // Hough algorithm multi row average | ||||
3431 | multiRowAverageSpin->setValue(Options::focusMultiRowAverage()); | ||||
3432 | multiRowAverageSpin->setEnabled(focusDetection == ALGORITHM_BAHTINOV); | ||||
3433 | | ||||
3434 | // Increase focus box size in case of Bahtinov mask focus | ||||
3435 | // Disable auto star in case of Bahtinov mask focus | ||||
3436 | if (focusDetection == ALGORITHM_BAHTINOV) | ||||
3437 | { | ||||
3438 | Options::setFocusAutoStarEnabled(false); | ||||
3439 | focusBoxSize->setMaximum(512); | ||||
3440 | } | ||||
3441 | else | ||||
3442 | { | ||||
3443 | // When not using Bathinov mask, limit box size to 256 and make sure value stays within range. | ||||
3444 | if (Options::focusBoxSize() > 256) { | ||||
3445 | Options::setFocusBoxSize(32); | ||||
3446 | } | ||||
3447 | focusBoxSize->setMaximum(256); | ||||
3448 | } | ||||
3449 | // Box Size | ||||
3450 | focusBoxSize->setValue(Options::focusBoxSize()); | ||||
3451 | // Auto Star? | ||||
3452 | useAutoStar->setChecked(Options::focusAutoStarEnabled()); | ||||
3453 | useAutoStar->setEnabled(focusDetection != ALGORITHM_BAHTINOV); | ||||
3420 | } | 3454 | } | ||
3421 | 3455 | | |||
3422 | void Focus::initSettingsConnections() | 3456 | void Focus::initSettingsConnections() | ||
3423 | { | 3457 | { | ||
3424 | /////////////////////////////////////////////////////////////////////////// | 3458 | /////////////////////////////////////////////////////////////////////////// | ||
3425 | /// Focuser Group | 3459 | /// Focuser Group | ||
3426 | /////////////////////////////////////////////////////////////////////////// | 3460 | /////////////////////////////////////////////////////////////////////////// | ||
3427 | connect(focuserCombo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), this, | 3461 | connect(focuserCombo, static_cast<void (QComboBox::*)(const QString &)>(&QComboBox::activated), this, | ||
Show All 25 Lines | |||||
3453 | connect(GuideSettleTime, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | 3487 | connect(GuideSettleTime, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||
3454 | 3488 | | |||
3455 | connect(focusBoxSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Focus::syncSettings); | 3489 | connect(focusBoxSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Focus::syncSettings); | ||
3456 | connect(maxTravelIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | 3490 | connect(maxTravelIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||
3457 | connect(stepIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | 3491 | connect(stepIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||
3458 | connect(maxSingleStepIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | 3492 | connect(maxSingleStepIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||
3459 | connect(toleranceIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | 3493 | connect(toleranceIN, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||
3460 | connect(thresholdSpin, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | 3494 | connect(thresholdSpin, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||
3495 | connect(gaussianSigmaSpin, &QDoubleSpinBox::editingFinished, this, &Focus::syncSettings); | ||||
3496 | connect(gaussianKernelSizeSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Focus::syncSettings); | ||||
3497 | connect(multiRowAverageSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Focus::syncSettings); | ||||
3461 | 3498 | | |||
3462 | connect(focusAlgorithmCombo, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::activated), this, | 3499 | connect(focusAlgorithmCombo, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::activated), this, | ||
3463 | &Ekos::Focus::syncSettings); | 3500 | &Ekos::Focus::syncSettings); | ||
3464 | connect(focusFramesSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Focus::syncSettings); | 3501 | connect(focusFramesSpin, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Focus::syncSettings); | ||
3465 | connect(focusDetectionCombo, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::activated), this, | 3502 | connect(focusDetectionCombo, static_cast<void(QComboBox::*)(const QString &)>(&QComboBox::activated), this, | ||
3466 | &Ekos::Focus::syncSettings); | 3503 | &Ekos::Focus::syncSettings); | ||
3467 | } | 3504 | } | ||
3468 | 3505 | | |||
▲ Show 20 Lines • Show All 205 Lines • ▼ Show 20 Line(s) | 3636 | { | |||
3674 | // Update the focuser box size used to enclose a star | 3711 | // Update the focuser box size used to enclose a star | ||
3675 | connect(focusBoxSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Ekos::Focus::updateBoxSize); | 3712 | connect(focusBoxSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &Ekos::Focus::updateBoxSize); | ||
3676 | 3713 | | |||
3677 | // Update the focuser star detection if the detection algorithm selection changes. | 3714 | // Update the focuser star detection if the detection algorithm selection changes. | ||
3678 | connect(focusDetectionCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [&](int index) | 3715 | connect(focusDetectionCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [&](int index) | ||
3679 | { | 3716 | { | ||
3680 | focusDetection = static_cast<StarAlgorithm>(index); | 3717 | focusDetection = static_cast<StarAlgorithm>(index); | ||
3681 | thresholdSpin->setEnabled(focusDetection == ALGORITHM_THRESHOLD); | 3718 | thresholdSpin->setEnabled(focusDetection == ALGORITHM_THRESHOLD); | ||
3719 | multiRowAverageSpin->setEnabled(focusDetection == ALGORITHM_BAHTINOV); | ||||
3720 | if (focusDetection == ALGORITHM_BAHTINOV) | ||||
3721 | { | ||||
3722 | // In case of Bahtinov mask uncheck auto select star | ||||
3723 | useAutoStar->setChecked(false); | ||||
3724 | focusBoxSize->setMaximum(512); | ||||
3725 | } | ||||
3726 | else | ||||
3727 | { | ||||
3728 | // When not using Bathinov mask, limit box size to 256 and make sure value stays within range. | ||||
3729 | if (Options::focusBoxSize() > 256) | ||||
3730 | { | ||||
3731 | Options::setFocusBoxSize(32); | ||||
3732 | // Focus box size changed, update control | ||||
3733 | focusBoxSize->setValue(Options::focusBoxSize()); | ||||
3734 | } | ||||
3735 | focusBoxSize->setMaximum(256); | ||||
3736 | } | ||||
3737 | useAutoStar->setEnabled(focusDetection != ALGORITHM_BAHTINOV); | ||||
3682 | }); | 3738 | }); | ||
3683 | 3739 | | |||
3684 | // Update the focuser solution algorithm if the selection changes. | 3740 | // Update the focuser solution algorithm if the selection changes. | ||
3685 | connect(focusAlgorithmCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [&](int index) | 3741 | connect(focusAlgorithmCombo, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated), this, [&](int index) | ||
3686 | { | 3742 | { | ||
3687 | focusAlgorithm = static_cast<FocusAlgorithm>(index); | 3743 | focusAlgorithm = static_cast<FocusAlgorithm>(index); | ||
3688 | }); | 3744 | }); | ||
3689 | 3745 | | |||
Show All 27 Lines |