From 51baecd3d0578d3ee0cdaada323db427ca5179bd Mon Sep 17 00:00:00 2001 From: rusefi Date: Mon, 10 Sep 2018 23:43:44 -0400 Subject: [PATCH] console compiles again --- .../models/src/com/rusefi/BinarySearch.java | 2 +- .../src/com/rusefi/test/BinarySearchTest.java | 2 +- .../ui/src/com/rusefi/ui/FuelTunePane.java | 26 +++++++++---------- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/java_console/models/src/com/rusefi/BinarySearch.java b/java_console/models/src/com/rusefi/BinarySearch.java index e5a48abe8b..96318acfbd 100644 --- a/java_console/models/src/com/rusefi/BinarySearch.java +++ b/java_console/models/src/com/rusefi/BinarySearch.java @@ -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; diff --git a/java_console/models/src/com/rusefi/test/BinarySearchTest.java b/java_console/models/src/com/rusefi/test/BinarySearchTest.java index e5ee3ebcb0..66cda281b2 100644 --- a/java_console/models/src/com/rusefi/test/BinarySearchTest.java +++ b/java_console/models/src/com/rusefi/test/BinarySearchTest.java @@ -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); diff --git a/java_console/ui/src/com/rusefi/ui/FuelTunePane.java b/java_console/ui/src/com/rusefi/ui/FuelTunePane.java index 49e410c6cd..cdd65c5a68 100644 --- a/java_console/ui/src/com/rusefi/ui/FuelTunePane.java +++ b/java_console/ui/src/com/rusefi/ui/FuelTunePane.java @@ -45,8 +45,8 @@ public class FuelTunePane { private final List 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");