From 70d18ec87cdbbb77a75a87dfc4f1b4e76d65b79b Mon Sep 17 00:00:00 2001 From: uncrustify Date: Thu, 16 Aug 2012 23:22:10 -0700 Subject: [PATCH] uncrustify libraries/Filter/examples/Filter/Filter.pde --- libraries/Filter/examples/Filter/Filter.pde | 108 ++++++++++---------- 1 file changed, 54 insertions(+), 54 deletions(-) diff --git a/libraries/Filter/examples/Filter/Filter.pde b/libraries/Filter/examples/Filter/Filter.pde index 3ee1094479..cddac9f413 100644 --- a/libraries/Filter/examples/Filter/Filter.pde +++ b/libraries/Filter/examples/Filter/Filter.pde @@ -1,14 +1,14 @@ /* - Example of Filter library. - Code by Randy Mackay and Jason Short. DIYDrones.com -*/ + * Example of Filter library. + * Code by Randy Mackay and Jason Short. DIYDrones.com + */ #include #include -#include // ArduPilot Mega Vector/Matrix math Library -#include // Filter library -#include // ModeFilter class (inherits from Filter class) -#include // AverageFilter class (inherits from Filter class) +#include // ArduPilot Mega Vector/Matrix math Library +#include // Filter library +#include // ModeFilter class (inherits from Filter class) +#include // AverageFilter class (inherits from Filter class) //////////////////////////////////////////////////////////////////////////////// // Serial ports @@ -27,76 +27,76 @@ AverageFilterUInt16_Size4 _temp_filter; // we need to ues FilterWithBuffer class because we want to access the individual elements void printFilter(FilterWithBufferInt16_Size5& filter) { - for(uint8_t i=0; i < filter.get_filter_size(); i++) - { - Serial.printf("%d ",(int)filter.samples[i]); - } - Serial.println(); + for(uint8_t i=0; i < filter.get_filter_size(); i++) + { + Serial.printf("%d ",(int)filter.samples[i]); + } + Serial.println(); } void setup() { - // Open up a serial connection - Serial.begin(115200); - - // introduction - Serial.printf("ArduPilot ModeFilter library test ver 1.0\n\n"); + // Open up a serial connection + Serial.begin(115200); - // Wait for the serial connection - delay(500); + // introduction + Serial.printf("ArduPilot ModeFilter library test ver 1.0\n\n"); + + // Wait for the serial connection + delay(500); } // Read Raw Temperature values void ReadTemp() { static uint8_t next_num = 0; - static int32_t RawTemp = 0; - uint8_t buf[2]; - uint16_t _temp_sensor; + static int32_t RawTemp = 0; + uint8_t buf[2]; + uint16_t _temp_sensor; next_num++; - buf[0] = next_num; //next_num; - buf[1] = 0xFF; + buf[0] = next_num; //next_num; + buf[1] = 0xFF; - _temp_sensor = buf[0]; - _temp_sensor = (_temp_sensor << 8) | buf[1]; + _temp_sensor = buf[0]; + _temp_sensor = (_temp_sensor << 8) | buf[1]; - RawTemp = _temp_filter.apply(_temp_sensor); - - Serial.printf("RT: %ld\n",RawTemp); + RawTemp = _temp_filter.apply(_temp_sensor); + + Serial.printf("RT: %ld\n",RawTemp); } //Main loop where the action takes place void loop() { uint8_t i = 0; - int16_t filtered_value; + int16_t filtered_value; - int16_t j; - - for(j=0; j<0xFF; j++ ) { - ReadTemp(); - } - /*while( i < 9 ) { + int16_t j; - // output to user - Serial.printf("applying: %d\n",(int)rangevalue[i]); - - // display original - Serial.printf("before: "); - printFilter(mfilter); - - // apply new value and retrieved filtered result - filtered_value = mfilter.apply(rangevalue[i]); - - // display results - Serial.printf("after: "); - printFilter(mfilter); - Serial.printf("The filtered value is: %d\n\n",(int)filtered_value); - - i++; - }*/ - delay(10000); + for(j=0; j<0xFF; j++ ) { + ReadTemp(); + } + /*while( i < 9 ) { + * + * // output to user + * Serial.printf("applying: %d\n",(int)rangevalue[i]); + * + * // display original + * Serial.printf("before: "); + * printFilter(mfilter); + * + * // apply new value and retrieved filtered result + * filtered_value = mfilter.apply(rangevalue[i]); + * + * // display results + * Serial.printf("after: "); + * printFilter(mfilter); + * Serial.printf("The filtered value is: %d\n\n",(int)filtered_value); + * + * i++; + * }*/ + delay(10000); }