nicer column names in PID modes
This commit is contained in:
parent
1a9b702af7
commit
0ebf32b2cc
|
@ -45,7 +45,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see EngineSnifferPanel
|
* @see EngineSnifferPanel
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20180924;
|
public static final int CONSOLE_VERSION = 20181007;
|
||||||
public static final boolean SHOW_STIMULATOR = false;
|
public static final boolean SHOW_STIMULATOR = false;
|
||||||
private static final String TAB_INDEX = "main_tab";
|
private static final String TAB_INDEX = "main_tab";
|
||||||
protected static final String PORT_KEY = "port";
|
protected static final String PORT_KEY = "port";
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
package com.rusefi;
|
package com.rusefi;
|
||||||
|
|
||||||
|
import com.opensr5.ConfigurationImage;
|
||||||
|
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||||
|
import com.rusefi.binaryprotocol.BinaryProtocolHolder;
|
||||||
|
import com.rusefi.config.Fields;
|
||||||
import com.rusefi.core.Sensor;
|
import com.rusefi.core.Sensor;
|
||||||
import com.rusefi.core.SensorCentral;
|
import com.rusefi.core.SensorCentral;
|
||||||
|
import com.rusefi.io.ConnectionStatus;
|
||||||
|
import com.rusefi.ui.config.ConfigField;
|
||||||
|
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -90,11 +96,18 @@ public class SensorLogger {
|
||||||
return;
|
return;
|
||||||
isRunning = true;
|
isRunning = true;
|
||||||
|
|
||||||
startSensorLogFile();
|
|
||||||
|
|
||||||
SensorCentral.getInstance().addListener(Sensor.TIME_SECONDS, new SensorCentral.SensorListener() {
|
SensorCentral.getInstance().addListener(Sensor.TIME_SECONDS, new SensorCentral.SensorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSensorUpdate(double value) {
|
public void onSensorUpdate(double value) {
|
||||||
|
if (ConnectionStatus.INSTANCE.getValue() != ConnectionStatus.Value.CONNECTED)
|
||||||
|
return;
|
||||||
|
if (logFile == null) {
|
||||||
|
/*
|
||||||
|
* we only start file header once we have first bunch of data
|
||||||
|
*/
|
||||||
|
startSensorLogFile();
|
||||||
|
}
|
||||||
|
|
||||||
writeSensorLogLine();
|
writeSensorLogLine();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -130,9 +143,18 @@ public class SensorLogger {
|
||||||
logFile.write("\"rusEfi console" + Launcher.CONSOLE_VERSION + " firmware " + Launcher.firmwareVersion.get() + "\"\r\n");
|
logFile.write("\"rusEfi console" + Launcher.CONSOLE_VERSION + " firmware " + Launcher.firmwareVersion.get() + "\"\r\n");
|
||||||
logFile.write("Captured " + FileLog.getDate() + "\r\n");
|
logFile.write("Captured " + FileLog.getDate() + "\r\n");
|
||||||
|
|
||||||
|
int debugMode = -1;
|
||||||
|
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
|
||||||
|
if (bp != null) {
|
||||||
|
ConfigurationImage ci = bp.getController();
|
||||||
|
if (ci != null) {
|
||||||
|
debugMode = ConfigField.getIntValue(ci, Fields.DEBUGMODE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
System.out.println("debug mode " + debugMode);
|
||||||
logFile.write("Time\t");
|
logFile.write("Time\t");
|
||||||
for (Sensor sensor : SENSORS) {
|
for (Sensor sensor : SENSORS) {
|
||||||
logFile.write(sensor.name() + "\t");
|
logFile.write(getSensorName(sensor, debugMode) + "\t");
|
||||||
}
|
}
|
||||||
logFile.write("\r\n");
|
logFile.write("\r\n");
|
||||||
|
|
||||||
|
@ -149,4 +171,38 @@ public class SensorLogger {
|
||||||
logFile = null;
|
logFile = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String getSensorName(Sensor sensor, int debugMode) {
|
||||||
|
if (sensor == Sensor.debugFloatField2 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: I-term";
|
||||||
|
}
|
||||||
|
if (sensor == Sensor.debugFloatField3 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: prevError";
|
||||||
|
}
|
||||||
|
if (sensor == Sensor.debugFloatField4 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: I setting";
|
||||||
|
}
|
||||||
|
if (sensor == Sensor.debugFloatField5 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: D setting";
|
||||||
|
}
|
||||||
|
if (sensor == Sensor.debugFloatField6 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: D-term";
|
||||||
|
}
|
||||||
|
if (sensor == Sensor.debugIntField1 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: P setting";
|
||||||
|
}
|
||||||
|
if (sensor == Sensor.debugIntField2 && isPidDebugMode(debugMode)) {
|
||||||
|
return "PID: offset";
|
||||||
|
}
|
||||||
|
return sensor.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean isPidDebugMode(int debugMode) {
|
||||||
|
// nasty implementation hard-coded debug_mode_e values
|
||||||
|
return debugMode == 0
|
||||||
|
|| debugMode == 3
|
||||||
|
|| debugMode == 7
|
||||||
|
|| debugMode == 11
|
||||||
|
|| debugMode == 17;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue