Usability - simple VCP and
This commit is contained in:
parent
5c73e35474
commit
70d2558f04
|
@ -48,6 +48,7 @@ public class PortHolder {
|
|||
*/
|
||||
private boolean open(String port, final DataListener listener) {
|
||||
IoStream stream;
|
||||
// todo: BUG: Mac version 10 also 'is windows10 == true' at the moment :)
|
||||
boolean windows10 = isWindows10();
|
||||
FileLog.MAIN.logLine("Is windows10: " + windows10);
|
||||
if (windows10) {
|
||||
|
|
|
@ -46,7 +46,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20190630;
|
||||
public static final int CONSOLE_VERSION = 20190701;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
public static final String INPUT_FILES_PATH = "..";
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
|
|
|
@ -3,9 +3,9 @@ package com.rusefi;
|
|||
import com.rusefi.io.LinkManager;
|
||||
import com.rusefi.io.serial.PortHolder;
|
||||
import com.rusefi.io.tcp.TcpConnector;
|
||||
import com.rusefi.maintenance.DriverInstall;
|
||||
import com.rusefi.maintenance.EraseChip;
|
||||
import com.rusefi.maintenance.FirmwareFlasher;
|
||||
import com.rusefi.maintenance.ProcessStatusWindow;
|
||||
import com.rusefi.ui.util.HorizontalLine;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
@ -43,8 +43,6 @@ public class StartupFrame {
|
|||
private static final String LOGO = "logo.gif";
|
||||
public static final String LINK_TEXT = "rusEfi (c) 2012-2019";
|
||||
private static final String URI = "http://rusefi.com/?java_console";
|
||||
private static final String VCP_DRIVER_TEXT = "vcp driver";
|
||||
private static final String VCP_DRIVER_URI = "http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/driver/stsw-stm32102.zip";
|
||||
|
||||
private final JFrame frame;
|
||||
private final Timer scanPortsTimes = new Timer(1000, new ActionListener() {
|
||||
|
@ -122,10 +120,11 @@ public class StartupFrame {
|
|||
leftPanel.add(realHardwarePanel);
|
||||
leftPanel.add(miscPanel);
|
||||
|
||||
if (FileLog.isWindows())
|
||||
realHardwarePanel.add(DriverInstall.createButton());
|
||||
realHardwarePanel.add(connectPanel);
|
||||
realHardwarePanel.add(noPortsMessage);
|
||||
installMessage(noPortsMessage, "Check you cables. Check your drivers. Do you want to start simulator maybe?");
|
||||
realHardwarePanel.add(new URLLabel(VCP_DRIVER_TEXT, VCP_DRIVER_URI));
|
||||
|
||||
if (FileLog.isWindows()) {
|
||||
realHardwarePanel.add(new HorizontalLine());
|
||||
|
|
|
@ -0,0 +1,69 @@
|
|||
package com.rusefi.maintenance;
|
||||
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.ui.StatusConsumer;
|
||||
import com.rusefi.ui.StatusWindow;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This code automates drivers unpacking and installation
|
||||
* Both Virtual Comport and ST-Link drivers are installed
|
||||
* <p>
|
||||
* See https://github.com/rusefi/rusefi/tree/master/misc/install_st
|
||||
*/
|
||||
public class DriverInstall {
|
||||
private static final String FOLDER = "../drivers";
|
||||
private static final String ARCHIVE = "silent_st_drivers.exe";
|
||||
private static final String YES = " -y";
|
||||
private static final String UNPACKED_FOLDER = FOLDER + File.separator + "silent_st_drivers";
|
||||
private static final String WINDOWS7_BATCH = "silent_install_windows7.bat";
|
||||
private static final String WINDOWS8_BATCH = "silent_install_windows8.bat";
|
||||
|
||||
public static Component createButton() {
|
||||
JButton button = new JButton("Install Drivers");
|
||||
button.addActionListener(new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
int dialogResult = JOptionPane.showConfirmDialog(button, "Do you really want to install ST drivers?",
|
||||
"Please disconnect from vehicle", JOptionPane.YES_NO_OPTION);
|
||||
if (dialogResult != JOptionPane.YES_OPTION)
|
||||
return;
|
||||
|
||||
final StatusWindow wnd = new StatusWindow();
|
||||
wnd.showFrame("Windows rusEfi ST Drivers");
|
||||
|
||||
ExecHelper.submitAction(() -> installDrivers(wnd), getClass() + " thread");
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
return button;
|
||||
}
|
||||
|
||||
private static void installDrivers(StatusConsumer wnd) {
|
||||
FileLog.MAIN.logLine("IsWindows=" + FileLog.isWindows());
|
||||
if (!new File(FOLDER).exists()) {
|
||||
String message = FOLDER + " not found";
|
||||
wnd.appendMsg(message);
|
||||
FileLog.MAIN.logLine(message);
|
||||
return;
|
||||
}
|
||||
ExecHelper.executeCommand(FOLDER,
|
||||
FOLDER + File.separator + ARCHIVE + YES,
|
||||
ARCHIVE,
|
||||
wnd);
|
||||
|
||||
String batch = isWindows7orBelow() ? WINDOWS7_BATCH : WINDOWS8_BATCH;
|
||||
ExecHelper.executeCommand(UNPACKED_FOLDER, "cmd /c start " + batch, batch, wnd);
|
||||
}
|
||||
|
||||
private static boolean isWindows7orBelow() {
|
||||
String version = System.getProperty(FileLog.OS_VERSION);
|
||||
// https://en.wikipedia.org/wiki/List_of_Microsoft_Windows_versions
|
||||
return version.startsWith("5.") || version.startsWith("6.0") || version.startsWith("6.1");
|
||||
}
|
||||
}
|
|
@ -51,7 +51,6 @@ public class ExecHelper {
|
|||
return error;
|
||||
}
|
||||
|
||||
command = workingDirPath + File.separator + command;
|
||||
wnd.appendMsg("Executing " + command);
|
||||
StringBuffer output = new StringBuffer();
|
||||
try {
|
||||
|
|
|
@ -2,6 +2,8 @@ package com.rusefi.maintenance;
|
|||
|
||||
import com.rusefi.ui.StatusWindow;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* (c) Andrey Belomutskiy 2013-2018
|
||||
*/
|
||||
|
@ -9,6 +11,8 @@ public class ProcessStatusWindow {
|
|||
protected final StatusWindow wnd = new StatusWindow();
|
||||
|
||||
protected StringBuffer executeCommand(String command) {
|
||||
return ExecHelper.executeCommand(FirmwareFlasher.BINARY_LOCATION, command, FirmwareFlasher.OPENOCD_EXE, wnd);
|
||||
return ExecHelper.executeCommand(FirmwareFlasher.BINARY_LOCATION,
|
||||
FirmwareFlasher.BINARY_LOCATION + File.pathSeparator + command,
|
||||
FirmwareFlasher.OPENOCD_EXE, wnd);
|
||||
}
|
||||
}
|
|
@ -1,7 +1,6 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import com.rusefi.ui.util.FrameHelper;
|
||||
import com.rusefi.ui.util.URLLabel;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
@ -14,7 +13,6 @@ import java.awt.*;
|
|||
*/
|
||||
public class StatusWindow implements StatusConsumer {
|
||||
// todo: extract driver from console bundle? find a separate driver bundle?
|
||||
private static final String CONSOLE_DRIVER_URI = "http://www.st.com/st-web-ui/static/active/en/st_prod_software_internet/resource/technical/software/utility/stsw-link004.zip";
|
||||
private final JTextArea log = new JTextArea();
|
||||
private final JPanel content = new JPanel(new BorderLayout());
|
||||
private final JScrollPane messagesScroll = new JScrollPane(log, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED) {
|
||||
|
@ -28,8 +26,6 @@ public class StatusWindow implements StatusConsumer {
|
|||
|
||||
public StatusWindow() {
|
||||
log.setLineWrap(true);
|
||||
// todo: move this somewhere else. table editor use-case does not need stm32 driver
|
||||
content.add(new URLLabel("stm32 driver", CONSOLE_DRIVER_URI), BorderLayout.NORTH);
|
||||
content.add(messagesScroll, BorderLayout.CENTER);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,3 +26,4 @@ goto END
|
|||
:X64
|
||||
start "" dpinst_amd64.exe /sw
|
||||
:END
|
||||
exit
|
|
@ -26,3 +26,4 @@ goto END
|
|||
:X64
|
||||
start "" dpinst_amd64.exe /sw
|
||||
:END
|
||||
exit
|
Loading…
Reference in New Issue