Rework the motor end-of-motion tests when creeping
This commit is contained in:
@@ -606,25 +606,34 @@ static int motCreep(pDMC2280Driv self, double target) {
|
||||
else if (offset < 0) /* moving down */
|
||||
self->creep_val = +1;
|
||||
} else {
|
||||
int iRet = 0;
|
||||
/*
|
||||
* not first, bump the direction sensitive counters
|
||||
*/
|
||||
if (self->creep_val > 0) { /* moving down */
|
||||
/* Handle the case of overrunning the target by reversing direction */
|
||||
if (offset >= 0)
|
||||
iRet = 1;
|
||||
++self->creep_val;
|
||||
} else {
|
||||
/* Handle the case of overrunning the target by reversing direction */
|
||||
if (offset <= 0)
|
||||
iRet = 1;
|
||||
--self->creep_val;
|
||||
}
|
||||
/*
|
||||
* In all repetitive things, there just has to be a limit
|
||||
*/
|
||||
if (abs(self->creep_val) > MAX_CREEP_STEPS &&
|
||||
abs(self->creep_val) > 2.0 * fabs(self->stepsPerX / self->cntsPerX)) {
|
||||
if (abs(self->creep_val) > MAX_CREEP_STEPS) {
|
||||
if (self->debug) {
|
||||
char line[CMDLEN];
|
||||
snprintf(line, CMDLEN, "Motor=%s creep stopped, stepcount = %d",
|
||||
self->name, self->stepCount);
|
||||
SICSLogWrite(line, eStatus);
|
||||
}
|
||||
iRet = 1;
|
||||
}
|
||||
if (iRet > 0) {
|
||||
/*
|
||||
* self->preseek remains zero to say we are finished
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user