mirror of https://github.com/rusefi/rusefi-1.git
auto-sync
This commit is contained in:
parent
3aa0202d5a
commit
f1547b782f
|
@ -471,13 +471,19 @@ static void initStatisLeds() {
|
||||||
* This method would blink all the LEDs just to test them
|
* This method would blink all the LEDs just to test them
|
||||||
*/
|
*/
|
||||||
static void initialLedsBlink(void) {
|
static void initialLedsBlink(void) {
|
||||||
|
if (hasFirmwareError()) {
|
||||||
|
// make sure we do not turn the fatal LED off if already have
|
||||||
|
// fatal error by now
|
||||||
|
return;
|
||||||
|
}
|
||||||
int size = sizeof(leds) / sizeof(leds[0]);
|
int size = sizeof(leds) / sizeof(leds[0]);
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size && !hasFirmwareError(); i++)
|
||||||
leds[i]->setValue(1);
|
leds[i]->setValue(1);
|
||||||
|
|
||||||
chThdSleepMilliseconds(100);
|
chThdSleepMilliseconds(100);
|
||||||
|
|
||||||
for (int i = 0; i < size; i++)
|
// re-checking in case the error has happened while we were sleeping
|
||||||
|
for (int i = 0; i < size && !hasFirmwareError(); i++)
|
||||||
leds[i]->setValue(0);
|
leds[i]->setValue(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,5 +292,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 20160409;
|
return 20160411;
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,12 +36,15 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
||||||
* @see EngineSnifferPanel
|
* @see EngineSnifferPanel
|
||||||
*/
|
*/
|
||||||
public class Launcher {
|
public class Launcher {
|
||||||
public static final int CONSOLE_VERSION = 20160402;
|
public static final int CONSOLE_VERSION = 20160411;
|
||||||
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";
|
||||||
protected static final String SPEED_KEY = "speed";
|
protected static final String SPEED_KEY = "speed";
|
||||||
|
public static final String FATAL_ERROR_PREFIX = "FATAL";
|
||||||
private final String port;
|
private final String port;
|
||||||
|
// todo: the logic around 'fatalError' could be implemented nicer
|
||||||
|
private String fatalError;
|
||||||
private final JTabbedPane tabbedPane = new JTabbedPane() {
|
private final JTabbedPane tabbedPane = new JTabbedPane() {
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
|
@ -64,6 +67,10 @@ public class Launcher {
|
||||||
default:
|
default:
|
||||||
text = "";
|
text = "";
|
||||||
}
|
}
|
||||||
|
if (fatalError != null) {
|
||||||
|
text = fatalError;
|
||||||
|
g.setColor(Color.red);
|
||||||
|
}
|
||||||
int labelWidth = g.getFontMetrics().stringWidth(text);
|
int labelWidth = g.getFontMetrics().stringWidth(text);
|
||||||
g.drawString(text, (d.width - labelWidth) / 2, d.height / 2);
|
g.drawString(text, (d.width - labelWidth) / 2, d.height / 2);
|
||||||
}
|
}
|
||||||
|
@ -106,6 +113,14 @@ public class Launcher {
|
||||||
|
|
||||||
LinkManager.start(port);
|
LinkManager.start(port);
|
||||||
|
|
||||||
|
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
|
||||||
|
@Override
|
||||||
|
public void onMessage(Class clazz, String message) {
|
||||||
|
if (message.startsWith(FATAL_ERROR_PREFIX))
|
||||||
|
fatalError = message;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
EngineSnifferPanel engineSnifferPanel = new EngineSnifferPanel(getConfig().getRoot().getChild("digital_sniffer"));
|
EngineSnifferPanel engineSnifferPanel = new EngineSnifferPanel(getConfig().getRoot().getChild("digital_sniffer"));
|
||||||
if (LinkManager.isLogViewerMode(port))
|
if (LinkManager.isLogViewerMode(port))
|
||||||
tabbedPane.add("Log Viewer", new LogViewer(engineSnifferPanel));
|
tabbedPane.add("Log Viewer", new LogViewer(engineSnifferPanel));
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package com.rusefi.ui;
|
package com.rusefi.ui;
|
||||||
|
|
||||||
|
import com.rusefi.Launcher;
|
||||||
import com.rusefi.core.MessagesCentral;
|
import com.rusefi.core.MessagesCentral;
|
||||||
|
import com.rusefi.ui.util.UiUtils;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -15,6 +17,13 @@ public class WarningPanel {
|
||||||
|
|
||||||
private final JLabel label = new JLabel();
|
private final JLabel label = new JLabel();
|
||||||
private final JButton reset = new JButton("clear warning");
|
private final JButton reset = new JButton("clear warning");
|
||||||
|
private final Timer fatalBlinking = new Timer(1000, new ActionListener() {
|
||||||
|
@Override
|
||||||
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
label.setVisible(!label.isVisible());
|
||||||
|
UiUtils.trueRepaint(label);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
public WarningPanel() {
|
public WarningPanel() {
|
||||||
label.setForeground(Color.red);
|
label.setForeground(Color.red);
|
||||||
|
@ -33,8 +42,19 @@ public class WarningPanel {
|
||||||
});
|
});
|
||||||
|
|
||||||
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
|
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
|
||||||
|
boolean haveFatalError;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMessage(Class clazz, String message) {
|
public void onMessage(Class clazz, String message) {
|
||||||
|
if (haveFatalError)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (message.startsWith(Launcher.FATAL_ERROR_PREFIX)) {
|
||||||
|
haveFatalError = true;
|
||||||
|
fatalBlinking.start();
|
||||||
|
label.setText(message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (message.startsWith(WARNING) || message.startsWith(ERROR)) {
|
if (message.startsWith(WARNING) || message.startsWith(ERROR)) {
|
||||||
label.setText(message);
|
label.setText(message);
|
||||||
reset.setEnabled(true);
|
reset.setEnabled(true);
|
||||||
|
|
Loading…
Reference in New Issue