diff --git a/firmware/config/engines/ford_festiva.cpp b/firmware/config/engines/ford_festiva.cpp index 13e4fbd3bb..cb3a90711a 100644 --- a/firmware/config/engines/ford_festiva.cpp +++ b/firmware/config/engines/ford_festiva.cpp @@ -110,7 +110,7 @@ void setFordEscortGt(DECLARE_ENGINE_PARAMETER_F) { setWholeTimingTable(10 PASS_ENGINE_PARAMETER); // set_whole_fuel_map 5 setWholeFuelMap(5 PASS_ENGINE_PARAMETER); - setMap(config->veTable, 13.5); + setMap(config->afrTable, 13.5); setSingleCoilDwell(engineConfiguration); engineConfiguration->ignitionMode = IM_ONE_COIL; diff --git a/java_console/.idea/inspectionProfiles/Project_Default.xml b/java_console/.idea/inspectionProfiles/Project_Default.xml new file mode 100644 index 0000000000..cc6d973265 --- /dev/null +++ b/java_console/.idea/inspectionProfiles/Project_Default.xml @@ -0,0 +1,19 @@ + + + + \ No newline at end of file diff --git a/java_console/romraider/src/com/romraider/maps/Table2D.java b/java_console/romraider/src/com/romraider/maps/Table2D.java index 641b9db4c5..0b16ad8797 100644 --- a/java_console/romraider/src/com/romraider/maps/Table2D.java +++ b/java_console/romraider/src/com/romraider/maps/Table2D.java @@ -19,13 +19,13 @@ package com.romraider.maps; -import static com.romraider.util.ParamChecker.isNullOrEmpty; +import com.romraider.Settings; +import com.romraider.util.SettingsManager; +import com.rusefi.Launcher; -import java.awt.BorderLayout; -import java.awt.Cursor; -import java.awt.Dimension; -import java.awt.Toolkit; -import java.awt.Window; +import javax.naming.NameNotFoundException; +import javax.swing.*; +import java.awt.*; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.StringSelection; import java.awt.datatransfer.UnsupportedFlavorException; @@ -33,15 +33,7 @@ import java.awt.event.KeyListener; import java.io.IOException; import java.util.StringTokenizer; -import javax.naming.NameNotFoundException; -import javax.swing.JLabel; -import javax.swing.SwingUtilities; -import javax.swing.SwingWorker; - -import com.romraider.Settings; -import com.romraider.editor.ecu.ECUEditorManager; -import com.romraider.util.SettingsManager; -import com.rusefi.Launcher; +import static com.romraider.util.ParamChecker.isNullOrEmpty; /** * A better implementation would be a composition of two Table1D - one for axis another one for data @@ -53,7 +45,6 @@ public class Table2D extends TableWithData { private Table1D axis = new Table1D(); private JLabel axisLabel; - private CopyTable2DWorker copyTable2DWorker; private CopySelection2DWorker copySelection2DWorker; public Table2D() { @@ -269,7 +260,7 @@ public class Table2D extends TableWithData { } Launcher.getFrame().setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - copyTable2DWorker = new CopyTable2DWorker(this); + CopyTable2DWorker copyTable2DWorker = new CopyTable2DWorker(this); copyTable2DWorker.execute(); } @@ -280,8 +271,7 @@ public class Table2D extends TableWithData { try { input = (String) Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor); st = new StringTokenizer(input); - } catch (UnsupportedFlavorException ex) { /* wrong paste type -- do nothing */ - } catch (IOException ex) { + } catch (UnsupportedFlavorException | IOException ex) { /* wrong paste type -- do nothing */ } String pasteType = st.nextToken(); diff --git a/java_console/romraider/src/com/romraider/maps/Table3D.java b/java_console/romraider/src/com/romraider/maps/Table3D.java index 1ab450e239..b3fcfbf8dd 100644 --- a/java_console/romraider/src/com/romraider/maps/Table3D.java +++ b/java_console/romraider/src/com/romraider/maps/Table3D.java @@ -162,7 +162,7 @@ public class Table3D extends Table { xAxis.populateTable(input, romRamOffset); yAxis.populateTable(input, romRamOffset); } catch (ArrayIndexOutOfBoundsException ex) { - throw new ArrayIndexOutOfBoundsException(); + throw ex; } for (int x = 0; x < xAxis.getDataSize(); x++) { diff --git a/java_console/romraider/src/com/romraider/xml/RomAttributeParser.java b/java_console/romraider/src/com/romraider/xml/RomAttributeParser.java index cd51d0cfbb..f18763013c 100644 --- a/java_console/romraider/src/com/romraider/xml/RomAttributeParser.java +++ b/java_console/romraider/src/com/romraider/xml/RomAttributeParser.java @@ -140,7 +140,7 @@ public final class RomAttributeParser { } return output; } catch (IndexOutOfBoundsException ex) { - throw new IndexOutOfBoundsException(); + throw ex; } } diff --git a/java_console/ui/src/com/rusefi/ui/FormulasPane.java b/java_console/ui/src/com/rusefi/ui/FormulasPane.java index 40e438b470..00208c147c 100644 --- a/java_console/ui/src/com/rusefi/ui/FormulasPane.java +++ b/java_console/ui/src/com/rusefi/ui/FormulasPane.java @@ -80,7 +80,10 @@ public class FormulasPane { return; int algorithm = ConfigField.getIntValue(ci, Fields.ALGORITHM); - engine_load_mode_e algo = engine_load_mode_e.values()[algorithm]; + engine_load_mode_e[] values = engine_load_mode_e.values(); + if (algorithm >= values.length) + throw new IllegalStateException("Unexpected "+ algorithm); + engine_load_mode_e algo = values[algorithm]; String acceleration = getAccelerationVariables(ci); diff --git a/java_console/ui/src/com/rusefi/ui/FuelTunePane.java b/java_console/ui/src/com/rusefi/ui/FuelTunePane.java index 81039fcf24..0cc4cd0b29 100644 --- a/java_console/ui/src/com/rusefi/ui/FuelTunePane.java +++ b/java_console/ui/src/com/rusefi/ui/FuelTunePane.java @@ -1,5 +1,8 @@ package com.rusefi.ui; +import com.romraider.Settings; +import com.romraider.maps.Scale; +import com.romraider.maps.Table3D; import com.rusefi.BinarySearch; import com.rusefi.FileLog; import com.rusefi.autotune.FuelAutoTune; @@ -28,6 +31,7 @@ public class FuelTunePane { private final List incomingDataPoints = new ArrayList<>(); 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(); public FuelTunePane() { final JLabel incomingBufferSize = new JLabel(); @@ -57,7 +61,22 @@ public class FuelTunePane { timer.start(); content.add(topPanel, BorderLayout.NORTH); -// UiUtils.trueLayout(content.getParent()); + + // todo: which one is which? + veTable.setSizeX(Fields.FUEL_LOAD_COUNT); + veTable.setSizeY(Fields.FUEL_RPM_COUNT); + veTable.getXAxis().setDataSize(Fields.FUEL_LOAD_COUNT); + veTable.getYAxis().setDataSize(Fields.FUEL_RPM_COUNT); + + veTable.getXAxis().setAxisParent(veTable); + veTable.getYAxis().setAxisParent(veTable); + + content.add(veTable, BorderLayout.CENTER); + veTable.setBorder(BorderFactory.createLineBorder(Color.red)); + veTable.addScale(new Scale()); + veTable.getXAxis().addScale(new Scale()); + veTable.getYAxis().addScale(new Scale()); + } private void doJob() { @@ -95,6 +114,16 @@ public class FuelTunePane { loadArray(veLoadBins, Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4); loadArray(veRpmBins, Fields.VETABLE.getOffset() + Fields.FUEL_RPM_COUNT * Fields.FUEL_LOAD_COUNT * 4 + Fields.FUEL_LOAD_COUNT * 4); + + BinaryProtocol bp = BinaryProtocol.instance; + + byte[] content = bp.getController().getContent(); + veTable.setStorageAddress(Fields.VETABLE.getOffset()); + veTable.setStorageType(Settings.STORAGE_TYPE_FLOAT); + veTable.populateTable(content, 0); + veTable.drawTable(); + +// UiUtils.trueLayout(content.getParent()); } private void loadMap(double[][] map, int offset) {