mirror of https://github.com/rusefi/RomRaider.git
Fix for load from file when semicolon is the field separator.
This commit is contained in:
parent
c03b5a03c6
commit
52e553ab2c
|
@ -49,6 +49,7 @@ import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.text.ParseException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -87,6 +88,7 @@ import com.romraider.logger.ecu.definition.ExternalData;
|
||||||
import com.romraider.logger.ecu.definition.LoggerData;
|
import com.romraider.logger.ecu.definition.LoggerData;
|
||||||
import com.romraider.logger.ecu.ui.DataRegistrationBroker;
|
import com.romraider.logger.ecu.ui.DataRegistrationBroker;
|
||||||
import com.romraider.net.BrowserControl;
|
import com.romraider.net.BrowserControl;
|
||||||
|
import com.romraider.util.NumberUtil;
|
||||||
import com.romraider.util.SettingsManager;
|
import com.romraider.util.SettingsManager;
|
||||||
|
|
||||||
public final class DynoControlPanel extends JPanel {
|
public final class DynoControlPanel extends JPanel {
|
||||||
|
@ -1000,18 +1002,18 @@ public final class DynoControlPanel extends JPanel {
|
||||||
int taCol = 0;
|
int taCol = 0;
|
||||||
double minRpm = 3500;
|
double minRpm = 3500;
|
||||||
double maxRpm = 0;
|
double maxRpm = 0;
|
||||||
String delimiter = COMMA;
|
String delimiter = SEMICOLON;
|
||||||
String line = inputStream.readLine();
|
String line = inputStream.readLine();
|
||||||
String[] headers;
|
String[] headers;
|
||||||
headers = line.split(COMMA);
|
headers = line.split(SEMICOLON);
|
||||||
if (headers.length < 3) {
|
if (headers.length < 3) {
|
||||||
headers = line.split(TAB);
|
headers = line.split(TAB);
|
||||||
if (headers.length > 2) {
|
if (headers.length > 2) {
|
||||||
delimiter = TAB;
|
delimiter = TAB;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
headers = line.split(SEMICOLON);
|
headers = line.split(COMMA);
|
||||||
if (headers.length > 2) delimiter = SEMICOLON;
|
if (headers.length > 2) delimiter = COMMA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (int x = 0; x < headers.length; x++) {
|
for (int x = 0; x < headers.length; x++) {
|
||||||
|
@ -1038,30 +1040,30 @@ public final class DynoControlPanel extends JPanel {
|
||||||
"; VS units: " + vsLogUnits);
|
"; VS units: " + vsLogUnits);
|
||||||
while ((line = inputStream.readLine()) != null) {
|
while ((line = inputStream.readLine()) != null) {
|
||||||
String[] values = line.split(delimiter);
|
String[] values = line.split(delimiter);
|
||||||
if (Double.parseDouble(values[taCol]) > 98) {
|
if (NumberUtil.doubleValue(values[taCol]) > 98) {
|
||||||
double logTime = 0;
|
double logTime = 0;
|
||||||
if (atrTime) {
|
if (atrTime) {
|
||||||
String[] timeStamp = values[timeCol].split(COLON);
|
String[] timeStamp = values[timeCol].split(COLON);
|
||||||
if (timeStamp.length == 3) {
|
if (timeStamp.length == 3) {
|
||||||
logTime = ((Double.parseDouble(timeStamp[0]) * 3600) +
|
logTime = (NumberUtil.doubleValue(timeStamp[0]) * 3600) +
|
||||||
(Double.parseDouble(timeStamp[1]) * 60) +
|
(NumberUtil.doubleValue(timeStamp[1]) * 60) +
|
||||||
Double.parseDouble(timeStamp[2])) * timeMult;
|
NumberUtil.doubleValue(timeStamp[2]) * timeMult;
|
||||||
} else {
|
} else {
|
||||||
logTime = ((Double.parseDouble(timeStamp[0]) * 60) +
|
logTime = (NumberUtil.doubleValue(timeStamp[0]) * 60) +
|
||||||
Double.parseDouble(timeStamp[1])) * timeMult;
|
NumberUtil.doubleValue(timeStamp[1]) * timeMult;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
logTime = Double.parseDouble(values[timeCol]) * timeMult;
|
logTime = NumberUtil.doubleValue(values[timeCol]) * timeMult;
|
||||||
}
|
}
|
||||||
if (startTime == -999999999) startTime = logTime;
|
if (startTime == -999999999) startTime = logTime;
|
||||||
logTime = logTime - startTime;
|
logTime = logTime - startTime;
|
||||||
double logRpm = 0;
|
double logRpm = 0;
|
||||||
if (isManual()) {
|
if (isManual()) {
|
||||||
logRpm = Double.parseDouble(values[rpmCol]);
|
logRpm = NumberUtil.doubleValue(values[rpmCol]);
|
||||||
minRpm = Math.min(minRpm, logRpm);
|
minRpm = Math.min(minRpm, logRpm);
|
||||||
maxRpm = Math.max(maxRpm, logRpm);
|
maxRpm = Math.max(maxRpm, logRpm);
|
||||||
} else {
|
} else {
|
||||||
logRpm = Double.parseDouble(values[vsCol]);
|
logRpm = NumberUtil.doubleValue(values[vsCol]);
|
||||||
minRpm = Math.min(minRpm, calculateRpm(logRpm, rpm2mph, vsLogUnits));
|
minRpm = Math.min(minRpm, calculateRpm(logRpm, rpm2mph, vsLogUnits));
|
||||||
maxRpm = Math.max(maxRpm, calculateRpm(logRpm, rpm2mph, vsLogUnits));
|
maxRpm = Math.max(maxRpm, calculateRpm(logRpm, rpm2mph, vsLogUnits));
|
||||||
}
|
}
|
||||||
|
@ -1075,6 +1077,12 @@ public final class DynoControlPanel extends JPanel {
|
||||||
interpolateButton.doClick();
|
interpolateButton.doClick();
|
||||||
}
|
}
|
||||||
catch (IOException e) {
|
catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
catch (ParseException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
try {
|
try {
|
||||||
inputStream.close();
|
inputStream.close();
|
||||||
|
|
Loading…
Reference in New Issue