diff --git a/libraries/Filter/DerivativeFilter.cpp b/libraries/Filter/DerivativeFilter.cpp index 817bd0a64f..8a09aea938 100644 --- a/libraries/Filter/DerivativeFilter.cpp +++ b/libraries/Filter/DerivativeFilter.cpp @@ -33,8 +33,8 @@ float DerivativeFilter::slope(void) // use f() to make the code match the maths a bit better. Note // that unlike an average filter, we care about the order of the elements - #define f(i) FilterWithBuffer::samples[(((FilterWithBuffer::sample_index-1)+i)+3*FILTER_SIZE/2) % FILTER_SIZE] - #define x(i) _timestamps[(((FilterWithBuffer::sample_index-1)+i)+3*FILTER_SIZE/2) % FILTER_SIZE] + #define f(i) FilterWithBuffer::samples[(((FilterWithBuffer::sample_index-1)+i+1)+3*FILTER_SIZE/2) % FILTER_SIZE] + #define x(i) _timestamps[(((FilterWithBuffer::sample_index-1)+i+1)+3*FILTER_SIZE/2) % FILTER_SIZE] if (_timestamps[FILTER_SIZE-1] == _timestamps[FILTER_SIZE-2]) { // we haven't filled the buffer yet - assume zero derivative @@ -98,5 +98,9 @@ template void DerivativeFilter::update(float sample, uint32_t timestamp template float DerivativeFilter::slope(void); template void DerivativeFilter::reset(void); +template void DerivativeFilter::update(float sample, uint32_t timestamp); +template float DerivativeFilter::slope(void); +template void DerivativeFilter::reset(void); +