mirror of https://github.com/Desuuuu/klipper.git
stepcompress: Encourage add=0 in compress_bisect_add()
Only use a non-zero 'add' if it actually extends the number of steps the command covers. Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
parent
12d4888321
commit
83f7d702e7
|
@ -130,7 +130,7 @@ compress_bisect_add(struct stepcompress *sc)
|
|||
struct points point = minmax_point(sc, sc->queue_pos);
|
||||
int32_t outer_mininterval = point.minp, outer_maxinterval = point.maxp;
|
||||
int32_t add = 0, minadd = -0x8001, maxadd = 0x8000;
|
||||
int32_t bestinterval = 0, bestcount = 1, bestadd = 0, bestreach = INT32_MIN;
|
||||
int32_t bestinterval = 0, bestcount = 1, bestadd = 1, bestreach = INT32_MIN;
|
||||
int32_t checked_count = 0;
|
||||
|
||||
for (;;) {
|
||||
|
@ -162,7 +162,7 @@ compress_bisect_add(struct stepcompress *sc)
|
|||
|
||||
// Check if this is the best sequence found so far
|
||||
int32_t reach = add*(addfactor-count) + maxinterval*count;
|
||||
if (reach > bestreach) {
|
||||
if (reach > bestreach && (bestadd || count > bestcount + bestcount/16)) {
|
||||
bestinterval = maxinterval;
|
||||
bestcount = count;
|
||||
bestadd = add;
|
||||
|
|
Loading…
Reference in New Issue