aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--klippy/stepcompress.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/klippy/stepcompress.c b/klippy/stepcompress.c
index 75e8e819..34578935 100644
--- a/klippy/stepcompress.c
+++ b/klippy/stepcompress.c
@@ -164,7 +164,8 @@ compress_bisect_add(struct stepcompress *sc)
// Check if this is the best sequence found so far
int32_t count = nextcount - 1, addfactor = count*(count-1)/2;
int32_t reach = add*addfactor + interval*count;
- if (reach > bestreach) {
+ if (reach > bestreach
+ || (reach == bestreach && interval > bestinterval)) {
bestinterval = interval;
bestcount = count;
bestadd = add;