Skip to content

Commit

Permalink
fix(aware): fix build mean value
Browse files Browse the repository at this point in the history
  • Loading branch information
nuKs committed Jan 30, 2020
1 parent 408a8e6 commit 48af82c
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions android/aware-core/src/main/java/com/aware/Rotation.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,48 +148,48 @@ public void run() {
return;
}
// Otherwise, reduce queue w/ average filter.
else if (event.values.length == 3){
else if (event.values.length == 4){
// Retrieve number of item in queue in order to calculate average
long count = _avgQueue.size();

// Calculate total.
float[] acc = new float[]{0.f, 0.f, 0.f};
float[] acc = new float[]{0.f, 0.f, 0.f, 0.f};
float[] curr = (float[]) _avgQueue.poll();
do {
acc[0] += curr[0];
acc[1] += curr[1];
acc[2] += curr[2];
acc[3] += curr[3];
curr = (float[]) _avgQueue.poll();
} while (curr != null);

// Calculate mean.
mean = new float[]{
acc[0] / count,
acc[1] / count,
acc[2] / count
acc[2] / count,
acc[3] / count,
};
}
else if (event.values.length == 4){
else {
// Retrieve number of item in queue in order to calculate average
long count = _avgQueue.size();

// Calculate total.
float[] acc = new float[]{0.f, 0.f, 0.f, 0.f};
float[] acc = new float[]{0.f, 0.f, 0.f};
float[] curr = (float[]) _avgQueue.poll();
do {
acc[0] += curr[0];
acc[1] += curr[1];
acc[2] += curr[2];
acc[3] += curr[3];
curr = (float[]) _avgQueue.poll();
} while (curr != null);

// Calculate mean.
mean = new float[]{
acc[0] / count,
acc[1] / count,
acc[2] / count,
acc[3] / count,
acc[2] / count
};
}

Expand Down

0 comments on commit 48af82c

Please sign in to comment.