Commit Graph

6 Commits

Author SHA1 Message Date
Kevin O'Connor 9fa0a62c8a stepcompress: Eliminate possible infinite loop in compress_bisect_add()
Commit 47f30331 converted compress_bisect_add() to use "best reach"
instead of "best add".  However, that change caused
compress_bisect_add() to behave poorly when passed in invalid data
(negative times).  Change the code to better handle invalid data.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-10-10 11:31:56 -04:00
Kevin O'Connor 47f303317b stepcompress: Compress for greatest "reach" instead of greatest "add"
Search for the maximum reachable value instead of the maximum "add".
The maximum reachable value encompasses both the maximum count and a
closest step time to the last requested step time.  This allows for
more "add=0" sequences to be generated which the mcu can optimize for.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-09-24 11:42:06 -04:00
Kevin O'Connor 4988ba9a71 stepcompress: Fix error causing queue to not be expanded in expand_queue()
The test to check if the queue only needed to be moved was not correct
and it could lead to a segfault if clean_queue() was called instead of
actually increasing the queue size.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-16 21:33:35 -04:00
Kevin O'Connor 3fa7da804d stepcompress: Check for invalid count in step_factor and step_sqrt
Check for an invalid count and report an error if found.  This
prevents some segfaults when count goes negative.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-16 21:33:15 -04:00
Kevin O'Connor ae8d57e650 stepcompress: Fix compress_bisect_add() infinite loop
At high step speeds, it is possible to exit the inner scan due to
integer truncation.  Always update minadd or maxadd so that the outer
loop always terminates.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-07-10 21:46:57 -04:00
Kevin O'Connor f582a36e4d Initial commit of source code.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
2016-05-25 11:37:40 -04:00