update firmware help button

This commit is contained in:
rusefi 2020-05-07 20:16:56 -04:00
parent cbd933edf6
commit 17f2ebe626
4 changed files with 18 additions and 9 deletions

View File

@ -44,7 +44,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
* @see EngineSnifferPanel
*/
public class Launcher {
public static final int CONSOLE_VERSION = 20200502;
public static final int CONSOLE_VERSION = 20200507;
public static final String INI_FILE_PATH = System.getProperty("ini_file_path", "..");
public static final String INPUT_FILES_PATH = System.getProperty("input_files_path", "..");
public static final String TOOLS_PATH = System.getProperty("tools_path", ".");

View File

@ -18,8 +18,6 @@ import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* @see FirmwareFlasher
@ -87,12 +85,8 @@ public class DfuFlasher {
// ugly temporary solution
// see https://github.com/rusefi/rusefi/issues/1170
// see https://github.com/rusefi/rusefi/issues/1182
try {
URLLabel.open(new URI(DFU_SETUP_EXE));
wnd.appendMsg("Please install DfuSe_Demo_V3.0.6_Setup.exe, power cycle your device and try again.");
} catch (URISyntaxException e) {
throw new IllegalStateException(e);
}
URLLabel.open(DFU_SETUP_EXE);
wnd.appendMsg("Please install DfuSe_Demo_V3.0.6_Setup.exe, power cycle your device and try again.");
} else {
wnd.appendMsg(stdout.length() + " / " + errorResponse.length());
}

View File

@ -1,11 +1,13 @@
package com.rusefi.maintenance;
import com.rusefi.ui.util.URLLabel;
import com.rusefi.ui.util.UiUtils;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.net.URI;
import java.util.Arrays;
import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
@ -16,6 +18,8 @@ public class ProgramSelector {
private static final String MANUAL_DFU = "Manual DFU";
private static final String ST_LINK = "ST-LINK";
private static final String HELP = "https://github.com/rusefi/rusefi/wiki/HOWTO_Update_Firmeware";
private final JPanel controls = new JPanel(new FlowLayout());
private final JComboBox mode = new JComboBox();
@ -36,6 +40,9 @@ public class ProgramSelector {
JButton updateFirmware = new JButton("Update Firmware",
UiUtils.loadIcon("/com/rusefi/upload48.jpg"));
controls.add(updateFirmware);
JButton updateHelp = new JButton("?");
updateHelp.addActionListener(e -> URLLabel.open(HELP));
controls.add(updateHelp);
updateFirmware.addActionListener(new ActionListener() {
@Override

View File

@ -33,6 +33,14 @@ public class URLLabel extends JLabel {
return oURI;
}
public static void open(String url) {
try {
open(new URI(url));
} catch (URISyntaxException e) {
throw new IllegalStateException(e);
}
}
public void setup(String t, final URI u) {
setCursor(new Cursor(Cursor.HAND_CURSOR));
text = t;