auto-sync
This commit is contained in:
parent
f90e0f5a2a
commit
70725da9f6
|
@ -1,9 +1,6 @@
|
||||||
package com.rusefi;
|
package com.rusefi;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.*;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,13 +24,23 @@ public class ConfigurationImage {
|
||||||
return content.length;
|
return content.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public byte[] getFileContent() throws IOException {
|
||||||
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
|
try {
|
||||||
|
byte[] bytes = BIN_HEADER.getBytes();
|
||||||
|
if (bytes.length != BIN_HEADER.length())
|
||||||
|
throw new IllegalStateException("Encoding issue");
|
||||||
|
baos.write(bytes);
|
||||||
|
baos.write(content);
|
||||||
|
return baos.toByteArray();
|
||||||
|
} finally {
|
||||||
|
baos.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void saveToFile(String fileName) throws IOException {
|
public void saveToFile(String fileName) throws IOException {
|
||||||
FileOutputStream fos = new FileOutputStream(fileName);
|
FileOutputStream fos = new FileOutputStream(fileName);
|
||||||
byte[] bytes = BIN_HEADER.getBytes();
|
fos.write(getFileContent());
|
||||||
if (bytes.length != BIN_HEADER.length())
|
|
||||||
throw new IllegalStateException("Encoding issue");
|
|
||||||
fos.write(bytes);
|
|
||||||
fos.write(content);
|
|
||||||
fos.close();
|
fos.close();
|
||||||
System.out.println("Saved to " + fileName);
|
System.out.println("Saved to " + fileName);
|
||||||
}
|
}
|
||||||
|
|
|
@ -89,8 +89,7 @@ public class ECUExec {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void openRom(final ECUEditor editor, final String rom) {
|
||||||
private static void openRom(final ECUEditor editor, final String rom) {
|
|
||||||
invokeLater(new Runnable() {
|
invokeLater(new Runnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
|
|
@ -66,12 +66,11 @@ import javax.swing.tree.TreePath;
|
||||||
|
|
||||||
import org.w3c.dom.Document;
|
import org.w3c.dom.Document;
|
||||||
import org.xml.sax.InputSource;
|
import org.xml.sax.InputSource;
|
||||||
|
import org.xml.sax.SAXException;
|
||||||
import org.xml.sax.SAXParseException;
|
import org.xml.sax.SAXParseException;
|
||||||
|
|
||||||
import com.romraider.net.BrowserControl;
|
|
||||||
import com.romraider.Settings;
|
import com.romraider.Settings;
|
||||||
import com.romraider.maps.Rom;
|
import com.romraider.maps.Rom;
|
||||||
import com.romraider.net.URL;
|
|
||||||
import com.romraider.swing.AbstractFrame;
|
import com.romraider.swing.AbstractFrame;
|
||||||
import com.romraider.swing.CustomToolbarLayout;
|
import com.romraider.swing.CustomToolbarLayout;
|
||||||
import com.romraider.swing.ECUEditorMenuBar;
|
import com.romraider.swing.ECUEditorMenuBar;
|
||||||
|
@ -147,6 +146,42 @@ public class ECUEditor extends AbstractFrame {
|
||||||
toFront();
|
toFront();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void openImage(byte[] input, File definitionFile, String fileName) throws Exception {
|
||||||
|
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||||
|
DOMParser parser = new DOMParser();
|
||||||
|
Document doc;
|
||||||
|
FileInputStream fileStream;
|
||||||
|
fileStream = new FileInputStream(definitionFile);
|
||||||
|
InputSource src = new InputSource(fileStream);
|
||||||
|
|
||||||
|
parser.parse(src);
|
||||||
|
doc = parser.getDocument();
|
||||||
|
|
||||||
|
Rom rom;
|
||||||
|
try {
|
||||||
|
rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(doc.getDocumentElement(), input, editor.getStatusPanel());
|
||||||
|
} finally {
|
||||||
|
// Release mem after unmarshall.
|
||||||
|
parser.reset();
|
||||||
|
doc.removeChild(doc.getDocumentElement());
|
||||||
|
doc = null;
|
||||||
|
fileStream.close();
|
||||||
|
System.gc();
|
||||||
|
}
|
||||||
|
|
||||||
|
editor.getStatusPanel().setStatus("Populating tables...");
|
||||||
|
|
||||||
|
rom.setFullFileName(fileName);
|
||||||
|
rom.populateTables(input, editor.getStatusPanel());
|
||||||
|
|
||||||
|
editor.getStatusPanel().setStatus("Finalizing...");
|
||||||
|
|
||||||
|
editor.addRom(rom);
|
||||||
|
editor.refreshTableCompareMenus();
|
||||||
|
|
||||||
|
editor.getStatusPanel().setStatus("Done loading image...");
|
||||||
|
}
|
||||||
|
|
||||||
public void initializeEditorUI() {
|
public void initializeEditorUI() {
|
||||||
//create menubar
|
//create menubar
|
||||||
menuBar = new ECUEditorMenuBar();
|
menuBar = new ECUEditorMenuBar();
|
||||||
|
@ -478,17 +513,7 @@ public class ECUEditor extends AbstractFrame {
|
||||||
openImageWorker.execute();
|
openImageWorker.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void openImages(File[] inputFiles) throws Exception {
|
public static byte[] readFile(File inputFile) throws IOException {
|
||||||
if(inputFiles.length < 1) {
|
|
||||||
showMessageDialog(this, "Image Not Found", "Error Loading Image(s)", ERROR_MESSAGE);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
for(int j = 0; j < inputFiles.length; j++) {
|
|
||||||
openImage(inputFiles[j]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public byte[] readFile(File inputFile) throws IOException {
|
|
||||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||||
FileInputStream fis = new FileInputStream(inputFile);
|
FileInputStream fis = new FileInputStream(inputFile);
|
||||||
try {
|
try {
|
||||||
|
@ -643,62 +668,28 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
||||||
ECUEditor editor = ECUEditorManager.getECUEditor();
|
ECUEditor editor = ECUEditorManager.getECUEditor();
|
||||||
Settings settings = SettingsManager.getSettings();
|
Settings settings = SettingsManager.getSettings();
|
||||||
|
|
||||||
DOMParser parser = new DOMParser();
|
|
||||||
Document doc;
|
|
||||||
FileInputStream fileStream;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
editor.getStatusPanel().setStatus("Parsing ECU definitions...");
|
editor.getStatusPanel().setStatus("Parsing ECU definitions...");
|
||||||
setProgress(0);
|
setProgress(0);
|
||||||
|
|
||||||
byte[] input = editor.readFile(inputFile);
|
byte[] input = ECUEditor.readFile(inputFile);
|
||||||
|
|
||||||
editor.getStatusPanel().setStatus("Finding ECU definition...");
|
editor.getStatusPanel().setStatus("Finding ECU definition...");
|
||||||
setProgress(10);
|
setProgress(10);
|
||||||
|
|
||||||
// parse ecu definition files until result found
|
// parse ecu definition files until result found
|
||||||
for (int i = 0; i < settings.getEcuDefinitionFiles().size(); i++) {
|
for (int i = 0; i < settings.getEcuDefinitionFiles().size(); i++) {
|
||||||
fileStream = new FileInputStream(settings.getEcuDefinitionFiles().get(i));
|
File definitionFile = settings.getEcuDefinitionFiles().get(i);
|
||||||
InputSource src = new InputSource(fileStream);
|
|
||||||
|
|
||||||
parser.parse(src);
|
|
||||||
doc = parser.getDocument();
|
|
||||||
|
|
||||||
Rom rom;
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
rom = new DOMRomUnmarshaller().unmarshallXMLDefinition(doc.getDocumentElement(), input, editor.getStatusPanel());
|
|
||||||
|
ECUEditor.openImage(input, definitionFile, inputFile.getName());
|
||||||
|
setProgress(100);
|
||||||
|
return null;
|
||||||
|
|
||||||
} catch (RomNotFoundException rex) {
|
} catch (RomNotFoundException rex) {
|
||||||
// rom was not found in current file, skip to next
|
// rom was not found in current file, skip to next
|
||||||
continue;
|
|
||||||
} catch (Exception ex) {
|
|
||||||
ex.printStackTrace();
|
|
||||||
showMessageDialog(editor, "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
|
||||||
return null;
|
|
||||||
} finally {
|
|
||||||
// Release mem after unmarshall.
|
|
||||||
parser.reset();
|
|
||||||
doc.removeChild(doc.getDocumentElement());
|
|
||||||
doc = null;
|
|
||||||
fileStream.close();
|
|
||||||
System.gc();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
editor.getStatusPanel().setStatus("Populating tables...");
|
|
||||||
setProgress(50);
|
|
||||||
|
|
||||||
rom.setFullFileName(inputFile);
|
|
||||||
rom.populateTables(input, editor.getStatusPanel());
|
|
||||||
|
|
||||||
editor.getStatusPanel().setStatus("Finalizing...");
|
|
||||||
setProgress(90);
|
|
||||||
|
|
||||||
editor.addRom(rom);
|
|
||||||
editor.refreshTableCompareMenus();
|
|
||||||
|
|
||||||
editor.getStatusPanel().setStatus("Done loading image...");
|
|
||||||
setProgress(100);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// if code executes to this point, no ROM was found, report to user
|
// if code executes to this point, no ROM was found, report to user
|
||||||
|
@ -716,6 +707,9 @@ class OpenImageWorker extends SwingWorker<Void, Void> {
|
||||||
// handles Java heap space issues when loading multiple Roms.
|
// handles Java heap space issues when loading multiple Roms.
|
||||||
showMessageDialog(editor, "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
showMessageDialog(editor, "Error loading Image. Out of memeory.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||||
|
|
||||||
|
} catch (Exception ex) {
|
||||||
|
ex.printStackTrace();
|
||||||
|
showMessageDialog(editor, "Error Loading. Unknown Exception.", "Error Loading " + inputFile.getName(), ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,7 +27,6 @@ import static javax.swing.JOptionPane.QUESTION_MESSAGE;
|
||||||
import static javax.swing.JOptionPane.showOptionDialog;
|
import static javax.swing.JOptionPane.showOptionDialog;
|
||||||
|
|
||||||
import java.beans.PropertyVetoException;
|
import java.beans.PropertyVetoException;
|
||||||
import java.io.File;
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -56,7 +55,6 @@ public class Rom extends DefaultMutableTreeNode implements Serializable {
|
||||||
private static final Logger LOGGER = Logger.getLogger(Rom.class);
|
private static final Logger LOGGER = Logger.getLogger(Rom.class);
|
||||||
private RomID romID = new RomID();
|
private RomID romID = new RomID();
|
||||||
private String fileName = "";
|
private String fileName = "";
|
||||||
private File fullFileName = new File(".");
|
|
||||||
private final Vector<TableTreeNode> tableNodes = new Vector<TableTreeNode>();
|
private final Vector<TableTreeNode> tableNodes = new Vector<TableTreeNode>();
|
||||||
private byte[] binData;
|
private byte[] binData;
|
||||||
private boolean isAbstract = false;
|
private boolean isAbstract = false;
|
||||||
|
@ -380,13 +378,8 @@ public class Rom extends DefaultMutableTreeNode implements Serializable {
|
||||||
return binData.length;
|
return binData.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public File getFullFileName() {
|
public void setFullFileName(String fileName) {
|
||||||
return fullFileName;
|
this.setFileName(fileName);
|
||||||
}
|
|
||||||
|
|
||||||
public void setFullFileName(File fullFileName) {
|
|
||||||
this.fullFileName = fullFileName;
|
|
||||||
this.setFileName(fullFileName.getName());
|
|
||||||
for (TableTreeNode tableNode : tableNodes) {
|
for (TableTreeNode tableNode : tableNodes) {
|
||||||
String frameTitle = this.getFileName() + " - " + tableNode.getTable().getName();
|
String frameTitle = this.getFileName() + " - " + tableNode.getTable().getName();
|
||||||
tableNode.getFrame().setTitle(frameTitle);
|
tableNode.getFrame().setTitle(frameTitle);
|
||||||
|
|
|
@ -19,19 +19,14 @@
|
||||||
|
|
||||||
package com.romraider.swing;
|
package com.romraider.swing;
|
||||||
|
|
||||||
import static com.romraider.Version.ABOUT_ICON;
|
import com.romraider.Settings;
|
||||||
import static com.romraider.Version.BUILDNUMBER;
|
import com.romraider.editor.ecu.ECUEditor;
|
||||||
//import static com.romraider.Version.ECU_DEFS_URL;
|
import com.romraider.editor.ecu.ECUEditorManager;
|
||||||
import static com.romraider.Version.PRODUCT_NAME;
|
import com.romraider.maps.Rom;
|
||||||
import static com.romraider.Version.SUPPORT_URL;
|
import com.romraider.maps.Table;
|
||||||
import static com.romraider.Version.VERSION;
|
import com.romraider.util.SettingsManager;
|
||||||
import static javax.swing.JOptionPane.CANCEL_OPTION;
|
|
||||||
import static javax.swing.JOptionPane.ERROR_MESSAGE;
|
|
||||||
import static javax.swing.JOptionPane.INFORMATION_MESSAGE;
|
|
||||||
import static javax.swing.JOptionPane.showConfirmDialog;
|
|
||||||
import static javax.swing.JOptionPane.showMessageDialog;
|
|
||||||
import static javax.swing.WindowConstants.DISPOSE_ON_CLOSE;
|
|
||||||
|
|
||||||
|
import javax.swing.*;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.awt.event.ActionListener;
|
import java.awt.event.ActionListener;
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
|
@ -39,34 +34,24 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
|
|
||||||
import javax.swing.ButtonGroup;
|
import static com.romraider.Version.*;
|
||||||
import javax.swing.JFileChooser;
|
import static javax.swing.JOptionPane.*;
|
||||||
import javax.swing.JMenu;
|
|
||||||
import javax.swing.JMenuBar;
|
|
||||||
import javax.swing.JMenuItem;
|
|
||||||
import javax.swing.JRadioButtonMenuItem;
|
|
||||||
import javax.swing.JSeparator;
|
|
||||||
|
|
||||||
import com.romraider.Settings;
|
//import static com.romraider.Version.ECU_DEFS_URL;
|
||||||
import com.romraider.editor.ecu.ECUEditor;
|
|
||||||
import com.romraider.editor.ecu.ECUEditorManager;
|
|
||||||
import com.romraider.maps.Rom;
|
|
||||||
import com.romraider.maps.Table;
|
|
||||||
import com.romraider.net.BrowserControl;
|
|
||||||
import com.romraider.util.SettingsManager;
|
|
||||||
|
|
||||||
|
@SuppressWarnings("FieldCanBeLocal")
|
||||||
public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = -4777040428837855236L;
|
private static final long serialVersionUID = -4777040428837855236L;
|
||||||
private final JMenu fileMenu = new JMenu("File");
|
// private final JMenu fileMenu = new JMenu("File");
|
||||||
private final JMenuItem openImage = new JMenuItem("Open Image...");
|
// private final JMenuItem openImage = new JMenuItem("Open Image...");
|
||||||
private final JMenuItem openImages = new JMenuItem("Open Image(s)...");
|
// private final JMenuItem openImages = new JMenuItem("Open Image(s)...");
|
||||||
private final JMenuItem saveImage = new JMenuItem("Save Image As...");
|
// private final JMenuItem saveImage = new JMenuItem("Save Image As...");
|
||||||
private final JMenuItem saveAsRepository = new JMenuItem("Save Image As Repository...");
|
// private final JMenuItem saveAsRepository = new JMenuItem("Save Image As Repository...");
|
||||||
private final JMenuItem refreshImage = new JMenuItem("Refresh Image");
|
private final JMenuItem refreshImage = new JMenuItem("Refresh Image");
|
||||||
private final JMenuItem closeImage = new JMenuItem("Close Image");
|
// private final JMenuItem closeImage = new JMenuItem("Close Image");
|
||||||
private final JMenuItem closeAll = new JMenuItem("Close All Images");
|
// private final JMenuItem closeAll = new JMenuItem("Close All Images");
|
||||||
private final JMenuItem exit = new JMenuItem("Exit");
|
// private final JMenuItem exit = new JMenuItem("Exit");
|
||||||
|
|
||||||
// private final JMenu definitionMenu = new JMenu("ECU Definitions");
|
// private final JMenu definitionMenu = new JMenu("ECU Definitions");
|
||||||
// private final JMenuItem defManager = new JMenuItem("ECU Definition Manager...");
|
// private final JMenuItem defManager = new JMenuItem("ECU Definition Manager...");
|
||||||
|
@ -94,7 +79,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
// private final JMenu loggerMenu = new JMenu("Logger");
|
// private final JMenu loggerMenu = new JMenu("Logger");
|
||||||
// private final JMenuItem openLogger = new JMenuItem("Launch Logger...");
|
// private final JMenuItem openLogger = new JMenuItem("Launch Logger...");
|
||||||
|
|
||||||
private final JMenu ramTuneMenu = new JMenu("SSM");
|
// private final JMenu ramTuneMenu = new JMenu("SSM");
|
||||||
private final JMenuItem launchRamTuneTestApp = new JMenuItem("Launch Test App...");
|
private final JMenuItem launchRamTuneTestApp = new JMenuItem("Launch Test App...");
|
||||||
|
|
||||||
private final JMenu helpMenu = new JMenu("Help");
|
private final JMenu helpMenu = new JMenu("Help");
|
||||||
|
@ -102,44 +87,44 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
|
|
||||||
public ECUEditorMenuBar() {
|
public ECUEditorMenuBar() {
|
||||||
// file menu items
|
// file menu items
|
||||||
add(fileMenu);
|
// add(fileMenu);
|
||||||
fileMenu.setMnemonic('F');
|
// fileMenu.setMnemonic('F');
|
||||||
|
//
|
||||||
fileMenu.add(openImage);
|
// fileMenu.add(openImage);
|
||||||
openImage.addActionListener(this);
|
// openImage.addActionListener(this);
|
||||||
openImage.setMnemonic('O');
|
// openImage.setMnemonic('O');
|
||||||
|
|
||||||
//fileMenu.add(openImages);
|
//fileMenu.add(openImages);
|
||||||
//openImages.addActionListener(this);
|
//openImages.addActionListener(this);
|
||||||
//openImages.setMnemonic('I');
|
//openImages.setMnemonic('I');
|
||||||
|
|
||||||
fileMenu.add(saveImage);
|
// fileMenu.add(saveImage);
|
||||||
saveImage.addActionListener(this);
|
// saveImage.addActionListener(this);
|
||||||
saveImage.setMnemonic('S');
|
// saveImage.setMnemonic('S');
|
||||||
|
//
|
||||||
fileMenu.add(saveAsRepository);
|
// fileMenu.add(saveAsRepository);
|
||||||
saveAsRepository.setMnemonic('D');
|
// saveAsRepository.setMnemonic('D');
|
||||||
saveAsRepository.addActionListener(this);
|
// saveAsRepository.addActionListener(this);
|
||||||
|
//
|
||||||
fileMenu.add(refreshImage);
|
// fileMenu.add(refreshImage);
|
||||||
refreshImage.addActionListener(this);
|
// refreshImage.addActionListener(this);
|
||||||
refreshImage.setMnemonic('R');
|
// refreshImage.setMnemonic('R');
|
||||||
|
//
|
||||||
fileMenu.add(new JSeparator());
|
// fileMenu.add(new JSeparator());
|
||||||
|
//
|
||||||
fileMenu.add(closeImage);
|
// fileMenu.add(closeImage);
|
||||||
closeImage.addActionListener(this);
|
// closeImage.addActionListener(this);
|
||||||
closeImage.setMnemonic('C');
|
// closeImage.setMnemonic('C');
|
||||||
|
|
||||||
//fileMenu.add(closeAll);
|
//fileMenu.add(closeAll);
|
||||||
//closeAll.addActionListener(this);
|
//closeAll.addActionListener(this);
|
||||||
//closeAll.setMnemonic('A');
|
//closeAll.setMnemonic('A');
|
||||||
|
|
||||||
fileMenu.add(new JSeparator());
|
// fileMenu.add(new JSeparator());
|
||||||
|
//
|
||||||
fileMenu.add(exit);
|
// fileMenu.add(exit);
|
||||||
exit.addActionListener(this);
|
// exit.addActionListener(this);
|
||||||
exit.setMnemonic('X');
|
// exit.setMnemonic('X');
|
||||||
|
|
||||||
// edit menu items
|
// edit menu items
|
||||||
add(editMenu);
|
add(editMenu);
|
||||||
|
@ -242,10 +227,10 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
// openLogger.setMnemonic('O');
|
// openLogger.setMnemonic('O');
|
||||||
|
|
||||||
// ramtune menu items
|
// ramtune menu items
|
||||||
add(ramTuneMenu);
|
// add(ramTuneMenu);
|
||||||
ramTuneMenu.setMnemonic('R');
|
// ramTuneMenu.setMnemonic('R');
|
||||||
|
//
|
||||||
ramTuneMenu.add(launchRamTuneTestApp);
|
// ramTuneMenu.add(launchRamTuneTestApp);
|
||||||
launchRamTuneTestApp.addActionListener(this);
|
launchRamTuneTestApp.addActionListener(this);
|
||||||
launchRamTuneTestApp.setMnemonic('L');
|
launchRamTuneTestApp.setMnemonic('L');
|
||||||
|
|
||||||
|
@ -263,28 +248,28 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
public void updateMenu() {
|
public void updateMenu() {
|
||||||
String file = getLastSelectedRomFileName();
|
String file = getLastSelectedRomFileName();
|
||||||
if ("".equals(file)) {
|
if ("".equals(file)) {
|
||||||
saveImage.setEnabled(false);
|
// saveImage.setEnabled(false);
|
||||||
saveAsRepository.setEnabled(false);
|
// saveAsRepository.setEnabled(false);
|
||||||
closeImage.setEnabled(false);
|
// closeImage.setEnabled(false);
|
||||||
//closeAll.setEnabled(false);
|
//closeAll.setEnabled(false);
|
||||||
romProperties.setEnabled(false);
|
romProperties.setEnabled(false);
|
||||||
saveImage.setText("Save As...");
|
// saveImage.setText("Save As...");
|
||||||
saveAsRepository.setText("Save As Repository...");
|
// saveAsRepository.setText("Save As Repository...");
|
||||||
compareImages.setEnabled(false);
|
compareImages.setEnabled(false);
|
||||||
convertRom.setEnabled(false);
|
convertRom.setEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
saveImage.setEnabled(true);
|
// saveImage.setEnabled(true);
|
||||||
saveAsRepository.setEnabled(true);
|
// saveAsRepository.setEnabled(true);
|
||||||
closeImage.setEnabled(true);
|
// closeImage.setEnabled(true);
|
||||||
//closeAll.setEnabled(true);
|
//closeAll.setEnabled(true);
|
||||||
romProperties.setEnabled(true);
|
romProperties.setEnabled(true);
|
||||||
saveImage.setText("Save " + file + " As...");
|
// saveImage.setText("Save " + file + " As...");
|
||||||
saveAsRepository.setText("Save "+ file +" As Repository...");
|
// saveAsRepository.setText("Save "+ file +" As Repository...");
|
||||||
compareImages.setEnabled(true);
|
compareImages.setEnabled(true);
|
||||||
convertRom.setEnabled(true);
|
convertRom.setEnabled(true);
|
||||||
}
|
}
|
||||||
refreshImage.setText("Refresh " + file);
|
refreshImage.setText("Refresh " + file);
|
||||||
closeImage.setText("Close " + file);
|
// closeImage.setText("Close " + file);
|
||||||
romProperties.setText(file + "Properties");
|
romProperties.setText(file + "Properties");
|
||||||
|
|
||||||
int lastSelectedRomSize = 0;
|
int lastSelectedRomSize = 0;
|
||||||
|
@ -304,7 +289,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
convertDecrease.setEnabled(false);
|
convertDecrease.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
openImages.setEnabled(false);
|
//openImages.setEnabled(false);
|
||||||
// editDefinition.setEnabled(false);
|
// editDefinition.setEnabled(false);
|
||||||
revalidate();
|
revalidate();
|
||||||
}
|
}
|
||||||
|
@ -312,58 +297,51 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
ECUEditor parent = ECUEditorManager.getECUEditor();
|
ECUEditor parent = ECUEditorManager.getECUEditor();
|
||||||
if (e.getSource() == openImage) {
|
// if (e.getSource() == openImage) {
|
||||||
try {
|
// try {
|
||||||
openImageDialog();
|
// openImageDialog();
|
||||||
} catch (Exception ex) {
|
// } catch (Exception ex) {
|
||||||
showMessageDialog(parent,
|
// showMessageDialog(parent,
|
||||||
new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
// new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
|
// } else if (e.getSource() == openImages) {
|
||||||
|
// try {
|
||||||
|
// openImagesDialog();
|
||||||
|
// } catch (Exception ex) {
|
||||||
|
// showMessageDialog(parent,
|
||||||
|
// new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// } else if (e.getSource() == saveImage) {
|
||||||
|
// try {
|
||||||
|
// this.saveImage();
|
||||||
|
// } catch (Exception ex) {
|
||||||
|
// showMessageDialog(parent,
|
||||||
|
// new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
||||||
|
// }
|
||||||
|
// } else if (e.getSource() == saveAsRepository) {
|
||||||
|
// try {
|
||||||
|
// this.saveAsRepository();
|
||||||
|
// } catch(Exception ex) {
|
||||||
|
// showMessageDialog(parent,
|
||||||
|
// new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
||||||
|
// }
|
||||||
|
// } else if (e.getSource() == closeImage) {
|
||||||
|
// parent.closeImage();
|
||||||
|
//
|
||||||
|
// } else if (e.getSource() == closeAll) {
|
||||||
|
// parent.closeAllImages();
|
||||||
|
//
|
||||||
|
// } else if (e.getSource() == exit) {
|
||||||
|
// parent.handleExit();
|
||||||
|
// System.exit(0);
|
||||||
|
|
||||||
} else if (e.getSource() == openImages) {
|
//} else
|
||||||
try {
|
if (e.getSource() == romProperties) {
|
||||||
openImagesDialog();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showMessageDialog(parent,
|
|
||||||
new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (e.getSource() == saveImage) {
|
|
||||||
try {
|
|
||||||
this.saveImage();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showMessageDialog(parent,
|
|
||||||
new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
} else if (e.getSource() == saveAsRepository) {
|
|
||||||
try {
|
|
||||||
this.saveAsRepository();
|
|
||||||
} catch(Exception ex) {
|
|
||||||
showMessageDialog(parent,
|
|
||||||
new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
} else if (e.getSource() == closeImage) {
|
|
||||||
parent.closeImage();
|
|
||||||
|
|
||||||
} else if (e.getSource() == closeAll) {
|
|
||||||
parent.closeAllImages();
|
|
||||||
|
|
||||||
} else if (e.getSource() == exit) {
|
|
||||||
parent.handleExit();
|
|
||||||
System.exit(0);
|
|
||||||
|
|
||||||
} else if (e.getSource() == romProperties) {
|
|
||||||
showMessageDialog(parent, new RomPropertyPanel(parent.getLastSelectedRom()),
|
showMessageDialog(parent, new RomPropertyPanel(parent.getLastSelectedRom()),
|
||||||
parent.getLastSelectedRom().getRomIDString() + " Properties", INFORMATION_MESSAGE);
|
parent.getLastSelectedRom().getRomIDString() + " Properties", INFORMATION_MESSAGE);
|
||||||
|
|
||||||
} else if (e.getSource() == refreshImage) {
|
|
||||||
try {
|
|
||||||
refreshImage();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showMessageDialog(parent, new DebugPanel(ex,
|
|
||||||
getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (e.getSource() == settings) {
|
} else if (e.getSource() == settings) {
|
||||||
SettingsForm form = new SettingsForm();
|
SettingsForm form = new SettingsForm();
|
||||||
form.setLocationRelativeTo(parent);
|
form.setLocationRelativeTo(parent);
|
||||||
|
@ -374,29 +352,6 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
form.setLocationRelativeTo(parent);
|
form.setLocationRelativeTo(parent);
|
||||||
form.setVisible(true);
|
form.setVisible(true);
|
||||||
|
|
||||||
} else if (e.getSource() == convertIncrease) {
|
|
||||||
try {
|
|
||||||
increaseRomSize();
|
|
||||||
refreshImage();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showMessageDialog(parent,
|
|
||||||
new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
} else if (e.getSource() == convertDecrease) {
|
|
||||||
try {
|
|
||||||
decreaseRomSize();
|
|
||||||
refreshImage();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
showMessageDialog(parent,
|
|
||||||
new DebugPanel(ex, getSettings().getSupportURL()), "Exception", ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// } else if (e.getSource() == defManager) {
|
|
||||||
// DefinitionManager form = new DefinitionManager();
|
|
||||||
// form.setLocationRelativeTo(parent);
|
|
||||||
// form.setVisible(true);
|
|
||||||
|
|
||||||
} else if (e.getSource() == level1) {
|
} else if (e.getSource() == level1) {
|
||||||
parent.setUserLevel(1);
|
parent.setUserLevel(1);
|
||||||
|
|
||||||
|
@ -431,40 +386,6 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void refreshImage() throws Exception {
|
|
||||||
ECUEditor parent = ECUEditorManager.getECUEditor();
|
|
||||||
if (parent.getLastSelectedRom() != null) {
|
|
||||||
File file = parent.getLastSelectedRom().getFullFileName();
|
|
||||||
parent.closeImage();
|
|
||||||
parent.openImage(file);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openImageDialog() throws Exception {
|
|
||||||
ECUEditor parent = ECUEditorManager.getECUEditor();
|
|
||||||
JFileChooser fc = new JFileChooser(SettingsManager.getSettings().getLastImageDir());
|
|
||||||
fc.setFileFilter(new ECUImageFilter());
|
|
||||||
fc.setDialogTitle("Open Image");
|
|
||||||
|
|
||||||
if (fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
|
|
||||||
parent.openImage(fc.getSelectedFile());
|
|
||||||
SettingsManager.getSettings().setLastImageDir(fc.getCurrentDirectory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void openImagesDialog() throws Exception {
|
|
||||||
ECUEditor parent = ECUEditorManager.getECUEditor();
|
|
||||||
JFileChooser fc = new JFileChooser(getSettings().getLastImageDir());
|
|
||||||
fc.setFileFilter(new ECUImageFilter());
|
|
||||||
fc.setMultiSelectionEnabled(true);
|
|
||||||
fc.setDialogTitle("Open Image(s)");
|
|
||||||
|
|
||||||
if(fc.showOpenDialog(parent) == JFileChooser.APPROVE_OPTION) {
|
|
||||||
parent.openImages(fc.getSelectedFiles());
|
|
||||||
SettingsManager.getSettings().setLastImageDir(fc.getCurrentDirectory());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void saveImage() throws Exception {
|
public void saveImage() throws Exception {
|
||||||
Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom();
|
Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom();
|
||||||
if (lastSelectedRom != null) {
|
if (lastSelectedRom != null) {
|
||||||
|
@ -503,7 +424,7 @@ public class ECUEditorMenuBar extends JMenuBar implements ActionListener {
|
||||||
} finally {
|
} finally {
|
||||||
fos.close();
|
fos.close();
|
||||||
}
|
}
|
||||||
parent.getLastSelectedRom().setFullFileName(selectedFile.getAbsoluteFile());
|
parent.getLastSelectedRom().setFullFileName(selectedFile.getAbsoluteFile().getName());
|
||||||
parent.setLastSelectedRom(parent.getLastSelectedRom());
|
parent.setLastSelectedRom(parent.getLastSelectedRom());
|
||||||
SettingsManager.getSettings().setLastImageDir(selectedFile.getParentFile());
|
SettingsManager.getSettings().setLastImageDir(selectedFile.getParentFile());
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,6 @@ import com.romraider.util.SettingsManager;
|
||||||
public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
|
|
||||||
private static final long serialVersionUID = 7778170684606193919L;
|
private static final long serialVersionUID = 7778170684606193919L;
|
||||||
private final JButton openImage = new JButton();
|
|
||||||
private final JButton saveImage = new JButton();
|
private final JButton saveImage = new JButton();
|
||||||
private final JButton refreshImage = new JButton();
|
private final JButton refreshImage = new JButton();
|
||||||
private final JButton closeImage = new JButton();
|
private final JButton closeImage = new JButton();
|
||||||
|
@ -56,13 +55,10 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
|
|
||||||
this.updateIcons();
|
this.updateIcons();
|
||||||
|
|
||||||
this.add(openImage);
|
|
||||||
this.add(saveImage);
|
this.add(saveImage);
|
||||||
this.add(closeImage);
|
this.add(closeImage);
|
||||||
this.add(refreshImage);
|
this.add(refreshImage);
|
||||||
|
|
||||||
openImage.setMaximumSize(new Dimension(58, 50));
|
|
||||||
openImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
|
||||||
saveImage.setMaximumSize(new Dimension(50, 50));
|
saveImage.setMaximumSize(new Dimension(50, 50));
|
||||||
saveImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
saveImage.setBorder(createLineBorder(new Color(150, 150, 150), 0));
|
||||||
closeImage.setMaximumSize(new Dimension(50, 50));
|
closeImage.setMaximumSize(new Dimension(50, 50));
|
||||||
|
@ -72,7 +68,6 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
|
|
||||||
this.updateButtons();
|
this.updateButtons();
|
||||||
|
|
||||||
openImage.addActionListener(this);
|
|
||||||
saveImage.addActionListener(this);
|
saveImage.addActionListener(this);
|
||||||
closeImage.addActionListener(this);
|
closeImage.addActionListener(this);
|
||||||
refreshImage.addActionListener(this);
|
refreshImage.addActionListener(this);
|
||||||
|
@ -80,7 +75,6 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
|
|
||||||
public void updateIcons() {
|
public void updateIcons() {
|
||||||
int iconScale = getSettings().getEditorIconScale();
|
int iconScale = getSettings().getEditorIconScale();
|
||||||
openImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/graphics/icon-open.png")), iconScale));
|
|
||||||
saveImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/graphics/icon-save.png")), iconScale));
|
saveImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/graphics/icon-save.png")), iconScale));
|
||||||
refreshImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/graphics/icon-refresh.png")), iconScale));
|
refreshImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/graphics/icon-refresh.png")), iconScale));
|
||||||
closeImage.setIcon(rescaleImageIcon(new ImageIcon( getClass().getResource("/graphics/icon-close.png")), iconScale));
|
closeImage.setIcon(rescaleImageIcon(new ImageIcon( getClass().getResource("/graphics/icon-close.png")), iconScale));
|
||||||
|
@ -101,7 +95,6 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
public void updateButtons() {
|
public void updateButtons() {
|
||||||
String file = getEditor().getLastSelectedRomFileName();
|
String file = getEditor().getLastSelectedRomFileName();
|
||||||
|
|
||||||
openImage.setToolTipText("Open Image");
|
|
||||||
saveImage.setToolTipText("Save " + file + " As New Image...");
|
saveImage.setToolTipText("Save " + file + " As New Image...");
|
||||||
refreshImage.setToolTipText("Refresh " + file + " from saved copy");
|
refreshImage.setToolTipText("Refresh " + file + " from saved copy");
|
||||||
closeImage.setToolTipText("Close " + file);
|
closeImage.setToolTipText("Close " + file);
|
||||||
|
@ -120,14 +113,7 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
if (e.getSource() == openImage) {
|
if (e.getSource() == saveImage) {
|
||||||
try {
|
|
||||||
((ECUEditorMenuBar) getEditor().getJMenuBar()).openImageDialog();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
JOptionPane.showMessageDialog(getEditor(), new DebugPanel(ex,
|
|
||||||
getSettings().getSupportURL()), "Exception", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
} else if (e.getSource() == saveImage) {
|
|
||||||
try {
|
try {
|
||||||
((ECUEditorMenuBar) getEditor().getJMenuBar()).saveImage();
|
((ECUEditorMenuBar) getEditor().getJMenuBar()).saveImage();
|
||||||
getEditor().refreshUI();
|
getEditor().refreshUI();
|
||||||
|
@ -138,12 +124,6 @@ public class ECUEditorToolBar extends JToolBar implements ActionListener {
|
||||||
} else if (e.getSource() == closeImage) {
|
} else if (e.getSource() == closeImage) {
|
||||||
getEditor().closeImage();
|
getEditor().closeImage();
|
||||||
} else if (e.getSource() == refreshImage) {
|
} else if (e.getSource() == refreshImage) {
|
||||||
try {
|
|
||||||
((ECUEditorMenuBar) getEditor().getJMenuBar()).refreshImage();
|
|
||||||
} catch (Exception ex) {
|
|
||||||
JOptionPane.showMessageDialog(getEditor(), new DebugPanel(ex,
|
|
||||||
getSettings().getSupportURL()), "Exception", JOptionPane.ERROR_MESSAGE);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
package com.rusefi;
|
package com.rusefi;
|
||||||
|
|
||||||
|
|
||||||
|
import com.romraider.ECUExec;
|
||||||
import com.romraider.Settings;
|
import com.romraider.Settings;
|
||||||
import com.romraider.editor.ecu.ECUEditor;
|
import com.romraider.editor.ecu.ECUEditor;
|
||||||
|
import com.romraider.editor.ecu.ECUEditorManager;
|
||||||
import com.romraider.swing.LookAndFeelManager;
|
import com.romraider.swing.LookAndFeelManager;
|
||||||
import com.romraider.util.LogManager;
|
import com.romraider.util.LogManager;
|
||||||
import com.romraider.util.SettingsManager;
|
import com.romraider.util.SettingsManager;
|
||||||
|
@ -19,10 +21,16 @@ public class RomRaiderWrapper {
|
||||||
private static final String DEFINITION_FILE = "..\\firmware\\integration\\rusefi.xml";
|
private static final String DEFINITION_FILE = "..\\firmware\\integration\\rusefi.xml";
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
Settings settings = SettingsManager.getSettings();
|
startRomRaider();
|
||||||
if (settings.getEcuDefinitionFiles().isEmpty())
|
|
||||||
settings.addEcuDefinitionFile(new File(DEFINITION_FILE));
|
|
||||||
|
|
||||||
|
ECUExec.openRom(ECUEditorManager.getECUEditor(), "rusefi_configuration.bin");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ECUEditor startRomRaider() {
|
||||||
|
Settings settings = SettingsManager.getSettings();
|
||||||
|
settings.getEcuDefinitionFiles().clear();
|
||||||
|
|
||||||
|
settings.addEcuDefinitionFile(new File(DEFINITION_FILE));
|
||||||
|
|
||||||
LogManager.initDebugLogging();
|
LogManager.initDebugLogging();
|
||||||
|
|
||||||
|
@ -30,6 +38,6 @@ public class RomRaiderWrapper {
|
||||||
|
|
||||||
ECUEditor editor = getECUEditor();
|
ECUEditor editor = getECUEditor();
|
||||||
editor.initializeEditorUI();
|
editor.initializeEditorUI();
|
||||||
|
return editor;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,11 @@ public class UploadChanges {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
showUi(port);
|
showUi(port);
|
||||||
} catch (SerialPortException | IOException | InterruptedException e) {
|
} catch (SerialPortException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,7 +103,13 @@ public class UploadChanges {
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
patch(ci1, ci2, bp, logger);
|
patch(ci1, ci2, bp, logger);
|
||||||
} catch (InterruptedException | EOFException | SerialPortException e) {
|
} catch (InterruptedException e) {
|
||||||
|
logger.error("Error: " + e);
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
} catch (EOFException e) {
|
||||||
|
logger.error("Error: " + e);
|
||||||
|
throw new IllegalStateException(e);
|
||||||
|
} catch (SerialPortException e) {
|
||||||
logger.error("Error: " + e);
|
logger.error("Error: " + e);
|
||||||
throw new IllegalStateException(e);
|
throw new IllegalStateException(e);
|
||||||
}
|
}
|
||||||
|
@ -121,5 +131,6 @@ public class UploadChanges {
|
||||||
offset = range.second;
|
offset = range.second;
|
||||||
}
|
}
|
||||||
bp.burn();
|
bp.burn();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package com.rusefi.binaryprotocol;
|
package com.rusefi.binaryprotocol;
|
||||||
|
|
||||||
|
import com.romraider.Settings;
|
||||||
|
import com.romraider.editor.ecu.ECUEditor;
|
||||||
|
import com.romraider.util.SettingsManager;
|
||||||
import com.rusefi.ConfigurationImage;
|
import com.rusefi.ConfigurationImage;
|
||||||
import com.rusefi.Logger;
|
import com.rusefi.Logger;
|
||||||
|
import com.rusefi.RomRaiderWrapper;
|
||||||
import com.rusefi.io.serial.PortHolder;
|
import com.rusefi.io.serial.PortHolder;
|
||||||
import jssc.SerialPort;
|
import jssc.SerialPort;
|
||||||
import jssc.SerialPortException;
|
import jssc.SerialPortException;
|
||||||
|
@ -14,7 +18,7 @@ import java.io.IOException;
|
||||||
*/
|
*/
|
||||||
public class BinaryProtocolCmd {
|
public class BinaryProtocolCmd {
|
||||||
|
|
||||||
public static void main(String[] args) throws SerialPortException, InterruptedException, IOException {
|
public static void main(String[] args) throws Exception {
|
||||||
if (args.length != 1) {
|
if (args.length != 1) {
|
||||||
System.out.println("Exactly one parameter expected");
|
System.out.println("Exactly one parameter expected");
|
||||||
return;
|
return;
|
||||||
|
@ -32,7 +36,6 @@ public class BinaryProtocolCmd {
|
||||||
}
|
}
|
||||||
BinaryProtocol bp = new BinaryProtocol(logger, serialPort);
|
BinaryProtocol bp = new BinaryProtocol(logger, serialPort);
|
||||||
|
|
||||||
|
|
||||||
PortHolder.setupPort(serialPort, 38400);
|
PortHolder.setupPort(serialPort, 38400);
|
||||||
logger.info("Looks good");
|
logger.info("Looks good");
|
||||||
bp.exchange(new byte[]{'S'});
|
bp.exchange(new byte[]{'S'});
|
||||||
|
@ -43,6 +46,11 @@ public class BinaryProtocolCmd {
|
||||||
|
|
||||||
image.saveToFile("rusefi_configuration.bin");
|
image.saveToFile("rusefi_configuration.bin");
|
||||||
|
|
||||||
|
RomRaiderWrapper.startRomRaider();
|
||||||
|
|
||||||
|
ECUEditor.openImage(image.getFileContent(), SettingsManager.getSettings().getEcuDefinitionFiles().elementAt(0),
|
||||||
|
"rusEfi");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue