diff --git a/libraries/Filter/examples/Derivative/Derivative.pde b/libraries/Filter/examples/Derivative/Derivative.pde index 9247368b8f..4ab1733c2b 100644 --- a/libraries/Filter/examples/Derivative/Derivative.pde +++ b/libraries/Filter/examples/Derivative/Derivative.pde @@ -1,6 +1,6 @@ /* - Example sketch to demonstrate use of DerivativeFilter library. -*/ + * Example sketch to demonstrate use of DerivativeFilter library. + */ #include #include @@ -10,23 +10,23 @@ #ifdef DESKTOP_BUILD // all of this is needed to build with SITL -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include + #include Arduino_Mega_ISR_Registry isr_registry; -AP_Baro_BMP085_HIL barometer; -AP_Compass_HIL compass; +AP_Baro_BMP085_HIL barometer; +AP_Compass_HIL compass; SITL sitl; #endif @@ -37,25 +37,25 @@ DerivativeFilter derivative; // setup routine void setup() { - // Open up a serial connection - Serial.begin(115200); + // Open up a serial connection + Serial.begin(115200); } static float noise(void) { - return ((random() % 100)-50) * 0.001; + return ((random() % 100)-50) * 0.001; } //Main loop where the action takes place void loop() { - delay(50); - float t = millis()*1.0e-3; - float s = sin(t); - //s += noise(); - uint32_t t1 = micros(); - derivative.update(s, t1); - float output = derivative.slope() * 1.0e6; - uint32_t t2 = micros(); - Serial.printf("%f %f %f %f\n", t, output, s, cos(t)); + delay(50); + float t = millis()*1.0e-3; + float s = sin(t); + //s += noise(); + uint32_t t1 = micros(); + derivative.update(s, t1); + float output = derivative.slope() * 1.0e6; + uint32_t t2 = micros(); + Serial.printf("%f %f %f %f\n", t, output, s, cos(t)); }