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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user