Skip to content

Commit

Permalink
Fixed missing ALTITUDE heading (pires#182)
Browse files Browse the repository at this point in the history
Fixed missing ALTITUDE heading. Fixes pires#176
  • Loading branch information
jbits authored and pires committed May 29, 2016
1 parent f72ec99 commit 51309a3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/main/java/com/github/pires/obd/reader/io/LogCSVWriter.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public class LogCSVWriter {

private static final String TAG = LogCSVWriter.class.getName();
private static final String HEADER_CSV = "This is a logfile generated by pires.obd.reader";
private static final String[] NAMES_COLUMNS = {"TIME", "LATITUDE", "LONGITUDE", "VEHICLE_ID",
private static final String[] NAMES_COLUMNS = {"TIME", "LATITUDE", "LONGITUDE", "ALTITUDE", "VEHICLE_ID",
"BAROMETRIC_PRESSURE", "ENGINE_COOLANT_TEMP", "FUEL_LEVEL", "ENGINE_LOAD", "AMBIENT_AIR_TEMP",
"ENGINE_RPM", "INTAKE_MANIFOLD_PRESSURE", "MAF", "Term Fuel Trim Bank 1",
"FUEL_ECONOMY", "Long Term Fuel Trim Bank 2", "FUEL_TYPE", "AIR_INTAKE_TEMP",
Expand All @@ -35,21 +35,21 @@ public class LogCSVWriter {
private BufferedWriter buf;

public LogCSVWriter(String filename, String dirname) throws FileNotFoundException, RuntimeException {

File sdCard = Environment.getExternalStorageDirectory();
File dir = new File(sdCard.getAbsolutePath() + File.separator + dirname);
if (dir.mkdirs()) {
try{
File sdCard = Environment.getExternalStorageDirectory();
File dir = new File(sdCard.getAbsolutePath() + File.separator + dirname);
if (!dir.exists()) dir.mkdirs();
Log.d(TAG, "Path is " + sdCard.getAbsolutePath() + File.separator + dirname);
File file = new File(dir, filename);
FileOutputStream fos = new FileOutputStream(file);
OutputStreamWriter osw = new OutputStreamWriter(fos);
this.buf = new BufferedWriter(osw);
this.isFirstLine = true;
Log.d(TAG, "Constructed the LogCSVWriter");
} else {
throw new RuntimeException("Can't create LogCSVWriter directories.");
}

catch (Exception e) {
Log.e(TAG, "LogCSVWriter constructor failed");
}
}

public void closeLogCSVWriter() {
Expand Down

0 comments on commit 51309a3

Please sign in to comment.