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
|
||||
*/
|
||||
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]);
|
||||
for (int i = 0; i < size; i++)
|
||||
for (int i = 0; i < size && !hasFirmwareError(); i++)
|
||||
leds[i]->setValue(1);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
@ -292,5 +292,5 @@ int getRusEfiVersion(void) {
|
|||
return 123; // this is here to make the compiler happy about the unused array
|
||||
if (UNUSED_CCM_SIZE[0] * 0 != 0)
|
||||
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
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20160402;
|
||||
public static final int CONSOLE_VERSION = 20160411;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
protected static final String SPEED_KEY = "speed";
|
||||
public static final String FATAL_ERROR_PREFIX = "FATAL";
|
||||
private final String port;
|
||||
// todo: the logic around 'fatalError' could be implemented nicer
|
||||
private String fatalError;
|
||||
private final JTabbedPane tabbedPane = new JTabbedPane() {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
|
@ -64,6 +67,10 @@ public class Launcher {
|
|||
default:
|
||||
text = "";
|
||||
}
|
||||
if (fatalError != null) {
|
||||
text = fatalError;
|
||||
g.setColor(Color.red);
|
||||
}
|
||||
int labelWidth = g.getFontMetrics().stringWidth(text);
|
||||
g.drawString(text, (d.width - labelWidth) / 2, d.height / 2);
|
||||
}
|
||||
|
@ -106,6 +113,14 @@ public class Launcher {
|
|||
|
||||
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"));
|
||||
if (LinkManager.isLogViewerMode(port))
|
||||
tabbedPane.add("Log Viewer", new LogViewer(engineSnifferPanel));
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
package com.rusefi.ui;
|
||||
|
||||
import com.rusefi.Launcher;
|
||||
import com.rusefi.core.MessagesCentral;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
@ -15,6 +17,13 @@ public class WarningPanel {
|
|||
|
||||
private final JLabel label = new JLabel();
|
||||
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() {
|
||||
label.setForeground(Color.red);
|
||||
|
@ -33,8 +42,19 @@ public class WarningPanel {
|
|||
});
|
||||
|
||||
MessagesCentral.getInstance().addListener(new MessagesCentral.MessageListener() {
|
||||
boolean haveFatalError;
|
||||
|
||||
@Override
|
||||
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)) {
|
||||
label.setText(message);
|
||||
reset.setEnabled(true);
|
||||
|
|
Loading…
Reference in New Issue