stepcompress: Increase check on max count to 10000000

Some motors have very small step distances and they can generate over
a million steps during a homing operation.  Increase the maximum count
to ten million to avoid triggering the internal sanity check.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2016-12-23 23:13:35 -05:00
parent 3576dd6e87
commit f3a49604f1
1 changed files with 4 additions and 4 deletions

View File

@ -395,7 +395,7 @@ stepcompress_push_factor(struct stepcompress *sc
step_offset = -step_offset; step_offset = -step_offset;
} }
int count = steps + .5 - step_offset; int count = steps + .5 - step_offset;
if (count <= 0 || count > 1000000) { if (count <= 0 || count > 10000000) {
if (count && steps) if (count && steps)
errorf("push_factor invalid count %d %f %f %f %f" errorf("push_factor invalid count %d %f %f %f %f"
, sc->oid, steps, step_offset, clock_offset, factor); , sc->oid, steps, step_offset, clock_offset, factor);
@ -429,7 +429,7 @@ stepcompress_push_sqrt(struct stepcompress *sc, double steps, double step_offset
step_offset = -step_offset; step_offset = -step_offset;
} }
int count = steps + .5 - step_offset; int count = steps + .5 - step_offset;
if (count <= 0 || count > 1000000) { if (count <= 0 || count > 10000000) {
if (count && steps) if (count && steps)
errorf("push_sqrt invalid count %d %f %f %f %f %f" errorf("push_sqrt invalid count %d %f %f %f %f %f"
, sc->oid, steps, step_offset, clock_offset, sqrt_offset , sc->oid, steps, step_offset, clock_offset, sqrt_offset
@ -463,7 +463,7 @@ stepcompress_push_delta_const(
double reldist = closestxy_d - movexy_r*dist; double reldist = closestxy_d - movexy_r*dist;
double end_height = safe_sqrt(closest_height2 - reldist*reldist); double end_height = safe_sqrt(closest_height2 - reldist*reldist);
int count = (end_height - height + movez_r*dist) / step_dist + .5; int count = (end_height - height + movez_r*dist) / step_dist + .5;
if (count <= 0 || count > 1000000) { if (count <= 0 || count > 10000000) {
if (count) if (count)
errorf("push_delta_const invalid count %d %d %f %f %f %f %f %f %f %f" errorf("push_delta_const invalid count %d %d %f %f %f %f %f %f %f %f"
, sc->oid, count, clock_offset, dist, step_dist, start_pos , sc->oid, count, clock_offset, dist, step_dist, start_pos
@ -519,7 +519,7 @@ stepcompress_push_delta_accel(
double reldist = closestxy_d - movexy_r*dist; double reldist = closestxy_d - movexy_r*dist;
double end_height = safe_sqrt(closest_height2 - reldist*reldist); double end_height = safe_sqrt(closest_height2 - reldist*reldist);
int count = (end_height - height + movez_r*dist) / step_dist + .5; int count = (end_height - height + movez_r*dist) / step_dist + .5;
if (count <= 0 || count > 1000000) { if (count <= 0 || count > 10000000) {
if (count) if (count)
errorf("push_delta_accel invalid count %d %d %f %f %f %f %f %f %f %f" errorf("push_delta_accel invalid count %d %d %f %f %f %f %f %f %f %f"
, sc->oid, count, clock_offset, dist, step_dist, start_pos , sc->oid, count, clock_offset, dist, step_dist, start_pos