Skip to content

Commit

Permalink
Merge pull request #3 from domitto/master
Browse files Browse the repository at this point in the history
Fix off by one error on WAV_DELAY when calculating velocity
  • Loading branch information
kmpeters authored Oct 5, 2020
2 parents bd9f8be + 6a3fe20 commit 4d8b0d1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion nPointApp/src/LC400MotorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,15 @@ static void genTrapezoid(epicsFloat64 ipos, epicsFloat64 fpos, epicsFloat64 vel,
}
}

result->cycle_count = cycle_count;
// We must subtract cycle_count by 1 before writing its value to the
// WAV_DELAY register because the delay per cycle is actually:
// (1 + WAV_DELAY)*LC400_MIN_DELAY seconds
if (!cycle_count) {
fprintf(stderr, "Cycle Count was calculated to be 0, which shouldn't happen. Setting it to 1\n");
++cycle_count;
}

result->cycle_count = cycle_count - 1;
result->data_len = npts;
}

Expand Down

0 comments on commit 4d8b0d1

Please sign in to comment.