Filter: silence warning about unused function

../../libraries/Filter/examples/Derivative/Derivative.cpp:16:14: warning: ‘float noise()’ defined but not used [-Wunused-function]
 static float noise(void)
              ^
This commit is contained in:
Lucas De Marchi 2016-02-18 02:28:52 -02:00
parent 1f072c4353
commit edd3e3c34a

View File

@ -8,6 +8,8 @@
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
#define USE_NOISE 0
DerivativeFilter<float,11> derivative;
// setup routine
@ -15,7 +17,11 @@ void setup(){}
static float noise(void)
{
#if USE_NOISE
return ((random() % 100)-50) * 0.001f;
#else
return 0;
#endif
}
//Main loop where the action takes place
@ -24,7 +30,7 @@ void loop()
hal.scheduler->delay(50);
float t = AP_HAL::millis()*1.0e-3f;
float s = sinf(t);
//s += noise();
s += noise();
uint32_t t1 = AP_HAL::micros();
derivative.update(s, t1);
float output = derivative.slope() * 1.0e6f;