Revision comments for rev 5bcaab17e76f addressed.

This commit is contained in:
Dominik R?ttsches
2011-08-27 14:32:37 +03:00
parent ace10fc511
commit 9281e0adf3
3 changed files with 6 additions and 6 deletions
@@ -48,13 +48,13 @@ public class StrideReadings {
// TODO: Calibrate this using a reliable footpod / cadence sensor,
// otherwise use heartbeat timestamp for calculation.
strideReadingsHistory.add(0, numStrides);
while(strideReadingsHistory.size() > NUM_READINGS_FOR_AVERAGE) {
while (strideReadingsHistory.size() > NUM_READINGS_FOR_AVERAGE) {
strideReadingsHistory.remove(strideReadingsHistory.size()-1);
}
}
public int getCadence() {
if(strideReadingsHistory.size() < MIN_READINGS_FOR_AVERAGE) {
if (strideReadingsHistory.size() < MIN_READINGS_FOR_AVERAGE) {
// Bail out if we cannot really get a meaningful average yet.
return CADENCE_NOT_AVAILABLE;
}
@@ -76,8 +76,8 @@ public class ZephyrMessageParser implements MessageParser {
}
} else {
cadence
.setValue(SensorUtils.unsignedShortToIntLittleEndian(buffer, 56) / 16)
.setState(Sensor.SensorState.SENDING);
.setValue(SensorUtils.unsignedShortToIntLittleEndian(buffer, 56) / 16)
.setState(Sensor.SensorState.SENDING);
}
sds.setCadence(cadence);
}
@@ -30,7 +30,7 @@ public class StrideReadingsTest extends TestCase {
public void testAverageCadenceAvailable() {
StrideReadings strideReadings = new StrideReadings();
// 2 steps / second => Cadence is 120 / minute
for (int i=1;i<=30;i++) {
for (int i = 1; i <= 30; i++) {
strideReadings.updateStrideReading(i*2);
if (i >= StrideReadings.MIN_READINGS_FOR_AVERAGE) {
assertEquals(120, strideReadings.getCadence());
@@ -51,7 +51,7 @@ public class StrideReadingsTest extends TestCase {
// initialStrides set to a value below 128 to ensure rollover.
int initialStrides = 128 - StrideReadings.NUM_READINGS_FOR_AVERAGE - 5;
for (int i=1;i<=StrideReadings.NUM_READINGS_FOR_AVERAGE+10;i++) {
for (int i = 1; i <= StrideReadings.NUM_READINGS_FOR_AVERAGE + 10; i++) {
strideReadings.updateStrideReading((initialStrides + i) % 128);
if (i >= StrideReadings.MIN_READINGS_FOR_AVERAGE) {
assertEquals(60, strideReadings.getCadence());