diff options
author | Mark Gordon <msg555@gmail.com> | 2012-02-10 12:47:11 -0500 |
---|---|---|
committer | Mark Gordon <msg555@gmail.com> | 2012-02-10 12:47:11 -0500 |
commit | ae75122414ce50a08c51795bdbb8bca6e0e7b065 (patch) | |
tree | 07a1f567a9443f66d486e2aad7a40997d3ba3e50 | |
parent | 3ae90290201b926756f983dd98a285c402ad55cc (diff) | |
download | PowerTutor-ae75122414ce50a08c51795bdbb8bca6e0e7b065.tar.gz |
Check current more frequently (but only log when it changes)
-rw-r--r-- | src/edu/umich/PowerTutor/service/PowerEstimator.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/edu/umich/PowerTutor/service/PowerEstimator.java b/src/edu/umich/PowerTutor/service/PowerEstimator.java index 93e5327..ed0325a 100644 --- a/src/edu/umich/PowerTutor/service/PowerEstimator.java +++ b/src/edu/umich/PowerTutor/service/PowerEstimator.java @@ -161,6 +161,8 @@ public class PowerEstimator implements Runnable { }
}
+ 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 class PowerEstimator implements Runnable { 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");
}
|