Skip to content
Browse files

Check current more frequently (but only log when it changes)

  • Loading branch information...
1 parent 3ae9029 commit ae75122414ce50a08c51795bdbb8bca6e0e7b065 @msg555 committed Feb 10, 2012
Showing with 9 additions and 3 deletions.
  1. +9 −3 src/edu/umich/PowerTutor/service/PowerEstimator.java
View
12 src/edu/umich/PowerTutor/service/PowerEstimator.java
@@ -161,6 +161,8 @@ public void run() {
}
}
+ double lastCurrent = -1;
+
/* Indefinitely collect data on each of the power components. */
boolean firstLogIteration = true;
for(long iter = -1; !Thread.interrupted(); ) {
@@ -276,10 +278,14 @@ public void run() {
PowerWidget.updateWidget(context, this);
}
- if(iter % (5*60) == 0) {
- if(bst.hasCurrent()) {
- writeToLog("batt_current " + bst.getCurrent() + "\n");
+ if(bst.hasCurrent()) {
+ double current = bst.getCurrent();
+ if(current != lastCurrent) {
+ writeToLog("batt_current " + current + "\n");
+ lastCurrent = current;
}
+ }
+ if(iter % (5*60) == 0) {
if(bst.hasTemp()) {
writeToLog("batt_temp " + bst.getTemp() + "\n");
}

0 comments on commit ae75122

Please sign in to comment.
Something went wrong with that request. Please try again.