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>
master
Miroslav Lichvar 2014-11-20 17:30:28 +01:00 committed by Richard Cochran
parent 7455c24148
commit 37459fd1ad
1 changed files with 1 additions and 1 deletions

View File

@ -294,7 +294,7 @@ static void linreg_reset(struct servo *servo)
s->last_update = 0; s->last_update = 0;
s->frequency_ratio = 1.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].slope = 0.0;
s->results[i - MIN_SIZE].err_updates = 0; s->results[i - MIN_SIZE].err_updates = 0;
} }