Git commit 5bd1e5df75e99d3c5e3a29a85ddcedffdbd2c616 by Jasem Mutlaq. Committed on 30/04/2014 at 23:16. Pushed by mutlaqja into branch 'master'. Correcting direction of FOCUS in and FOCUS out M +13 -13 kstars/ekos/focus.cpp http://commits.kde.org/kstars/5bd1e5df75e99d3c5e3a29a85ddcedffdbd2c616 diff --git a/kstars/ekos/focus.cpp b/kstars/ekos/focus.cpp index 6c15fe9..52cecb4 100644 --- a/kstars/ekos/focus.cpp +++ b/kstars/ekos/focus.cpp @@ -363,7 +363,7 @@ void Focus::FocusIn(int ms) currentFocuser->focusIn(); = if (canAbsMove) - currentFocuser->absMoveFocuser(pulseStep+ms); + currentFocuser->absMoveFocuser(pulseStep-ms); else currentFocuser->moveFocuser(ms); = @@ -394,7 +394,7 @@ void Focus::FocusOut(int ms) currentFocuser->focusOut(); = if (canAbsMove) - currentFocuser->absMoveFocuser(pulseStep-ms); + currentFocuser->absMoveFocuser(pulseStep+ms); else currentFocuser->moveFocuser(ms); = @@ -571,7 +571,7 @@ void Focus::autoFocusAbs(double currentHFR) qDebug() << "########################################" << endl; qDebug() << "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" << endl; qDebug() << "Current HFR: " << currentHFR << " Current Position: " << = pulseStep << endl; - qDebug() << "minHFR: " << minHFR << " MinHFR Pos: " << minHFRPos << en= dl; + qDebug() << "Last minHFR: " << minHFR << " Last MinHFR Pos: " << minHF= RPos << endl; qDebug() << "Delta: " << deltaTxt << "%" << endl; qDebug() << "=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D" << endl; #endif @@ -653,7 +653,7 @@ void Focus::autoFocusAbs(double currentHFR) focusOutLimit=3D0; focusInLimit=3D0; initPulseDuration=3DpulseDuration; - FocusIn(pulseDuration); + FocusOut(pulseDuration); break; = case FOCUS_IN: @@ -732,9 +732,9 @@ void Focus::autoFocusAbs(double currentHFR) else { if (lastFocusDirection =3D=3D FOCUS_IN) - targetPulse =3D pulseStep + pulseDuration; - else targetPulse =3D pulseStep - pulseDuration; + else + targetPulse =3D pulseStep + pulseDuration; = #ifdef FOCUS_DEBUG qDebug() << "Proceeding iteratively to next target pu= lse ..." << endl; @@ -815,9 +815,9 @@ void Focus::autoFocusAbs(double currentHFR) = // Let's get close to the minimum HFR position so far = detected if (lastFocusDirection =3D=3D FOCUS_OUT) - targetPulse =3D minHFRPos+pulseDuration/2; - else targetPulse =3D minHFRPos-pulseDuration/2; + else + targetPulse =3D minHFRPos+pulseDuration/2; = #ifdef FOCUS_DEBUG qDebug() << "new targetPulse " << targetPulse << endl; @@ -828,14 +828,14 @@ void Focus::autoFocusAbs(double currentHFR) } = // Limit target Pulse to algorithm limits - if (focusInLimit !=3D 0 && lastFocusDirection =3D=3D FOCUS_IN && t= argetPulse > focusInLimit) + if (focusInLimit !=3D 0 && lastFocusDirection =3D=3D FOCUS_IN && t= argetPulse < focusInLimit) { targetPulse =3D focusInLimit; #ifdef FOCUS_DEBUG qDebug() << "Limiting target pulse to focus in limit " << targ= etPulse << endl; #endif } - else if (focusOutLimit !=3D 0 && lastFocusDirection =3D=3D FOCUS_O= UT && targetPulse < focusOutLimit) + else if (focusOutLimit !=3D 0 && lastFocusDirection =3D=3D FOCUS_O= UT && targetPulse > focusOutLimit) { targetPulse =3D focusOutLimit; #ifdef FOCUS_DEBUG @@ -890,15 +890,15 @@ void Focus::autoFocusAbs(double currentHFR) = #ifdef FOCUS_DEBUG qDebug() << "delta (targetPulse - pulseStep) " << delta << endl; - qDebug() << "Focusing " << ((delta > 0) ? "IN" : "OUT") << endl; + qDebug() << "Focusing " << ((delta < 0) ? "IN" : "OUT") << endl; qDebug() << "########################################" << endl; #endif = // Now cross your fingers and wait if (delta > 0) - FocusIn(delta); + FocusOut(delta); else - FocusOut(fabs(delta)); + FocusIn(fabs(delta)); break; = }