diff --git a/indi-celestronaux/celestronaux.cpp b/indi-celestronaux/celestronaux.cpp index 12ae45222..ab21a410e 100644 --- a/indi-celestronaux/celestronaux.cpp +++ b/indi-celestronaux/celestronaux.cpp @@ -593,7 +593,7 @@ bool CelestronAUX::updateProperties() syncDriverInfo(); getFocusPosition(); - FocusAbsPosN->value = m_FocusTarget = m_FocusPosition - m_FocusLimitMin; + FocusAbsPosN->value = m_FocusLimitMax - m_FocusPosition; FocusAbsPosNP.s = IPS_OK; m_FocusEnabled = true; @@ -1323,10 +1323,10 @@ IPState CelestronAUX::MoveAbsFocuser(uint32_t targetTicks) } getFocusPosition(); - if (targetTicks == m_FocusPosition - m_FocusLimitMin) + if (targetTicks == m_FocusLimitMax - m_FocusPosition) return IPS_OK; else{ - focusTo(m_FocusTarget = targetTicks + m_FocusLimitMin); + focusTo(m_FocusLimitMax - targetTicks); return IPS_BUSY; } } @@ -2001,7 +2001,7 @@ void CelestronAUX::TimerHit() getFocusPosition(); // update client only if changed to reduce traffic - uint32_t newFocusAbsPos = m_FocusPosition - m_FocusLimitMin; + uint32_t newFocusAbsPos = m_FocusLimitMax - m_FocusPosition; if (newFocusAbsPos != FocusAbsPosN->value){ FocusAbsPosN->value = newFocusAbsPos; IDSetNumber(&FocusAbsPosNP, nullptr); diff --git a/indi-celestronaux/celestronaux.h b/indi-celestronaux/celestronaux.h index c97f6287f..a5194c417 100644 --- a/indi-celestronaux/celestronaux.h +++ b/indi-celestronaux/celestronaux.h @@ -343,7 +343,6 @@ class CelestronAUX : // Focus bool m_FocusEnabled {false}; - uint32_t m_FocusTarget {0}; uint32_t m_FocusPosition {0}; uint32_t m_FocusLimitMax {0}; uint32_t m_FocusLimitMin {0xffffffff};