fix #496
This commit is contained in:
parent
94078fe7b6
commit
4e8a1ff068
|
@ -45,7 +45,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20171106;
|
||||
public static final int CONSOLE_VERSION = 20171119;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.rusefi.io.tcp.TcpConnector;
|
|||
import com.rusefi.maintenance.EraseChip;
|
||||
import com.rusefi.maintenance.FirmwareFlasher;
|
||||
import com.rusefi.maintenance.ProcessStatusWindow;
|
||||
import com.rusefi.ui.OlderDiscoveryChecbbox;
|
||||
import com.rusefi.ui.util.HorizontalLine;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
@ -133,6 +134,7 @@ public class StartupFrame {
|
|||
|
||||
if (ProcessStatusWindow.isWindows()) {
|
||||
leftPanel.add(new HorizontalLine());
|
||||
leftPanel.add(new OlderDiscoveryChecbbox().getButton());
|
||||
leftPanel.add(new FirmwareFlasher(FirmwareFlasher.IMAGE_DEBUG_FILE, "Program Firmware/Debug").getButton());
|
||||
leftPanel.add(new HorizontalLine());
|
||||
leftPanel.add(new FirmwareFlasher(FirmwareFlasher.IMAGE_RELEASE_FILE, "Program Firmware/Release").getButton());
|
||||
|
|
|
@ -10,7 +10,7 @@ public class EraseChip extends ProcessStatusWindow {
|
|||
private final JButton button = new JButton("Erase Chip");
|
||||
|
||||
private static final String FLASH_SIZE = "0x0100000";
|
||||
private static final String OPEN_OCD_COMMAND = FirmwareFlasher.OPENOCD_CMD +
|
||||
private static final String OPEN_OCD_COMMAND = FirmwareFlasher.getOpenovdCommad() +
|
||||
" -c init -c targets -c \"halt\" -c \"flash erase_address 0x08000000 " + FLASH_SIZE + "\" -c shutdown";
|
||||
|
||||
public EraseChip() {
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.rusefi.maintenance;
|
||||
|
||||
import com.rusefi.ui.OlderDiscoveryChecbbox;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
@ -14,7 +16,6 @@ public class FirmwareFlasher extends ProcessStatusWindow {
|
|||
public static final String IMAGE_RELEASE_FILE = "rusefi_release.bin";
|
||||
static final String OPENOCD_EXE = "openocd/openocd.exe";
|
||||
static final String BINARY_LOCATION = ".";
|
||||
static final String OPENOCD_CMD = BINARY_LOCATION + File.separator + OPENOCD_EXE + " -f openocd/stm32f429disc1.cfg";
|
||||
private static final String SUCCESS_MESSAGE_TAG = "shutdown command invoked";
|
||||
private static final String FAILED_MESSAGE_TAG = "failed";
|
||||
private static final String NO_DRIVER_MESSAGE_TAG = "failed with LIBUSB_ERROR_NOT_SUPPORTED";
|
||||
|
@ -47,12 +48,17 @@ public class FirmwareFlasher extends ProcessStatusWindow {
|
|||
});
|
||||
}
|
||||
|
||||
public static String getOpenovdCommad() {
|
||||
String cfg = OlderDiscoveryChecbbox.olderMode ? "stm32f4discovery.cfg" : "stm32f429disc1.cfg";
|
||||
return BINARY_LOCATION + File.separator + OPENOCD_EXE + " -f openocd/" + cfg;
|
||||
}
|
||||
|
||||
private void doFlashFirmware() {
|
||||
if (!new File(fileName).exists()) {
|
||||
wnd.appendMsg(fileName + " not found, cannot proceed !!!");
|
||||
return;
|
||||
}
|
||||
StringBuffer error = executeCommand(OPENOCD_CMD + " -c \"program " +
|
||||
StringBuffer error = executeCommand(getOpenovdCommad() + " -c \"program " +
|
||||
fileName +
|
||||
" verify reset exit 0x08000000\"");
|
||||
if (error.toString().contains(NO_DRIVER_MESSAGE_TAG)) {
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
|
||||
/**
|
||||
* @author Andrey Belomutskiy *
|
||||
* 11/19/2017
|
||||
*/
|
||||
public class OlderDiscoveryChecbbox {
|
||||
public static boolean olderMode;
|
||||
private final JCheckBox checkBox = new JCheckBox("Older ST-link mode");
|
||||
private Component button;
|
||||
|
||||
public OlderDiscoveryChecbbox() {
|
||||
checkBox.addActionListener(e -> olderMode = checkBox.isSelected());
|
||||
}
|
||||
|
||||
public Component getButton() {
|
||||
return checkBox;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue