auto-sync

This commit is contained in:
rusEfi 2016-01-05 01:01:35 -05:00
parent 72caa24450
commit f3ee61439c
3 changed files with 50 additions and 8 deletions

View File

@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20160102;
public static final int CONSOLE_VERSION = 20160104;
public static final boolean SHOW_STIMULATOR = false;
private static final String TAB_INDEX = "main_tab";
protected static final String PORT_KEY = "port";

View File

@ -76,14 +76,16 @@ public class FormulasPane {
if (ci == null)
return;
int algorithm = ConfigField.getValue(ci, Fields.ALGORITHM).intValue();
int algorithm = ConfigField.getIntValue(ci, Fields.ALGORITHM);
engine_load_mode_e algo = engine_load_mode_e.values()[algorithm];
String acceleration = getAccelerationVariables(ci);
String page;
if (algo == engine_load_mode_e.LM_SPEED_DENSITY) {
page = getSpeedDensity(ci);
page = getSpeedDensity(ci, acceleration);
} else {
page = "todo";
page = acceleration + "todo";
}
TeXFormula formula = new TeXFormula("\r\n" +
@ -101,7 +103,37 @@ public class FormulasPane {
}
@NotNull
private String getSpeedDensity(ConfigurationImage ci) {
private String getAccelerationVariables(ConfigurationImage ci) {
String tpsDelta = oneDecimal(Sensor.TPS_DELTA);
String elDelta = oneDecimal(Sensor.ENGINE_LOAD_ACCEL_DELTA);
int tpsEnrichLength = ConfigField.getIntValue(ci, Fields.TPSACCELLENGTH);
int elEnrichLength = ConfigField.getIntValue(ci, Fields.ENGINELOADACCELLENGTH);
String tpsEnrichDelta = "$deltaTps = max(currentTps - previousTps, length = " + tpsEnrichLength +
") = " + tpsDelta +"$";
double tpsAccelThreshold = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTTHRESHOLD);
double tpsAccelMult = ConfigField.getFloatValue(ci, Fields.TPSACCELENRICHMENTMULTIPLIER);
String tpsAccelValue = oneDecimal(Sensor.TPS_ACCEL_FUEL);
double tpsDecelThreshold = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTTHRESHOLD);
double tpsDecelMult = ConfigField.getFloatValue(ci, Fields.TPSDECELENLEANMENTMULTIPLIER);
String tpsEnrich = "$tpsAccelEnrich = if (" +
"(tpsDelta = " + tpsDelta + ") > (tpsThreshold = " + tpsAccelThreshold +"), tpsDelta, 0) * " +
"(tpsAccelMultiplier = " + tpsAccelMult + ") = " + tpsAccelValue + "$";
String loadEnrichDelta = "$deltaLoad = max(currentLoad - previousLoad, length = " + elEnrichLength +
") = " + elDelta + "$";
return tpsEnrichDelta + newLine +
tpsEnrich + newLine +
loadEnrichDelta + newLine;
}
@NotNull
private String getSpeedDensity(ConfigurationImage ci, String acceleration) {
String IAT = oneDecimal(Sensor.IAT);
String MAP = oneDecimal(Sensor.MAP);
String T_CHARGE = oneDecimal(Sensor.T_CHARGE);
@ -113,8 +145,8 @@ public class FormulasPane {
String tpsStr = oneDecimal(Sensor.TPS);
String chargeAirMass = String.format("%.3fgm", SensorCentral.getInstance().getValue(Sensor.CHARGE_AIR_MASS));
float displacement = (Float) ConfigField.getValue(ci, Fields.DISPLACEMENT);
int cylinderCount = (int) ConfigField.getValue(ci, Fields.CYLINDERSCOUNT);
double displacement = ConfigField.getFloatValue(ci, Fields.DISPLACEMENT);
int cylinderCount = ConfigField.getIntValue(ci, Fields.CYLINDERSCOUNT);
String cylinderDisplacement = oneDecimal(displacement / cylinderCount);
String injectorFlow = oneDecimal((float) ConfigField.getValue(ci, Fields.INJECTOR_FLOW));
@ -150,7 +182,8 @@ public class FormulasPane {
"(Base_Fuel (" + baseFuelStr + "ms) + Tps_Accel_Corr = (" + tpsAccel + "ms))" + tempCorrections +
" = " + runningFuel + "ms$";
return tCharge + newLine +
return acceleration +
tCharge + newLine +
mCharge + newLine +
baseFuel + newLine +
injTime + newLine;

View File

@ -68,4 +68,13 @@ public class ConfigField extends BaseConfigField {
return value;
}
public static double getFloatValue(ConfigurationImage ci, Field field) {
// this hack is trying to restore lost precision. It's a lame hack
float value = getValue(ci, field).floatValue();
return Double.parseDouble(String.format("%.4f", value));
}
public static int getIntValue(ConfigurationImage ci, Field field) {
return getValue(ci, field).intValue();
}
}