NaN check and better init in lowpass

This commit is contained in:
Lorenz Meier
2014-07-29 21:36:55 +02:00
parent 5422e08124
commit e3da7f564f
2 changed files with 4 additions and 1 deletions
+3
View File
@@ -121,6 +121,9 @@ int blockLimitSymTest()
float BlockLowPass::update(float input)
{
if (!isfinite(getState())) {
setState(input);
}
float b = 2 * float(M_PI) * getFCut() * getDt();
float a = b / (1 + b);
setState(a * input + (1 - a)*getState());