auto-sync
This commit is contained in:
parent
f0babba0d1
commit
bb93a390ba
|
@ -0,0 +1,57 @@
|
|||
package com.rusefi;
|
||||
|
||||
import com.rusefi.ui.FrameHelper;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* (c) Andrey Belomutskiy 2013-2015
|
||||
* 2/4/15
|
||||
*/
|
||||
public class FirmwareFlasher {
|
||||
private static final String OPEN_OCD_COMMAND = "openocd/bin/openocd-0.8.0.exe -f interface/stlink-v2.cfg -f board/stm32f4discovery.cfg -c init -c targets -c \"halt\" -c \"flash write_image erase rusefi.elf\" -c \"verify_image rusefi.elf\" -c \"reset run\" -c shutdown";
|
||||
|
||||
private final JButton button = new JButton("wip");
|
||||
private final JTextArea log = new JTextArea();
|
||||
|
||||
public FirmwareFlasher() {
|
||||
log.setLineWrap(true);
|
||||
|
||||
button.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent event) {
|
||||
FrameHelper f = new FrameHelper();
|
||||
|
||||
appendMsg("Executing " + OPEN_OCD_COMMAND);
|
||||
|
||||
f.showFrame(log, false);
|
||||
|
||||
try {
|
||||
Process p = Runtime.getRuntime().exec(OPEN_OCD_COMMAND);
|
||||
|
||||
|
||||
} catch (IOException e) {
|
||||
appendMsg("Error: " + e);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void appendMsg(String s) {
|
||||
log.append(s);
|
||||
}
|
||||
|
||||
public static boolean isWindows() {
|
||||
return System.getProperty("os.name").toLowerCase().contains("win");
|
||||
}
|
||||
|
||||
public static Component getContent() {
|
||||
return new FirmwareFlasher().button;
|
||||
}
|
||||
}
|
|
@ -3,7 +3,6 @@ package com.rusefi;
|
|||
import com.irnems.FileLog;
|
||||
import com.irnems.core.EngineState;
|
||||
import com.irnems.core.MessagesCentral;
|
||||
import com.rusefi.*;
|
||||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.ui.*;
|
||||
import com.rusefi.ui.storage.Node;
|
||||
|
@ -24,7 +23,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see WavePanel
|
||||
*/
|
||||
public class Launcher extends FrameHelper {
|
||||
public static final int CONSOLE_VERSION = 20150203;
|
||||
public static final int CONSOLE_VERSION = 20150204;
|
||||
public static final boolean SHOW_STIMULATOR = true;
|
||||
public static final String TAB_INDEX = "main_tab";
|
||||
private final String port;
|
||||
|
|
|
@ -83,10 +83,13 @@ public class StartupFrame {
|
|||
startupOptions.add(buttonLogViewer);
|
||||
startupOptions.add(new HorizontalLine());
|
||||
|
||||
JPanel centerPanel = new JPanel(new FlowLayout());
|
||||
centerPanel.add(SimulatorHelper.createSimulatorComponent(this));
|
||||
startupOptions.add(SimulatorHelper.createSimulatorComponent(this));
|
||||
|
||||
if (FirmwareFlasher.isWindows()) {
|
||||
startupOptions.add(new HorizontalLine());
|
||||
startupOptions.add(FirmwareFlasher.getContent());
|
||||
}
|
||||
|
||||
startupOptions.add(centerPanel);
|
||||
startupOptions.add(new HorizontalLine());
|
||||
startupOptions.add(new URLLabel(LINK_TEXT, URI));
|
||||
|
||||
|
|
|
@ -14,14 +14,23 @@ public class FrameHelper {
|
|||
protected final JFrame frame = new JFrame();
|
||||
public static int defaultFontSize;
|
||||
|
||||
protected void showFrame(JComponent component) {
|
||||
public JFrame getFrame() {
|
||||
return frame;
|
||||
}
|
||||
|
||||
public void showFrame(JComponent component) {
|
||||
showFrame(component, true);
|
||||
}
|
||||
|
||||
public void showFrame(JComponent component, final boolean maximizeOnStart) {
|
||||
frame.setSize(800, 500);
|
||||
frame.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
frame.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowOpened(WindowEvent e) {
|
||||
onWindowOpened();
|
||||
frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
|
||||
if (maximizeOnStart)
|
||||
frame.setExtendedState(frame.getExtendedState() | JFrame.MAXIMIZED_BOTH);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue