From 0041a0079d91755ec1522f0a3b153ea5389b1967 Mon Sep 17 00:00:00 2001 From: Kevin O'Connor Date: Sun, 12 Mar 2017 12:29:20 -0400 Subject: [PATCH] stepcompress: Improve check_line() error messages Signed-off-by: Kevin O'Connor --- klippy/stepcompress.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/klippy/stepcompress.c b/klippy/stepcompress.c index 5b401cbe..962039cd 100644 --- a/klippy/stepcompress.c +++ b/klippy/stepcompress.c @@ -233,16 +233,18 @@ check_line(struct stepcompress *sc, struct step_move move) if (move.count == 1) { if (move.interval != (uint32_t)(*sc->queue_pos - sc->last_step_clock) || *sc->queue_pos < sc->last_step_clock) { - errorf("Count 1 point out of range: %d %d %d" - , move.interval, move.count, move.add); + errorf("stepcompress o=%d i=%d c=%d a=%d:" + " Count 1 point out of range (%lld)" + , sc->oid, move.interval, move.count, move.add + , (long long)(*sc->queue_pos - sc->last_step_clock)); return ERROR_RET; } return 0; } if (!move.count || (!move.interval && !move.add) || move.interval >= 0x80000000) { - errorf("Point out of range: %d %d %d" - , move.interval, move.count, move.add); + errorf("stepcompress o=%d i=%d c=%d a=%d: Invalid sequence" + , sc->oid, move.interval, move.count, move.add); return ERROR_RET; } uint32_t interval = move.interval, p = 0; @@ -251,13 +253,16 @@ check_line(struct stepcompress *sc, struct step_move move) struct points point = minmax_point(sc, sc->queue_pos + i); p += interval; if (p < point.minp || p > point.maxp) { - errorf("Point %d of %d: %d not in %d:%d" - , i+1, move.count, p, point.minp, point.maxp); + errorf("stepcompress o=%d i=%d c=%d a=%d: Point %d: %d not in %d:%d" + , sc->oid, move.interval, move.count, move.add + , i+1, p, point.minp, point.maxp); return ERROR_RET; } if (interval >= 0x80000000) { - errorf("Point %d of %d: interval overflow %d" - , i+1, move.count, interval); + errorf("stepcompress o=%d i=%d c=%d a=%d:" + " Point %d: interval overflow %d" + , sc->oid, move.interval, move.count, move.add + , i+1, interval); return ERROR_RET; } interval += move.add;