diff --git a/libraries/AP_ADC/AP_ADC_ADS7844.cpp b/libraries/AP_ADC/AP_ADC_ADS7844.cpp index 761d237516..29a694ae08 100644 --- a/libraries/AP_ADC/AP_ADC_ADS7844.cpp +++ b/libraries/AP_ADC/AP_ADC_ADS7844.cpp @@ -126,9 +126,7 @@ void AP_ADC_ADS7844::read(uint32_t tnow) // Constructors //////////////////////////////////////////////////////////////// -AP_ADC_ADS7844::AP_ADC_ADS7844() : - filter_result(false), - _filter_index_accel(0) +AP_ADC_ADS7844::AP_ADC_ADS7844() { } @@ -233,38 +231,6 @@ uint32_t AP_ADC_ADS7844::Ch6(const uint8_t *channel_numbers, float *result) result[i] = (sum[i] + count[i]) / (float)count[i]; } - - if(filter_result){ - uint32_t _sum_accel; - - // Accel filter - for (i = 0; i < 3; i++) { - // move most recent result into filter - _filter_accel[i][_filter_index_accel] = result[i+3]; - - // clear the sum - _sum_accel = 0; - - // sum the filter - for (uint8_t n = 0; n < ADC_ACCEL_FILTER_SIZE; n++) { - _sum_accel += _filter_accel[i][n]; - } - - // filter does a moving average on last 8 reads, sums half with half of last filtered value - // save old result - _prev_accel[i] = result[i+3] = (_sum_accel >> 4) + (_prev_accel[i] >> 1); // divide by 16, divide by 2 - - } - - // increment filter index - _filter_index_accel++; - - // loop our filter - if(_filter_index_accel == ADC_ACCEL_FILTER_SIZE) - _filter_index_accel = 0; - } - - // return number of microseconds since last call uint32_t us = micros(); uint32_t ret = us - last_ch6_micros; diff --git a/libraries/AP_ADC/AP_ADC_ADS7844.h b/libraries/AP_ADC/AP_ADC_ADS7844.h index 36f76f5770..c62004bee4 100644 --- a/libraries/AP_ADC/AP_ADC_ADS7844.h +++ b/libraries/AP_ADC/AP_ADC_ADS7844.h @@ -33,13 +33,7 @@ class AP_ADC_ADS7844 : public AP_ADC // check if Ch6 would block bool new_data_available(const uint8_t *channel_numbers); - bool filter_result; - private: - uint16_t _filter_accel[3][ADC_ACCEL_FILTER_SIZE]; - uint16_t _prev_gyro[3]; - uint16_t _prev_accel[3]; - uint8_t _filter_index_accel; static void read(uint32_t); };