aboutsummaryrefslogtreecommitdiffstats
path: root/klippy/stepcompress.c
Commit message (Collapse)AuthorAgeFilesLines
* stepcompress: Check for small negative numbers on sqrt() callsKevin O'Connor2016-10-101-2/+13
| | | | | | | | | It's theoretically possible for floating point truncation to cause a math formula to return a small negative number instead of 0. If sqrt() is called on this small negative number it could cause a crash. Check for this case and return 0. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
* stepcompress: Eliminate possible infinite loop in compress_bisect_add()Kevin O'Connor2016-10-101-1/+1
| | | | | | | | | 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>
* stepcompress: Compress for greatest "reach" instead of greatest "add"Kevin O'Connor2016-09-241-21/+23
| | | | | | | | | 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>
* stepcompress: Fix error causing queue to not be expanded in expand_queue()Kevin O'Connor2016-07-161-2/+2
| | | | | | | | 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>
* stepcompress: Check for invalid count in step_factor and step_sqrtKevin O'Connor2016-07-161-2/+13
| | | | | | | 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>
* stepcompress: Fix compress_bisect_add() infinite loopKevin O'Connor2016-07-101-2/+6
| | | | | | | | 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>
* Initial commit of source code.Kevin O'Connor2016-05-251-0/+498
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>