mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
38aee25110
commit
72227026c9
|
@ -799,6 +799,8 @@ static void setSpiMode(int index, bool mode) {
|
||||||
static void enableOrDisable(const char *param, bool isEnabled) {
|
static void enableOrDisable(const char *param, bool isEnabled) {
|
||||||
if (strEqualCaseInsensitive(param, "fastadc")) {
|
if (strEqualCaseInsensitive(param, "fastadc")) {
|
||||||
boardConfiguration->isFastAdcEnabled = isEnabled;
|
boardConfiguration->isFastAdcEnabled = isEnabled;
|
||||||
|
} else if (strEqualCaseInsensitive(param, "serial")) {
|
||||||
|
boardConfiguration->useSerialPort = isEnabled;
|
||||||
} else if (strEqualCaseInsensitive(param, "stepperidle")) {
|
} else if (strEqualCaseInsensitive(param, "stepperidle")) {
|
||||||
boardConfiguration->useStepperIdle = isEnabled;
|
boardConfiguration->useStepperIdle = isEnabled;
|
||||||
} else if (strEqualCaseInsensitive(param, "trigger_only_front")) {
|
} else if (strEqualCaseInsensitive(param, "trigger_only_front")) {
|
||||||
|
|
|
@ -290,5 +290,5 @@ int getRusEfiVersion(void) {
|
||||||
return 123; // this is here to make the compiler happy about the unused array
|
return 123; // this is here to make the compiler happy about the unused array
|
||||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||||
return 3211; // this is here to make the compiler happy about the unused array
|
return 3211; // this is here to make the compiler happy about the unused array
|
||||||
return 20150503;
|
return 20150504;
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import com.rusefi.ui.logview.LogViewer;
|
||||||
import com.rusefi.ui.storage.Node;
|
import com.rusefi.ui.storage.Node;
|
||||||
import com.rusefi.ui.util.DefaultExceptionHandler;
|
import com.rusefi.ui.util.DefaultExceptionHandler;
|
||||||
import com.rusefi.ui.util.FrameHelper;
|
import com.rusefi.ui.util.FrameHelper;
|
||||||
|
import com.rusefi.ui.util.JustOneInstance;
|
||||||
import jssc.SerialPortList;
|
import jssc.SerialPortList;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
|
@ -31,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see com.rusefi.StartupFrame
|
* @see com.rusefi.StartupFrame
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20150503;
|
public static final int CONSOLE_VERSION = 20150504;
|
||||||
public static final boolean SHOW_STIMULATOR = false;
|
public static final boolean SHOW_STIMULATOR = false;
|
||||||
private static final String TAB_INDEX = "main_tab";
|
private static final String TAB_INDEX = "main_tab";
|
||||||
protected static final String PORT_KEY = "port";
|
protected static final String PORT_KEY = "port";
|
||||||
|
@ -174,8 +175,14 @@ public class Launcher {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void awtCode(String[] args) {
|
private static void awtCode(String[] args) {
|
||||||
|
if (JustOneInstance.isAlreadyRunning()) {
|
||||||
|
int result = JOptionPane.showConfirmDialog(null, "Looks like another instance is already running. Do you really want to start another instance?",
|
||||||
|
"rusEfi", JOptionPane.YES_NO_OPTION);
|
||||||
|
if (result == JOptionPane.NO_OPTION)
|
||||||
|
System.exit(-1);
|
||||||
|
}
|
||||||
|
JustOneInstance.onStart();
|
||||||
try {
|
try {
|
||||||
|
|
||||||
boolean isPortDefined = args.length > 0;
|
boolean isPortDefined = args.length > 0;
|
||||||
if (isPortDefined) {
|
if (isPortDefined) {
|
||||||
new Launcher(args[0]);
|
new Launcher(args[0]);
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package com.rusefi.ui.util;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.ServerSocket;
|
||||||
|
import java.net.Socket;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* (c) Andrey Belomutskiy
|
||||||
|
* 5/4/2015
|
||||||
|
*/
|
||||||
|
public class JustOneInstance {
|
||||||
|
private static final int PORT = 29212;
|
||||||
|
|
||||||
|
public static boolean isAlreadyRunning() {
|
||||||
|
try {
|
||||||
|
Socket clientSocket = new Socket("localhost", PORT);
|
||||||
|
System.out.println("*** Already running!");
|
||||||
|
return true;
|
||||||
|
} catch (IOException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onStart() {
|
||||||
|
Runnable runnable = new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
ServerSocket serverSocket;
|
||||||
|
try {
|
||||||
|
serverSocket = new ServerSocket(PORT, 1);
|
||||||
|
|
||||||
|
while (true) {
|
||||||
|
// Wait for a connection
|
||||||
|
Socket clientSocket = serverSocket.accept();
|
||||||
|
// System.out.println("*** Got a connection! ");
|
||||||
|
clientSocket.close();
|
||||||
|
}
|
||||||
|
} catch (IOException e) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
new Thread(runnable).start();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue