Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix off by one error on WAV_DELAY when calculating velocity #3

Merged
merged 1 commit into from
Oct 5, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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