console compiles again
This commit is contained in:
parent
a535b5b0e3
commit
51baecd3d0
|
@ -1,7 +1,7 @@
|
||||||
package com.rusefi;
|
package com.rusefi;
|
||||||
|
|
||||||
public class BinarySearch {
|
public class BinarySearch {
|
||||||
public static int binarySearch(double target, float[] angles) {
|
public static int binarySearch(double target, double[] angles) {
|
||||||
System.out.println("Testing " + target);
|
System.out.println("Testing " + target);
|
||||||
|
|
||||||
int left = 0;
|
int left = 0;
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class BinarySearchTest extends TestCase {
|
||||||
|
|
||||||
public void testBinary() {
|
public void testBinary() {
|
||||||
|
|
||||||
float[] angles = new float[] {0, 56, 126, 180, 236, 279, 306, 416, 486, 540, 596, 666};
|
double[] angles = new double[] {0, 56, 126, 180, 236, 279, 306, 416, 486, 540, 596, 666};
|
||||||
|
|
||||||
Arrays.sort(angles);
|
Arrays.sort(angles);
|
||||||
|
|
||||||
|
|
|
@ -45,8 +45,8 @@ public class FuelTunePane {
|
||||||
|
|
||||||
|
|
||||||
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
|
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
|
||||||
private final float veLoadBins[] = new float[Fields.FUEL_LOAD_COUNT];
|
private final double veLoadBins[] = new double[Fields.FUEL_LOAD_COUNT];
|
||||||
private final float veRpmBins[] = new float[Fields.FUEL_RPM_COUNT];
|
private final double veRpmBins[] = new double[Fields.FUEL_RPM_COUNT];
|
||||||
private final Table3D veTable = new Table3D();
|
private final Table3D veTable = new Table3D();
|
||||||
private final Table3D changeMap = new Table3D();
|
private final Table3D changeMap = new Table3D();
|
||||||
private final JButton upload = new JButton("Upload");
|
private final JButton upload = new JButton("Upload");
|
||||||
|
@ -189,7 +189,7 @@ public class FuelTunePane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doJob() {
|
private void doJob() {
|
||||||
float veTable[][] = new float[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
|
double veTable[][] = new double[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
|
||||||
loadMap(veTable, Fields.VETABLE.getOffset());
|
loadMap(veTable, Fields.VETABLE.getOffset());
|
||||||
logMap("source", veTable);
|
logMap("source", veTable);
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ public class FuelTunePane {
|
||||||
// todo: move this away from AWT thread
|
// todo: move this away from AWT thread
|
||||||
Result a = FuelAutoTune.INSTANCE.process(false, data, 0.1, 14.7, veTable);
|
Result a = FuelAutoTune.INSTANCE.process(false, data, 0.1, 14.7, veTable);
|
||||||
|
|
||||||
float[][] result = a.getKgbcRES();
|
double[][] result = a.getKgbcRES();
|
||||||
logMap("result", result);
|
logMap("result", result);
|
||||||
newVeMap = toByteArray(result);
|
newVeMap = toByteArray(result);
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ public class FuelTunePane {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void logMap(String msg, float[][] table) {
|
private void logMap(String msg, double[][] table) {
|
||||||
DataOutputStream dos = getTuneLogStream();
|
DataOutputStream dos = getTuneLogStream();
|
||||||
if (dos == null)
|
if (dos == null)
|
||||||
return;
|
return;
|
||||||
|
@ -236,16 +236,16 @@ public class FuelTunePane {
|
||||||
|
|
||||||
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
|
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
|
||||||
dos.writeChar('\t');
|
dos.writeChar('\t');
|
||||||
dos.writeBytes(Float.toString(veRpmBins[rpmIndex]));
|
dos.writeBytes(Double.toString(veRpmBins[rpmIndex]));
|
||||||
}
|
}
|
||||||
dos.writeBytes("\r\n");
|
dos.writeBytes("\r\n");
|
||||||
|
|
||||||
for (int loadIndex = 0; loadIndex < Fields.FUEL_LOAD_COUNT; loadIndex++) {
|
for (int loadIndex = 0; loadIndex < Fields.FUEL_LOAD_COUNT; loadIndex++) {
|
||||||
dos.writeBytes(Float.toString(veLoadBins[loadIndex]));
|
dos.writeBytes(Double.toString(veLoadBins[loadIndex]));
|
||||||
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
|
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
|
||||||
dos.writeChar('\t');
|
dos.writeChar('\t');
|
||||||
float v = table[loadIndex][rpmIndex];
|
double v = table[loadIndex][rpmIndex];
|
||||||
dos.writeBytes(Float.toString(v));
|
dos.writeBytes(Double.toString(v));
|
||||||
}
|
}
|
||||||
dos.writeBytes("\r\n");
|
dos.writeBytes("\r\n");
|
||||||
}
|
}
|
||||||
|
@ -267,12 +267,12 @@ public class FuelTunePane {
|
||||||
return dos;
|
return dos;
|
||||||
}
|
}
|
||||||
|
|
||||||
private byte[] toByteArray(float[][] output) {
|
private byte[] toByteArray(double[][] output) {
|
||||||
try {
|
try {
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
for (int loadIndex = 0; loadIndex < Fields.FUEL_LOAD_COUNT; loadIndex++) {
|
for (int loadIndex = 0; loadIndex < Fields.FUEL_LOAD_COUNT; loadIndex++) {
|
||||||
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
|
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
|
||||||
byte[] b4 = RomAttributeParser.floatToByte(output[loadIndex][rpmIndex], Settings.ENDIAN_BIG);
|
byte[] b4 = RomAttributeParser.floatToByte((float)output[loadIndex][rpmIndex], Settings.ENDIAN_BIG);
|
||||||
baos.write(b4);
|
baos.write(b4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -323,13 +323,13 @@ public class FuelTunePane {
|
||||||
return content;
|
return content;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadMap(float[][] map, int offset) {
|
private void loadMap(double[][] map, int offset) {
|
||||||
for (int engineLoadIndex = 0; engineLoadIndex < map.length; engineLoadIndex++) {
|
for (int engineLoadIndex = 0; engineLoadIndex < map.length; engineLoadIndex++) {
|
||||||
loadArray(map[engineLoadIndex], offset + engineLoadIndex * 4 * Fields.FUEL_RPM_COUNT);
|
loadArray(map[engineLoadIndex], offset + engineLoadIndex * 4 * Fields.FUEL_RPM_COUNT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void loadArray(float[] array, int offset) {
|
private void loadArray(double[] array, int offset) {
|
||||||
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
|
BinaryProtocol bp = BinaryProtocolHolder.getInstance().get();
|
||||||
if (bp == null) {
|
if (bp == null) {
|
||||||
FileLog.MAIN.logLine("bp not ready");
|
FileLog.MAIN.logLine("bp not ready");
|
||||||
|
|
Loading…
Reference in New Issue