From 1d841eeb876082d9efbf2fa7f04bccc259f40ef9 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 18 Dec 2016 22:11:20 -0500 Subject: [PATCH] stepcompress: Prefer greater interval if all else equal Signed-off-by: Kevin O'Connor --- klippy/stepcompress.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;