Removed raw member that was introduced in commit 3f39352d95. Its role now plays last member of values[] array. Same RAM usage, reduced FLASH usage.

This commit is contained in:
Damjan Adamic
2014-07-13 14:44:42 +02:00
parent 2d22c18758
commit b41ba50b53
2 changed files with 9 additions and 10 deletions
+5 -5
View File
@@ -84,18 +84,18 @@ void FrskyValueWithMin::set(uint8_t value)
this->value = value;
}
else {
//calculate the average from values[], raw, value
//calculate the average from values[] and value
//also shift readings in values [] array
unsigned int sum = values[0];
for (int i=0; i<TELEMETRY_AVERAGE_COUNT-1; i++) {
uint8_t tmp = values[i+1];
values[i] = tmp;
sum += tmp;
}
values[TELEMETRY_AVERAGE_COUNT-1] = raw;
sum += raw + value;
this->value = sum/(TELEMETRY_AVERAGE_COUNT+2);
values[TELEMETRY_AVERAGE_COUNT-1] = value;
sum += value;
this->value = sum/(TELEMETRY_AVERAGE_COUNT+1);
}
raw = value;
#else
if (this->value == 0) {
this->value = value;