From 37459fd1ad1ac48a121ab0edae331090fb8e2833 Mon Sep 17 00:00:00 2001 From: Miroslav Lichvar Date: Thu, 20 Nov 2014 17:30:28 +0100 Subject: [PATCH] linreg: fix servo resetting The stats for the maximum size were not reset, which caused the the servo to reuse old data instead of returning with unlocked state. Signed-off-by: Miroslav Lichvar --- linreg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linreg.c b/linreg.c index b94c44e..fde604d 100644 --- a/linreg.c +++ b/linreg.c @@ -294,7 +294,7 @@ static void linreg_reset(struct servo *servo) s->last_update = 0; s->frequency_ratio = 1.0; - for (i = MIN_SIZE; i < MAX_SIZE; i++) { + for (i = MIN_SIZE; i <= MAX_SIZE; i++) { s->results[i - MIN_SIZE].slope = 0.0; s->results[i - MIN_SIZE].err_updates = 0; }