Generalize ERT offset tracking a little.

This commit is contained in:
Jared Boone 2015-12-07 09:58:08 -08:00
parent b9643dc988
commit 2d0052fb14
2 changed files with 4 additions and 3 deletions

View File

@ -51,9 +51,9 @@ void ERTProcessor::execute(buffer_c8_t buffer) {
average_i += src->real();
average_q += src->imag();
average_count++;
if( average_count == 2048 ) {
offset_i = static_cast<float>(average_i) / 2048.0f;
offset_q = static_cast<float>(average_q) / 2048.0f;
if( average_count == average_window ) {
offset_i = static_cast<float>(average_i) / average_window;
offset_q = static_cast<float>(average_q) / average_window;
average_i = 0;
average_q = 0;
average_count = 0;

View File

@ -96,6 +96,7 @@ private:
float sum_period[3];
float manchester[3];
const size_t average_window { 2048 };
int32_t average_i { 0 };
int32_t average_q { 0 };
size_t average_count { 0 };