m b / Mbed 2 deprecated AoA_estimator

Dependencies:   mbed dsp

Files at this revision

API Documentation at this revision

Comitter:
mikeb
Date:
Mon Apr 18 18:51:16 2016 +0000
Parent:
1:4fceb43e2dd3
Child:
3:fdefe922ce38
Commit message:
Needs filter. Needs further testing. High accuracy version.

Changed in this revision

AoA_Est.h Show annotated file Show diff for this revision Revisions of this file
--- a/AoA_Est.h	Mon Apr 18 18:43:15 2016 +0000
+++ b/AoA_Est.h	Mon Apr 18 18:51:16 2016 +0000
@@ -110,12 +110,12 @@
     bool flag = false;
     confidence = 0;
     for (short i = 1; i <= ITERATIONS; i++) {
-        if (abs(angle - ambigAngles[0][i]) < 30) {
+        if (abs(angle - ambigAngles[0][i]) < abs(angle-ambigAngles[1][i]) && abs(angle-ambigAngles[0][i]) < 30) {
             angle = ambigAngles[0][i];
             avg += ambigAngles[0][i];
             confidence++;
         }
-        else if (abs(angle - ambigAngles[1][i]) < 30) {
+        else if (abs(angle - ambigAngles[1][i]) < abs(angle-ambigAngles[0][i]) && abs(angle - ambigAngles[1][i]) < 30) {
             angle = ambigAngles[1][i];
             avg += ambigAngles[1][i];
             confidence++;