auto-sync

This commit is contained in:
rusEfi 2016-01-09 14:02:30 -05:00
parent 3290377410
commit 1a3c04dab1
6 changed files with 18 additions and 4 deletions

View File

@ -37,6 +37,8 @@ import com.romraider.maps.Rom;
import com.romraider.util.SettingsManager;
import com.rusefi.ConfigurationImage;
import com.rusefi.binaryprotocol.BinaryProtocolCmd;
import com.rusefi.io.CommandQueue;
import com.rusefi.ui.SettingsTab;
public class ECUEditorToolBar extends JToolBar {
@ -44,6 +46,7 @@ public class ECUEditorToolBar extends JToolBar {
// private final JButton saveImage = new JButton();
private final JButton uploadImage = new JButton();
private final JButton downloadImage = new JButton();
private final JButton burnImage = new JButton();
public ECUEditorToolBar(String name) {
super(name);
@ -58,8 +61,9 @@ public class ECUEditorToolBar extends JToolBar {
// this.add(saveImage);
this.add(downloadImage);
this.add(uploadImage);
this.add(burnImage);
uploadImage.setToolTipText("Burn changes into controller");
uploadImage.setToolTipText("Send changes to controller");
downloadImage.setToolTipText("Read configuration from controller");
@ -81,7 +85,7 @@ public class ECUEditorToolBar extends JToolBar {
public void actionPerformed(ActionEvent e) {
Rom lastSelectedRom = ECUEditorManager.getECUEditor().getLastSelectedRom();
byte[] newVersion = ConfigurationImage.extractContent(lastSelectedRom.saveFile());
System.out.println(newVersion.length);
System.out.println("new version size: " + newVersion.length);
BinaryProtocolCmd.scheduleBurn(new ConfigurationImage(newVersion));
}
});
@ -91,6 +95,12 @@ public class ECUEditorToolBar extends JToolBar {
}
});
burnImage.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
CommandQueue.getInstance().write(SettingsTab.WRITECONFIG);
}
});
}
public void updateIcons() {
@ -98,6 +108,7 @@ public class ECUEditorToolBar extends JToolBar {
// saveImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/graphics/icon-save.png")), iconScale));
uploadImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/com/rusefi/upload48.jpg")), iconScale));
downloadImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/com/rusefi/download48.jpg")), iconScale));
burnImage.setIcon(rescaleImageIcon(new ImageIcon(getClass().getResource("/com/rusefi/writeconfig48.jpg")), iconScale));
// closeImage.setIcon(rescaleImageIcon(new ImageIcon( getClass().getResource("/graphics/icon-close.png")), iconScale));
repaint();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@ -63,6 +63,7 @@ public class RecentCommands {
COMMAND_ICONS.put(SDINFO, infoIcon);
COMMAND_ICONS.put(FSIOINFO, infoIcon);
COMMAND_ICONS.put(PINS, infoIcon);
COMMAND_ICONS.put(SettingsTab.WRITECONFIG, UiUtils.loadIcon("writeconfig.jpg"));
}
private final JPanel content = new JPanel(new GridLayout(NUMBER_OF_COMMANDS + 1, 1));
@ -109,7 +110,7 @@ public class RecentCommands {
add(ANALOGINFO);
add(TRIGGERINFO);
add(TSINFO);
add("writeconfig");
add(SettingsTab.WRITECONFIG);
add("rewriteconfig");
add("enable injection");
add("disable injection");

View File

@ -11,6 +11,7 @@ import java.awt.*;
import java.util.concurrent.atomic.AtomicBoolean;
public class SettingsTab {
public static final String WRITECONFIG = "writeconfig";
private final JPanel panel = new JPanel(new GridLayout(8, 3));
private final JPanel content = new JPanel(new BorderLayout());
@ -71,7 +72,7 @@ public class SettingsTab {
// panel.add(UiUtils.wrap(new ConfigField(Fields.TPSACCELENRICHMENTTHRESHOLD, "TPS accel threshold").getContent()));
panel.add(UiUtils.wrap(new ConfigField(Fields.TPSACCELENRICHMENTMULTIPLIER, "TPS accel coef").getContent()));
panel.add(UiUtils.wrap(RecentCommands.createButton(new AtomicBoolean(), "writeconfig")));
panel.add(UiUtils.wrap(RecentCommands.createButton(new AtomicBoolean(), WRITECONFIG)));
content.add(panel);
UiUtils.trueLayout(content);

View File

@ -27,6 +27,7 @@ public class StatusWindow {
log.setLineWrap(true);
}
// todo: make this method more abstract. table editor use-case does not need stm32 driver
public void showFrame(String title) {
content.add(new URLLabel("stm32 driver", CONSOLE_DRIVER_URI), BorderLayout.NORTH);
content.add(messagesScroll, BorderLayout.CENTER);