Commit a4bba18a authored by Micha Mueller's avatar Micha Mueller
Browse files

Add factor parameter to storeReading

parent 8e57b63d
......@@ -99,17 +99,17 @@ public:
}
}
virtual void storeReading(reading_t reading, unsigned long long maxValue=ULLONG_MAX) {
virtual void storeReading(reading_t reading, double factor=1.0, unsigned long long maxValue=ULLONG_MAX) {
_latestValue.timestamp = reading.timestamp;
if( _delta ) {
if (reading.value < _lastRawValue.value)
_latestValue.value = reading.value + (maxValue - _lastRawValue.value);
_latestValue.value = (reading.value + (maxValue - _lastRawValue.value)) * factor;
else
_latestValue.value = reading.value - _lastRawValue.value;
_latestValue.value = (reading.value - _lastRawValue.value) * factor;
_lastRawValue.value = reading.value;
}
else
_latestValue.value = reading.value;
_latestValue.value = reading.value * factor;
_readingQueue->push(_latestValue);
_cache[_cacheIndex] = _latestValue;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment