auto-sync
This commit is contained in:
parent
8a9615b530
commit
8ea62843a8
|
@ -1,5 +1,5 @@
|
|||
// This file was generated by Version2Header
|
||||
// Mon Mar 07 13:29:14 EST 2016
|
||||
// Fri Apr 15 23:40:57 EDT 2016
|
||||
#ifndef VCS_VERSION
|
||||
#define VCS_VERSION "9666"
|
||||
#define VCS_VERSION "9845"
|
||||
#endif
|
||||
|
|
|
@ -36,7 +36,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20160411;
|
||||
public static final int CONSOLE_VERSION = 20160415;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
@ -112,6 +112,7 @@ public class Launcher {
|
|||
getConfig().getRoot().setProperty(SPEED_KEY, PortHolder.BAUD_RATE);
|
||||
|
||||
LinkManager.start(port);
|
||||
SensorLogger.init();
|
||||
|
||||
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
|
||||
@Override
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.Writer;
|
||||
|
||||
/**
|
||||
* (c) Andrey Belomutskiy
|
||||
* 4/15/2016.
|
||||
*/
|
||||
public class SensorLogger {
|
||||
private static Writer logFile;
|
||||
|
||||
private static Sensor[] SENSORS = {Sensor.RPM, Sensor.CLT, Sensor.TPS, Sensor.VBATT};
|
||||
private static long fileStartTime;
|
||||
|
||||
private SensorLogger() {
|
||||
}
|
||||
|
||||
public static void init() {
|
||||
startSensorLogFile();
|
||||
|
||||
SensorCentral.getInstance().addListener(Sensor.TIME_SECONDS, new SensorCentral.SensorListener() {
|
||||
@Override
|
||||
public void onSensorUpdate(double value) {
|
||||
writeSensorLogLine();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
private static void writeSensorLogLine() {
|
||||
if (logFile == null)
|
||||
return;
|
||||
|
||||
long msSinceFileStart = System.currentTimeMillis() - fileStartTime;
|
||||
|
||||
try {
|
||||
logFile.write((msSinceFileStart / 1000.0) + "\t");
|
||||
for (Sensor sensor : SENSORS) {
|
||||
logFile.write(SensorCentral.getInstance().getValue(sensor) + "\t");
|
||||
}
|
||||
logFile.write("\r\n");
|
||||
logFile.flush();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logFile = null;
|
||||
}
|
||||
}
|
||||
|
||||
private static void startSensorLogFile() {
|
||||
String fileName = FileLog.DIR + FileLog.getDate() + ".msl";
|
||||
|
||||
fileStartTime = System.currentTimeMillis();
|
||||
try {
|
||||
logFile = new FileWriter(fileName);
|
||||
|
||||
logFile.write("\"rusEfi console" + Launcher.CONSOLE_VERSION + "\"\r\n");
|
||||
logFile.write("Captured " + FileLog.getDate() + "\r\n");
|
||||
|
||||
logFile.write("Time\t");
|
||||
for (Sensor sensor : SENSORS) {
|
||||
logFile.write(sensor.name() + "\t");
|
||||
}
|
||||
logFile.write("\r\n");
|
||||
|
||||
logFile.write("Time\t");
|
||||
for (Sensor sensor : SENSORS) {
|
||||
logFile.write("v\t");
|
||||
}
|
||||
logFile.write("\r\n");
|
||||
logFile.flush();
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
logFile = null;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue