commit 37459fd1ad1ac48a121ab0edae331090fb8e2833
Author: Miroslav Lichvar <mlichvar@redhat.com>
Date: Thu Nov 20 17:30:28 2014 +0100
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 <mlichvar@redhat.com>
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;
}