Changeset View
Changeset View
Standalone View
Standalone View
kstars/ekos/focus/focus.cpp
Show First 20 Lines • Show All 518 Lines • ▼ Show 20 Line(s) | 518 | if (currentFocuser) | |||
---|---|---|---|---|---|
519 | currentFocuser->setBacklash(value); | 519 | currentFocuser->setBacklash(value); | ||
520 | }); | 520 | }); | ||
521 | } | 521 | } | ||
522 | else | 522 | else | ||
523 | { | 523 | { | ||
524 | focusBacklashSpin->setValue(0); | 524 | focusBacklashSpin->setValue(0); | ||
525 | } | 525 | } | ||
526 | 526 | | |||
527 | getCurrentFocuserTemperature(); | ||||
528 | | ||||
527 | connect(currentFocuser, &ISD::GDInterface::numberUpdated, this, &Ekos::Focus::processFocusNumber, Qt::UniqueConnection); | 529 | connect(currentFocuser, &ISD::GDInterface::numberUpdated, this, &Ekos::Focus::processFocusNumber, Qt::UniqueConnection); | ||
528 | //connect(currentFocuser, SIGNAL(propertyDefined(INDI::Property*)), this, &Ekos::Focus::(registerFocusProperty(INDI::Property*)), Qt::UniqueConnection); | 530 | //connect(currentFocuser, SIGNAL(propertyDefined(INDI::Property*)), this, &Ekos::Focus::(registerFocusProperty(INDI::Property*)), Qt::UniqueConnection); | ||
529 | 531 | | |||
530 | resetButtons(); | 532 | resetButtons(); | ||
531 | 533 | | |||
532 | //if (!inAutoFocus && !inFocusLoop && !captureInProgress && !inSequenceFocus) | 534 | //if (!inAutoFocus && !inFocusLoop && !captureInProgress && !inSequenceFocus) | ||
533 | // emit autoFocusFinished(true, -1); | 535 | // emit autoFocusFinished(true, -1); | ||
534 | } | 536 | } | ||
Show All 32 Lines | 558 | { | |||
567 | 569 | | |||
568 | absTicksLabel->setText(QString::number(static_cast<int>(currentPosition))); | 570 | absTicksLabel->setText(QString::number(static_cast<int>(currentPosition))); | ||
569 | 571 | | |||
570 | stepIN->setMaximum(absMove->np[0].max / 2); | 572 | stepIN->setMaximum(absMove->np[0].max / 2); | ||
571 | //absTicksSpin->setValue(currentPosition); | 573 | //absTicksSpin->setValue(currentPosition); | ||
572 | } | 574 | } | ||
573 | } | 575 | } | ||
574 | 576 | | |||
577 | void Focus::getCurrentFocuserTemperature() | ||||
578 | { | ||||
579 | INumberVectorProperty *focuserTemperature = currentFocuser->getBaseDevice()->getNumber("FOCUS_TEMPERATURE"); | ||||
580 | | ||||
581 | if (focuserTemperature && focuserTemperature->s != IPS_ALERT) | ||||
582 | { | ||||
583 | currentTemperature = focuserTemperature->np[0].value; | ||||
584 | qCDebug(KSTARS_EKOS_FOCUS) << QString("Setting current focuser temperature: %1").arg(currentTemperature, 0, 'f', 2); | ||||
TallFurryMan: You could use numeric precision here for your log. | |||||
585 | } | ||||
586 | else | ||||
587 | { | ||||
588 | currentTemperature = INVALID_VALUE; | ||||
589 | qCDebug(KSTARS_EKOS_FOCUS) << QString("Focuser temperature is not available"); | ||||
590 | } | ||||
591 | } | ||||
592 | | ||||
575 | void Focus::start() | 593 | void Focus::start() | ||
576 | { | 594 | { | ||
577 | if (currentCCD == nullptr) | 595 | if (currentCCD == nullptr) | ||
578 | { | 596 | { | ||
579 | appendLogText(i18n("No CCD connected.")); | 597 | appendLogText(i18n("No CCD connected.")); | ||
580 | return; | 598 | return; | ||
581 | } | 599 | } | ||
582 | 600 | | |||
583 | lastFocusDirection = FOCUS_NONE; | 601 | lastFocusDirection = FOCUS_NONE; | ||
584 | 602 | | |||
585 | polySolutionFound = 0; | 603 | polySolutionFound = 0; | ||
586 | 604 | | |||
587 | waitStarSelectTimer.stop(); | 605 | waitStarSelectTimer.stop(); | ||
588 | 606 | | |||
589 | starsHFR.clear(); | 607 | starsHFR.clear(); | ||
590 | 608 | | |||
591 | lastHFR = 0; | 609 | lastHFR = 0; | ||
592 | 610 | | |||
611 | // Forget last focus temperature, reset temperature delta | ||||
612 | lastFocusTemperature = INVALID_VALUE; | ||||
613 | emit newFocusTemperatureDelta(0); | ||||
614 | | ||||
593 | if (canAbsMove) | 615 | if (canAbsMove) | ||
594 | { | 616 | { | ||
595 | absIterations = 0; | 617 | absIterations = 0; | ||
596 | getAbsFocusPosition(); | 618 | getAbsFocusPosition(); | ||
597 | pulseDuration = stepIN->value(); | 619 | pulseDuration = stepIN->value(); | ||
598 | } | 620 | } | ||
599 | else if (canRelMove) | 621 | else if (canRelMove) | ||
600 | { | 622 | { | ||
▲ Show 20 Lines • Show All 1702 Lines • ▼ Show 20 Line(s) | 2324 | { | |||
2303 | // Return if it is not our current focuser | 2325 | // Return if it is not our current focuser | ||
2304 | if (nvp->device != currentFocuser->getDeviceName()) | 2326 | if (nvp->device != currentFocuser->getDeviceName()) | ||
2305 | return; | 2327 | return; | ||
2306 | 2328 | | |||
2307 | // Only process focus properties | 2329 | // Only process focus properties | ||
2308 | if (QString(nvp->name).contains("focus", Qt::CaseInsensitive) == false) | 2330 | if (QString(nvp->name).contains("focus", Qt::CaseInsensitive) == false) | ||
2309 | return; | 2331 | return; | ||
2310 | 2332 | | |||
2311 | qCDebug(KSTARS_EKOS_FOCUS) << QString("processFocusNumber %1 %2") | 2333 | qCDebug(KSTARS_EKOS_FOCUS) << QString("processFocusNumber %1 state: %2") | ||
2312 | .arg(nvp->name).arg(nvp->s == IPS_OK ? "OK" : "ERROR"); | 2334 | .arg(nvp->name).arg(nvp->s); | ||
2313 | 2335 | | |||
2314 | if (!strcmp(nvp->name, "FOCUS_BACKLASH_STEPS")) | 2336 | if (!strcmp(nvp->name, "FOCUS_BACKLASH_STEPS")) | ||
2315 | { | 2337 | { | ||
2316 | focusBacklashSpin->setValue(nvp->np[0].value); | 2338 | focusBacklashSpin->setValue(nvp->np[0].value); | ||
2317 | return; | 2339 | return; | ||
2318 | } | 2340 | } | ||
2319 | 2341 | | |||
2342 | if (!strcmp(nvp->name, "FOCUS_TEMPERATURE")) | ||||
2343 | { | ||||
2344 | currentTemperature = nvp->np[0].value; | ||||
2345 | if (lastFocusTemperature != INVALID_VALUE && currentTemperature != INVALID_VALUE) | ||||
2346 | { | ||||
2347 | emit newFocusTemperatureDelta(abs(currentTemperature - lastFocusTemperature)); | ||||
2348 | } | ||||
2349 | else | ||||
2350 | { | ||||
2351 | emit newFocusTemperatureDelta(0); | ||||
2352 | } | ||||
2353 | return; | ||||
2354 | } | ||||
2355 | | ||||
2320 | if (!strcmp(nvp->name, "ABS_FOCUS_POSITION")) | 2356 | if (!strcmp(nvp->name, "ABS_FOCUS_POSITION")) | ||
2321 | { | 2357 | { | ||
2322 | INumber *pos = IUFindNumber(nvp, "FOCUS_ABSOLUTE_POSITION"); | 2358 | INumber *pos = IUFindNumber(nvp, "FOCUS_ABSOLUTE_POSITION"); | ||
2323 | if (pos) | 2359 | if (pos) | ||
2324 | { | 2360 | { | ||
2325 | currentPosition = pos->value; | 2361 | currentPosition = pos->value; | ||
2326 | qCDebug(KSTARS_EKOS_FOCUS) << QString("Abs Focuser position changed to %1").arg(currentPosition); | 2362 | qCDebug(KSTARS_EKOS_FOCUS) << QString("Abs Focuser position changed to %1").arg(currentPosition); | ||
2327 | absTicksLabel->setText(QString::number(static_cast<int>(currentPosition))); | 2363 | absTicksLabel->setText(QString::number(static_cast<int>(currentPosition))); | ||
▲ Show 20 Lines • Show All 457 Lines • ▼ Show 20 Line(s) | |||||
2785 | void Focus::setAutoFocusResult(bool status) | 2821 | void Focus::setAutoFocusResult(bool status) | ||
2786 | { | 2822 | { | ||
2787 | qCDebug(KSTARS_EKOS_FOCUS) << "AutoFocus result:" << status; | 2823 | qCDebug(KSTARS_EKOS_FOCUS) << "AutoFocus result:" << status; | ||
2788 | 2824 | | |||
2789 | if (status) | 2825 | if (status) | ||
2790 | { | 2826 | { | ||
2791 | // CR add auto focus position, temperature and filter to log in CSV format | 2827 | // CR add auto focus position, temperature and filter to log in CSV format | ||
2792 | // this will help with setting up focus offsets and temperature compensation | 2828 | // this will help with setting up focus offsets and temperature compensation | ||
2793 | INDI::Property * np = currentFocuser->getProperty("TemperatureNP"); | 2829 | qCInfo(KSTARS_EKOS_FOCUS) << "Autofocus values: position, " << currentPosition << ", temperature, " | ||
2794 | double temperature = -274; // impossible temperature as a signal that it isn't available | 2830 | << currentTemperature << ", filter, " << filter(); | ||
2795 | if (np != nullptr) | 2831 | lastFocusTemperature = currentTemperature; | ||
2796 | { | 2832 | emit newFocusTemperatureDelta(0); | ||
2797 | INumberVectorProperty * tnp = np->getNumber(); | | |||
2798 | temperature = tnp->np[0].value; | | |||
2799 | } | | |||
2800 | qCInfo(KSTARS_EKOS_FOCUS) << "Autofocus values: position, " << currentPosition << ", temperature, " << temperature << | | |||
2801 | ", filter, " << filter(); | | |||
2802 | } | 2833 | } | ||
2803 | 2834 | | |||
2804 | // In case of failure, go back to last position if the focuser is absolute | 2835 | // In case of failure, go back to last position if the focuser is absolute | ||
2805 | if (status == false && canAbsMove && currentFocuser && currentFocuser->isConnected() && | 2836 | if (status == false && canAbsMove && currentFocuser && currentFocuser->isConnected() && | ||
2806 | initialFocuserAbsPosition >= 0) | 2837 | initialFocuserAbsPosition >= 0) | ||
2807 | { | 2838 | { | ||
2808 | currentFocuser->moveAbs(initialFocuserAbsPosition); | 2839 | currentFocuser->moveAbs(initialFocuserAbsPosition); | ||
2809 | appendLogText(i18n("Autofocus failed, moving back to initial focus position %1.", initialFocuserAbsPosition)); | 2840 | appendLogText(i18n("Autofocus failed, moving back to initial focus position %1.", initialFocuserAbsPosition)); | ||
▲ Show 20 Lines • Show All 963 Lines • Show Last 20 Lines |
You could use numeric precision here for your log.