Kstars
adaptivefocus.cpp
37 qCDebug(KSTARS_EKOS_FOCUS) << "runAdaptiveFocus called but focus filterManager is null. Ignoring.";
44 qCDebug(KSTARS_EKOS_FOCUS) << "runAdaptiveFocus called but focusAdaptive->isChecked is false. Ignoring.";
51 qCDebug(KSTARS_EKOS_FOCUS) << "runAdaptiveFocus called whilst already inAdaptiveFocus. Ignoring.";
56 if (m_focus->inAutoFocus || m_focus->inFocusLoop || m_focus->inAdjustFocus || m_focus->inBuildOffsets)
58 qCDebug(KSTARS_EKOS_FOCUS) << "adaptiveFocus called whilst other focus activity in progress. Ignoring.";
80 qCDebug(KSTARS_EKOS_FOCUS) << "runAdaptiveFocus unable to get last Autofocus details. Ignoring.";
88 // Find out if there is anything to do for temperature, firstly do we have a valid temperature source
91 if (m_focus->currentTemperatureSourceElement && m_focus->m_LastSourceAutofocusTemperature != INVALID_VALUE)
101 const double tempDeltaLast = m_LastAdaptiveFocusTemperature - m_focus->m_LastSourceAutofocusTemperature;
131 // proposedPosition is where focuser should move; proposedPositionLast is where focuser should have moved in last Adaptive iterative
133 int proposedPositionLast = refPosition + static_cast<int>(round(tempTicksDeltaLast + altTicksDeltaLast));
140 // If everything is going to plan the currentPosition will equal proposedPositionLast. If the focuser hasn't moved exactly to the
141 // requested position, e.g. its 1 or 2 ticks away then we need to account for this Positioning Error. It will have been reported
142 // on the last Adaptive run but we now need to reverse that positioning error out in the accounting for this run
145 // There could be a rounding error, where, for example, a small change in temp/alt (e.g. 0.1 ticks) results in a 1 tick move
158 if (abs(m_focus->initialFocuserAbsPosition - proposedPosition) > m_focus->m_OpsFocusMechanics->focusMaxTravel->value())
163 m_focus->appendLogText(i18n("Adaptive Focus suspended. Total movement would exceed Max Travel limit"));
166 else if (abs(m_AdaptiveTotalMove + proposedMove) > m_focus->m_OpsFocusSettings->focusAdaptiveMaxMove->value())
171 m_focus->appendLogText(i18n("Adaptive Focus suspended. Total movement would exceed adaptive limit"));
176 // For most folks, most of the time there won't be alt data or positioning errors, so don't continually report 0
179 QString text = i18n("Adaptive Focus: Moving from %1 to %2 (TempΔ %3", currentPosition, proposedPosition, tempStr);
182 text += (m_LastAdaptiveFocusPosErrorReversal == 0) ? ")" : i18n("; Pos Error %1)", m_LastAdaptiveFocusPosErrorReversal);
185 // Go ahead and try to move the focuser. Admin tasks will be completed when the focuser move completes
204// When adaptiveFocus succeeds the focuser is moved and admin tasks are performed to inform other modules that adaptiveFocus is complete
205void AdaptiveFocus::adaptiveFocusAdmin(const int currentPosition, const bool success, const bool focuserMoved)
214 QTimer::singleShot(m_focus->m_OpsFocusMechanics->focusSettleTime->value() * 1000, m_focus, [ &, success]()
219 // Check whether the focuser moved to the requested position or whether we have a positioning error (1 or 2 ticks for example)
235 int totalTicks = static_cast<int>(round(m_ThisAdaptiveFocusTempTicks + m_ThisAdaptiveFocusAltTicks)) +
238 emit m_focus->adaptiveFocusComplete(m_focus->filter(), m_ThisAdaptiveFocusTemperature, m_ThisAdaptiveFocusTempTicks,
289// Calc the filter offset between the active filter and the adaptive filter (either active filter or lock filter)
290int AdaptiveFocus::getAdaptiveFilterOffset(const QString &activeFilter, const QString &adaptiveFilter)
324// The start position uses the last successful AF run for the active filter and adapts that position
325// based on the temperature and altitude delta between now and when the last successful AF run happened
328 // If the active filter has no lock then the AF run will happen on this filter so get the start point
329 // Otherwise get the lock filter on which the AF run will happen and get the start point of this filter
355 if(!m_focus->m_FilterManager->getFilterAbsoluteFocusDetails(AFfilter, lastPos, lastTemp, lastAlt))
364 int minTravelLimit = qMax(0.0, currentPosition - m_focus->m_OpsFocusMechanics->focusMaxTravel->value());
365 int maxTravelLimit = qMin(m_focus->absMotionMax, currentPosition + m_focus->m_OpsFocusMechanics->focusMaxTravel->value());
369 m_focus->appendLogText(i18n("Adaptive start point, last AF solution outside Max Travel, ignoring"));
410 m_focus->appendLogText(i18n("Adaptive start point, target position is outside Max Travel, ignoring"));
414 if (abs(targetPos - currentPosition) > m_focus->m_OpsFocusSettings->focusAdaptiveMaxMove->value())
418 m_focus->appendLogText(i18n("Adaptive start point [%1] excessive move disallowed", filterText));
432 m_focus->appendLogText(i18n("Adapting start point [%1] from %2 to %3", filterText, currentPosition, targetPos));
QString i18n(const char *text, const TYPE &arg...)
QString arg(Args &&... args) const const
QFuture< void > filter(QThreadPool *pool, Sequence &sequence, KeepFunctor &&filterFunction)
singleShot
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:49:50 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:49:50 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.