Fix Misra 13.4 on safety code

This commit is contained in:
Riccardo 2019-06-11 01:10:45 -07:00
parent 7372ade33e
commit fa1c928961
1 changed files with 2 additions and 1 deletions

View File

@ -166,7 +166,8 @@ void update_sample(struct sample_t *sample, int sample_new) {
sample->values[0] = sample_new;
// get the minimum and maximum measured samples
sample->min = sample->max = sample->values[0];
sample->min = sample->values[0];
sample->max = sample->values[0];
for (int i = 1; i < sizeof(sample->values)/sizeof(sample->values[0]); i++) {
if (sample->values[i] < sample->min) {
sample->min = sample->values[i];