auto-sync
This commit is contained in:
parent
1b00bc9053
commit
f348336907
|
@ -10,19 +10,22 @@ import java.util.Date;
|
|||
*/
|
||||
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
|
||||
public class TS2C {
|
||||
// todo: replace with LOAD_COUNT & RPM_COUNT
|
||||
private static final int SIZE = 16;
|
||||
// todo: replace with loadCount & rpmCount
|
||||
private final int size;
|
||||
|
||||
private static int RPM_COUNT = 16;
|
||||
private static int LOAD_COUNT = 16;
|
||||
private int rpmCount;
|
||||
private int loadCount;
|
||||
|
||||
static float loadBins[] = new float[LOAD_COUNT];
|
||||
static float rpmBins[] = new float[RPM_COUNT];
|
||||
static float table[][] = new float[SIZE][];
|
||||
private float loadBins[];
|
||||
private float rpmBins[];
|
||||
private float table[][];
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
new TS2C(args);
|
||||
}
|
||||
|
||||
if (args.length != 4) {
|
||||
private TS2C(String[] args) throws IOException {
|
||||
if (args.length != 4 && args.length != 5) {
|
||||
System.out.println("Four parameters expected: ");
|
||||
System.out.println(" INPUT_MSQ_FILE NAME LOAD_SECTION_NAME RPM_SECTION_NAME TABLE_NAME");
|
||||
System.out.println("for example");
|
||||
|
@ -36,12 +39,19 @@ public class TS2C {
|
|||
String tableName = args[3];
|
||||
|
||||
BufferedReader r = readAndScroll(fileName, loadSectionName);
|
||||
|
||||
size = Integer.parseInt(args.length > 4 ? args[4] : "16");
|
||||
loadCount = size;
|
||||
loadBins = new float[loadCount];
|
||||
readAxle(loadBins, r);
|
||||
r = readAndScroll(fileName, rpmSectionName);
|
||||
rpmCount = size;
|
||||
rpmBins = new float[rpmCount];
|
||||
readAxle(rpmBins, r);
|
||||
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
table[i] = new float[SIZE];
|
||||
table = new float[size][];
|
||||
for (int i = 0; i < size; i++) {
|
||||
table[i] = new float[size];
|
||||
}
|
||||
|
||||
r = readAndScroll(fileName, tableName);
|
||||
|
@ -56,9 +66,9 @@ public class TS2C {
|
|||
}, "TS2C");
|
||||
}
|
||||
|
||||
static void writeTable(BufferedWriter w, ValueSource valueSource, String toolName) throws IOException {
|
||||
private void writeTable(BufferedWriter w, ValueSource valueSource, String toolName) throws IOException {
|
||||
w.write("/* Generated by " + toolName + " on " + new Date() + "*/\r\n");
|
||||
for (int loadIndex = 0; loadIndex < LOAD_COUNT; loadIndex++)
|
||||
for (int loadIndex = 0; loadIndex < loadCount; loadIndex++)
|
||||
writeLine(valueSource, w, loadIndex);
|
||||
w.close();
|
||||
}
|
||||
|
@ -76,11 +86,11 @@ public class TS2C {
|
|||
return reader;
|
||||
}
|
||||
|
||||
private static void writeLine(ValueSource valueSource, BufferedWriter w, int loadIndex) throws IOException {
|
||||
private void writeLine(ValueSource valueSource, BufferedWriter w, int loadIndex) throws IOException {
|
||||
StringBuilder sb = new StringBuilder("{");
|
||||
|
||||
sb.append("/* " + loadIndex + " " + String.format("%3.3f", loadBins[loadIndex]) + "\t*/");
|
||||
for (int rpmIndex = 0; rpmIndex < RPM_COUNT; rpmIndex++) {
|
||||
for (int rpmIndex = 0; rpmIndex < rpmCount; rpmIndex++) {
|
||||
sb.append("/* " + rpmIndex + " " + rpmBins[rpmIndex] + "*/" + String.format("%3.3f", valueSource.getValue(loadIndex, rpmIndex)) + ",\t");
|
||||
}
|
||||
sb.append("},\r\n");
|
||||
|
@ -92,10 +102,10 @@ public class TS2C {
|
|||
float getValue(int loadIndex, int rpmIndex);
|
||||
}
|
||||
|
||||
private static void readTable(float[][] table, BufferedReader r) throws IOException {
|
||||
private void readTable(float[][] table, BufferedReader r) throws IOException {
|
||||
int index = 0;
|
||||
|
||||
while (index < SIZE) {
|
||||
while (index < size) {
|
||||
String line = r.readLine();
|
||||
if (line == null)
|
||||
throw new IOException("End of file?");
|
||||
|
@ -104,10 +114,10 @@ public class TS2C {
|
|||
continue;
|
||||
|
||||
String[] values = line.split(" ");
|
||||
if (values.length != SIZE)
|
||||
if (values.length != size)
|
||||
throw new IllegalStateException("Unexpected line: " + line);
|
||||
|
||||
for (int i = 0; i < SIZE; i++) {
|
||||
for (int i = 0; i < size; i++) {
|
||||
table[index][i] = Float.parseFloat(values[i]);
|
||||
}
|
||||
System.out.println("Got line " + index + ": " + Arrays.toString(table[index]));
|
||||
|
@ -115,10 +125,10 @@ public class TS2C {
|
|||
}
|
||||
}
|
||||
|
||||
private static void readAxle(float[] bins, BufferedReader r) throws IOException {
|
||||
private void readAxle(float[] bins, BufferedReader r) throws IOException {
|
||||
int index = 0;
|
||||
|
||||
while (index < SIZE) {
|
||||
while (index < size) {
|
||||
String line = r.readLine();
|
||||
if (line == null)
|
||||
throw new IOException("End of file?");
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
package com.rusefi.config;
|
||||
|
||||
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Fri Jul 01 17:21:02 EDT 2016
|
||||
// this file was generated automatically by ConfigDefinition.jar based on rusefi_config.txt Sat Jul 02 16:24:07 EDT 2016
|
||||
public class Fields {
|
||||
public static final int LE_COMMAND_LENGTH = 200;
|
||||
public static final int FSIO_ADC_COUNT = 4;
|
||||
public static final int TS_FILE_VERSION = 20160430;
|
||||
public static final int TS_FILE_VERSION = 20160702;
|
||||
public static final int WARMUP_TARGET_AFR_SIZE = 4;
|
||||
public static final int MAP_ANGLE_SIZE = 8;
|
||||
public static final int MAP_WINDOW_SIZE = 8;
|
||||
|
@ -25,6 +25,7 @@ public class Fields {
|
|||
public static final int TRIGGER_SIMULATOR_PIN_COUNT = 3;
|
||||
public static final int LOGIC_ANALYZER_CHANNEL_COUNT = 4;
|
||||
public static final int LE_COMMAND_COUNT = 16;
|
||||
public static final int AUX_PID_COUNT = 4;
|
||||
public static final int FUEL_RPM_COUNT = 16;
|
||||
public static final int FUEL_LOAD_COUNT = 16;
|
||||
public static final int FSIO_TABLE_8 = 8;
|
||||
|
@ -848,8 +849,19 @@ public class Fields {
|
|||
public static final int tChargeMaxRpmMinTps_offset = 2440;
|
||||
public static final int tChargeMaxRpmMinTps_offset_hex = 988;
|
||||
public static final int tChargeMaxRpmMaxTps_offset = 2444;
|
||||
public static final int unused_offset = 2448;
|
||||
public static final int unused_offset_hex = 990;
|
||||
public static final int auxPidPins1_offset = 2448;
|
||||
public static final int auxPidPins1_offset_hex = 990;
|
||||
public static final int auxPidPins2_offset = 2452;
|
||||
public static final int auxPidPins2_offset_hex = 994;
|
||||
public static final int auxPidPins3_offset = 2456;
|
||||
public static final int auxPidPins3_offset_hex = 998;
|
||||
public static final int auxPidPins4_offset = 2460;
|
||||
public static final int auxPidFrequency1_offset = 2464;
|
||||
public static final int auxPidFrequency2_offset = 2466;
|
||||
public static final int auxPidFrequency3_offset = 2468;
|
||||
public static final int auxPidFrequency4_offset = 2470;
|
||||
public static final int alternatorPwmFrequency_offset = 2472;
|
||||
public static final int unused_offset = 2476;
|
||||
public static final int le_formulas1_offset = 3048;
|
||||
public static final int le_formulas2_offset = 3248;
|
||||
public static final int le_formulas3_offset = 3448;
|
||||
|
@ -1448,6 +1460,15 @@ public class Fields {
|
|||
public static final Field TCHARGEMINRPMMAXTPS = Field.create("TCHARGEMINRPMMAXTPS", 2436, FieldType.FLOAT);
|
||||
public static final Field TCHARGEMAXRPMMINTPS = Field.create("TCHARGEMAXRPMMINTPS", 2440, FieldType.FLOAT);
|
||||
public static final Field TCHARGEMAXRPMMAXTPS = Field.create("TCHARGEMAXRPMMAXTPS", 2444, FieldType.FLOAT);
|
||||
public static final Field AUXPIDPINS1 = Field.create("AUXPIDPINS1", 2448, FieldType.INT, brain_pin_e);
|
||||
public static final Field AUXPIDPINS2 = Field.create("AUXPIDPINS2", 2452, FieldType.INT, brain_pin_e);
|
||||
public static final Field AUXPIDPINS3 = Field.create("AUXPIDPINS3", 2456, FieldType.INT, brain_pin_e);
|
||||
public static final Field AUXPIDPINS4 = Field.create("AUXPIDPINS4", 2460, FieldType.INT, brain_pin_e);
|
||||
public static final Field AUXPIDFREQUENCY1 = Field.create("AUXPIDFREQUENCY1", 2464, FieldType.INT);
|
||||
public static final Field AUXPIDFREQUENCY2 = Field.create("AUXPIDFREQUENCY2", 2466, FieldType.INT);
|
||||
public static final Field AUXPIDFREQUENCY3 = Field.create("AUXPIDFREQUENCY3", 2468, FieldType.INT);
|
||||
public static final Field AUXPIDFREQUENCY4 = Field.create("AUXPIDFREQUENCY4", 2470, FieldType.INT);
|
||||
public static final Field ALTERNATORPWMFREQUENCY = Field.create("ALTERNATORPWMFREQUENCY", 2472, FieldType.INT);
|
||||
public static final Field LE_FORMULAS1 = Field.create("LE_FORMULAS1", 3048, FieldType.INT);
|
||||
public static final Field LE_FORMULAS2 = Field.create("LE_FORMULAS2", 3248, FieldType.INT);
|
||||
public static final Field LE_FORMULAS3 = Field.create("LE_FORMULAS3", 3448, FieldType.INT);
|
||||
|
|
|
@ -36,7 +36,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20160620;
|
||||
public static final int CONSOLE_VERSION = 20160702;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
Loading…
Reference in New Issue