Set detector y lower limit for Quokka

Improve precision of motor position calculation.

r2844 | ffr | 2009-12-11 12:39:12 +1100 (Fri, 11 Dec 2009) | 3 lines
This commit is contained in:
Ferdi Franceschini
2009-12-11 12:39:12 +11:00
committed by Douglas Clowes
parent 82475e1dec
commit 3abd3effa2
2 changed files with 17 additions and 11 deletions

View File

@@ -485,11 +485,17 @@ static int motDecel(pDMC2280Driv self, double axisDecel) {
* \return the motor position in physical units
*/
static double motPosit(pDMC2280Driv self) {
double fPos;
if (self->abs_encoder)
fPos = (self->currCounts - self->absEncHome) / self->cntsPerX + self->fHome;
else
fPos = (self->currSteps - self->motorHome) / self->stepsPerX + self->fHome;
double fPos, curr, home, counts;
if (self->abs_encoder) {
curr = self->currCounts;
home = self->absEncHome;
counts = self->cntsPerX;
} else {
curr = self->currSteps;
home = self->motorHome;
counts = self->stepsPerX;
}
fPos = (curr - home) / counts + self->fHome;
return fPos;
}