console compiles again

This commit is contained in:
rusefi 2018-09-10 23:43:44 -04:00
parent a535b5b0e3
commit 51baecd3d0
3 changed files with 15 additions and 15 deletions

View File

@ -1,7 +1,7 @@
package com.rusefi;
public class BinarySearch {
public static int binarySearch(double target, float[] angles) {
public static int binarySearch(double target, double[] angles) {
System.out.println("Testing " + target);
int left = 0;

View File

@ -12,7 +12,7 @@ public class BinarySearchTest extends TestCase {
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);

View File

@ -45,8 +45,8 @@ public class FuelTunePane {
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
private final float veLoadBins[] = new float[Fields.FUEL_LOAD_COUNT];
private final float veRpmBins[] = new float[Fields.FUEL_RPM_COUNT];
private final double veLoadBins[] = new double[Fields.FUEL_LOAD_COUNT];
private final double veRpmBins[] = new double[Fields.FUEL_RPM_COUNT];
private final Table3D veTable = new Table3D();
private final Table3D changeMap = new Table3D();
private final JButton upload = new JButton("Upload");
@ -189,7 +189,7 @@ public class FuelTunePane {
}
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());
logMap("source", veTable);
@ -204,7 +204,7 @@ public class FuelTunePane {
// todo: move this away from AWT thread
Result a = FuelAutoTune.INSTANCE.process(false, data, 0.1, 14.7, veTable);
float[][] result = a.getKgbcRES();
double[][] result = a.getKgbcRES();
logMap("result", 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();
if (dos == null)
return;
@ -236,16 +236,16 @@ public class FuelTunePane {
for (int rpmIndex = 0; rpmIndex < Fields.FUEL_RPM_COUNT; rpmIndex++) {
dos.writeChar('\t');
dos.writeBytes(Float.toString(veRpmBins[rpmIndex]));
dos.writeBytes(Double.toString(veRpmBins[rpmIndex]));
}
dos.writeBytes("\r\n");
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++) {
dos.writeChar('\t');
float v = table[loadIndex][rpmIndex];
dos.writeBytes(Float.toString(v));
double v = table[loadIndex][rpmIndex];
dos.writeBytes(Double.toString(v));
}
dos.writeBytes("\r\n");
}
@ -267,12 +267,12 @@ public class FuelTunePane {
return dos;
}
private byte[] toByteArray(float[][] output) {
private byte[] toByteArray(double[][] output) {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
for (int loadIndex = 0; loadIndex < Fields.FUEL_LOAD_COUNT; loadIndex++) {
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);
}
}
@ -323,13 +323,13 @@ public class FuelTunePane {
return content;
}
private void loadMap(float[][] map, int offset) {
private void loadMap(double[][] map, int offset) {
for (int engineLoadIndex = 0; engineLoadIndex < map.length; engineLoadIndex++) {
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();
if (bp == null) {
FileLog.MAIN.logLine("bp not ready");