Permalink
Browse files

Flush voltage data.

  • Loading branch information...
1 parent 0614e1b commit 2a790bb88193289f9ddc5c3b30a6e5fe43da5ba2 @PurpleGuitar committed Oct 29, 2011
Showing with 6 additions and 3 deletions.
  1. +6 −3 src/org/metawatch/manager/MetaWatchService.java
@@ -635,15 +635,18 @@ else if (bytes[2] == eMessageType.GeneralPurposePhoneMsg.msg) {
+ " battery_charging=" + batteryCharging
+ " battery_sense=" + batterySense
+ " battery_average=" + batteryAverage);
- if (PreferenceManager.getDefaultSharedPreferences(this).getBoolean(
- "readWatchVoltage", false)) {
+ String voltageFrequencyString = PreferenceManager.getDefaultSharedPreferences(this).getString(
+ "collectWatchVoltage", "0");
+ final int voltageFrequency = Integer.parseInt(voltageFrequencyString);
+ if (voltageFrequency > 0) {
File sdcard = Environment.getExternalStorageDirectory();
File csv = new File(sdcard,"metawatch_voltage.csv");
FileWriter fw = new FileWriter(csv, true);
Date date = new Date();
fw.write("\"" + date.toString()+ "\"," + batteryAverage + "\n");
+ fw.flush();
fw.close();
- }
+ }
} else {
Log.d(MetaWatch.TAG,
"MetaWatchService.readFromDevice(): Unknown message?");

0 comments on commit 2a790bb

Please sign in to comment.