auto-sync
This commit is contained in:
parent
e62a1573c9
commit
d34146a814
|
@ -121,11 +121,14 @@ void setBmwE34(DECLARE_ENGINE_PARAMETER_F) {
|
|||
engineConfiguration->clt.bias_resistor = 2200;
|
||||
|
||||
|
||||
/**
|
||||
* This saves a couple of ticks in trigger emulation methods
|
||||
* TODO: add some smart logic to detect unneeded trigger simulation pins?
|
||||
* TODO: but probably not worth it
|
||||
*/
|
||||
bc->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
|
||||
// /**
|
||||
// * This saves a couple of ticks in trigger emulation methods
|
||||
// * TODO: add some smart logic to detect unneeded trigger simulation pins?
|
||||
// * TODO: but probably not worth it
|
||||
// */
|
||||
// bc->triggerSimulatorPins[1] = GPIO_UNASSIGNED;
|
||||
|
||||
boardConfiguration->triggerSimulatorPins[0] = GPIOD_1;
|
||||
boardConfiguration->triggerSimulatorPins[1] = GPIOD_2;
|
||||
bc->triggerSimulatorPins[2] = GPIO_UNASSIGNED;
|
||||
}
|
||||
|
|
|
@ -294,8 +294,8 @@ static void printInfo(systime_t nowSeconds) {
|
|||
getConfigurationName(engineConfiguration->engineType),
|
||||
DELIMETER);
|
||||
#if EFI_PROD_CODE || defined(__DOXYGEN__)
|
||||
printOutPin(WC_CRANK1, boardConfiguration->triggerInputPins[0]);
|
||||
printOutPin(WC_CRANK2, boardConfiguration->triggerInputPins[1]);
|
||||
printOutPin(CRANK1, boardConfiguration->triggerInputPins[0]);
|
||||
printOutPin(CRANK2, boardConfiguration->triggerInputPins[1]);
|
||||
#if EFI_WAVE_ANALYZER || defined(__DOXYGEN__)
|
||||
printOutPin(WA_CHANNEL_1, boardConfiguration->logicAnalyzerPins[0]);
|
||||
printOutPin(WA_CHANNEL_2, boardConfiguration->logicAnalyzerPins[1]);
|
||||
|
|
|
@ -43,11 +43,11 @@ extern WaveChart waveChart;
|
|||
|
||||
extern engine_pins_s enginePins;
|
||||
|
||||
static const char *sparkNames[ENGINE_CHANNEL_COUNT] = { "spa1", "spa2", "spa3", "spa4", "spa5", "spa6", "spa7", "spa8",
|
||||
"spa9", "spa10", "spa11", "spa12"};
|
||||
static const char *sparkNames[ENGINE_CHANNEL_COUNT] = { "c1", "c2", "c3", "c4", "c5", "c6", "c7", "c8",
|
||||
"c9", "cA", "cB", "cD"};
|
||||
|
||||
static const char *injectorNames[ENGINE_CHANNEL_COUNT] = { "inj1", "inj2", "inj3", "inj4", "inj5", "inj6", "inj7", "inj8", "inj9",
|
||||
"inj10", "inj11", "inj12"};
|
||||
static const char *injectorNames[ENGINE_CHANNEL_COUNT] = { "i1", "i2", "i3", "i4", "i5", "i6", "i7", "i8",
|
||||
"j9", "iA", "iB", "iC"};
|
||||
|
||||
void initSignalExecutor(void) {
|
||||
initSignalExecutorImpl();
|
||||
|
|
|
@ -16,9 +16,12 @@
|
|||
|
||||
#define WC_DOWN "d"
|
||||
#define WC_UP "u"
|
||||
#define WC_CRANK1 "c1"
|
||||
#define WC_CRANK2 "c2"
|
||||
#define WC_CRANK3 "c3"
|
||||
/**
|
||||
* See also 'CRANK1' in java dev console code
|
||||
*/
|
||||
#define CRANK1 "t1"
|
||||
#define CRANK2 "t2"
|
||||
#define CRANK3 "t3"
|
||||
|
||||
#define NOISY_RPM -1
|
||||
#define UNREALISTIC_RPM 30000
|
||||
|
|
|
@ -113,22 +113,22 @@ static ALWAYS_INLINE void reportEventToWaveChart(trigger_event_e ckpSignalType,
|
|||
itoa10(&shaft_signal_msg_index[2], index);
|
||||
if (ckpSignalType == SHAFT_PRIMARY_UP) {
|
||||
shaft_signal_msg_index[0] = 'u';
|
||||
addWaveChartEvent(WC_CRANK1, (char* ) shaft_signal_msg_index);
|
||||
addWaveChartEvent(CRANK1, (char* ) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_PRIMARY_DOWN) {
|
||||
shaft_signal_msg_index[0] = 'd';
|
||||
addWaveChartEvent(WC_CRANK1, (char* ) shaft_signal_msg_index);
|
||||
addWaveChartEvent(CRANK1, (char* ) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_SECONDARY_UP) {
|
||||
shaft_signal_msg_index[0] = 'u';
|
||||
addWaveChartEvent(WC_CRANK2, (char* ) shaft_signal_msg_index);
|
||||
addWaveChartEvent(CRANK2, (char* ) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_SECONDARY_DOWN) {
|
||||
shaft_signal_msg_index[0] = 'd';
|
||||
addWaveChartEvent(WC_CRANK2, (char* ) shaft_signal_msg_index);
|
||||
addWaveChartEvent(CRANK2, (char* ) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_3RD_UP) {
|
||||
shaft_signal_msg_index[0] = 'u';
|
||||
addWaveChartEvent(WC_CRANK3, (char* ) shaft_signal_msg_index);
|
||||
addWaveChartEvent(CRANK3, (char* ) shaft_signal_msg_index);
|
||||
} else if (ckpSignalType == SHAFT_3RD_DOWN) {
|
||||
shaft_signal_msg_index[0] = 'd';
|
||||
addWaveChartEvent(WC_CRANK3, (char* ) shaft_signal_msg_index);
|
||||
addWaveChartEvent(CRANK3, (char* ) shaft_signal_msg_index);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ public class MessagesPane {
|
|||
public MessagesPane(final Node config) {
|
||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
|
||||
|
||||
final MessagesPanel messagesPanel = new MessagesPanel(config);
|
||||
final MessagesPanel messagesPanel = new MessagesPanel(config, true);
|
||||
messagesPanel.loadFont(config);
|
||||
content.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ public class MessagesPanel {
|
|||
private final JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 0));
|
||||
private final JScrollPane messagesScroll = new JScrollPane(messages, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
||||
public MessagesPanel(Node config) {
|
||||
public MessagesPanel(Node config, boolean listenToCommands) {
|
||||
JPanel middlePanel = new JPanel(new BorderLayout());
|
||||
middlePanel.add(messagesScroll, BorderLayout.CENTER);
|
||||
buttonPanel.setBorder(BorderFactory.createLineBorder(Color.red));
|
||||
|
@ -91,7 +91,7 @@ public class MessagesPanel {
|
|||
|
||||
buttonPanel.add(resetButton);
|
||||
buttonPanel.add(pauseButton);
|
||||
anyCommand = new AnyCommand(config);
|
||||
anyCommand = new AnyCommand(config, listenToCommands);
|
||||
buttonPanel.add(anyCommand.getContent());
|
||||
}
|
||||
|
||||
|
|
|
@ -42,12 +42,12 @@ public class RpmPanel {
|
|||
ConnectionWatchdog.start();
|
||||
|
||||
JPanel smallMessagePanel = new JPanel(new BorderLayout());
|
||||
MessagesPanel mp = new MessagesPanel(config);
|
||||
MessagesPanel mp = new MessagesPanel(config, false);
|
||||
smallMessagePanel.add(BorderLayout.NORTH, mp.getButtonPanel());
|
||||
smallMessagePanel.add(BorderLayout.CENTER, mp.getMessagesScroll());
|
||||
|
||||
JPanel msgPanel = new JPanel(new BorderLayout());
|
||||
msgPanel.add(new AnyCommand(config).getContent(), BorderLayout.NORTH);
|
||||
msgPanel.add(new AnyCommand(config, false).getContent(), BorderLayout.NORTH);
|
||||
msgPanel.add(smallMessagePanel, BorderLayout.CENTER);
|
||||
|
||||
JComponent rpmPanel = new JPanel(new BorderLayout());
|
||||
|
|
|
@ -37,8 +37,7 @@ import static com.rusefi.ui.util.LocalizedMessages.PAUSE;
|
|||
*/
|
||||
public class EngineSnifferPanel {
|
||||
private static final int EFI_DEFAULT_CHART_SIZE = 180;
|
||||
public static final String CRANK1 = "c1";
|
||||
public static final Comparator<String> INSTANCE = new ImageOrderComparator();
|
||||
public static final Comparator<String> INSTANCE = new NameUtil.ImageOrderComparator();
|
||||
private static final String HELP_URL = "http://rusefi.com/wiki/index.php?title=Manual:DevConsole#Digital_Chart";
|
||||
public static final String HELP_TEXT = "Click here for online help";
|
||||
public static final String SAVE_IMAGE = "save image";
|
||||
|
@ -66,7 +65,7 @@ public class EngineSnifferPanel {
|
|||
|
||||
private final ZoomControl zoomControl = new ZoomControl();
|
||||
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
||||
private final UpDownImage crank = createImage(CRANK1);
|
||||
private final UpDownImage crank = createImage(NameUtil.CRANK1);
|
||||
private ChartScrollControl scrollControl;
|
||||
|
||||
private boolean isPaused;
|
||||
|
@ -124,7 +123,7 @@ public class EngineSnifferPanel {
|
|||
buttonPanel.add(pauseButton);
|
||||
buttonPanel.add(new RpmLabel().setSize(2).getContent());
|
||||
|
||||
JComponent command = new AnyCommand(config, "chartsize " + EFI_DEFAULT_CHART_SIZE).getContent();
|
||||
JComponent command = new AnyCommand(config, "chartsize " + EFI_DEFAULT_CHART_SIZE, true).getContent();
|
||||
buttonPanel.add(command);
|
||||
|
||||
buttonPanel.add(zoomControl);
|
||||
|
@ -175,7 +174,7 @@ public class EngineSnifferPanel {
|
|||
private void resetImagePanel() {
|
||||
imagePanel.removeAll();
|
||||
imagePanel.add(crank);
|
||||
images.put(CRANK1, crank);
|
||||
images.put(NameUtil.CRANK1, crank);
|
||||
}
|
||||
|
||||
public void displayChart(String value) {
|
||||
|
@ -262,22 +261,4 @@ public class EngineSnifferPanel {
|
|||
displayChart(ChartRepository.getInstance().getChart(0));
|
||||
scrollControl.reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* The job of this comparator is to place Spark charts before Injection charts
|
||||
*/
|
||||
private static class ImageOrderComparator implements Comparator<String> {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return fixSpark(o1).compareTo(fixSpark(o2));
|
||||
}
|
||||
|
||||
String fixSpark(String s) {
|
||||
if (s.toLowerCase().startsWith("hip"))
|
||||
return "z" + s; // let's place this at the bottom
|
||||
if (s.toLowerCase().startsWith("spa"))
|
||||
return "d" + s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,52 @@
|
|||
package com.rusefi.ui.engine;
|
||||
|
||||
import com.rusefi.core.Sensor;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
public class NameUtil {
|
||||
/**
|
||||
* See also 'CRANK1' in rusEfi firmware code
|
||||
*/
|
||||
public static final String CRANK1 = "t1";
|
||||
protected static final Map<String, Sensor> name2sensor = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
static {
|
||||
name2sensor.put("inj1", Sensor.INJECTOR_1_DWELL);
|
||||
name2sensor.put("inj2", Sensor.INJECTOR_2_DWELL);
|
||||
name2sensor.put("inj3", Sensor.INJECTOR_3_DWELL);
|
||||
name2sensor.put("inj4", Sensor.INJECTOR_4_DWELL);
|
||||
}
|
||||
|
||||
static String getUiName(String name) {
|
||||
if (name.charAt(0) == 't')
|
||||
return "Trigger #" + name.substring(1);
|
||||
if (name.charAt(0) == 'c')
|
||||
return "Coil #" + name.substring(1);
|
||||
if (name.charAt(0) == 'i')
|
||||
return "Injector #" + name.substring(1);
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* The job of this comparator is to place Spark charts before Injection charts
|
||||
*/
|
||||
static class ImageOrderComparator implements Comparator<String> {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return fixNameForNicerOrder(o1).compareTo(fixNameForNicerOrder(o2));
|
||||
}
|
||||
|
||||
String fixNameForNicerOrder(String s) {
|
||||
if (s.toLowerCase().startsWith("t"))
|
||||
return "a" + s; // let's place this at the top
|
||||
if (s.toLowerCase().startsWith("hip"))
|
||||
return "z" + s; // let's place this at the bottom
|
||||
if (s.toLowerCase().startsWith("spa"))
|
||||
return "d" + s;
|
||||
return s;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -2,18 +2,20 @@ package com.rusefi.ui.engine;
|
|||
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.waves.TimeAxisTranslator;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import com.rusefi.waves.RevolutionLog;
|
||||
import com.rusefi.waves.TimeAxisTranslator;
|
||||
import com.rusefi.waves.WaveReport;
|
||||
import com.rusefi.waves.ZoomProvider;
|
||||
import com.rusefi.waves.RevolutionLog;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.TreeMap;
|
||||
|
||||
/**
|
||||
* This is a renderer of an individual {@link WaveReport} - this makes a simple Logical Analyzer
|
||||
|
@ -23,6 +25,7 @@ import java.util.TreeMap;
|
|||
* (c) Andrey Belomutskiy
|
||||
*
|
||||
* @see EngineSnifferPanel
|
||||
* @see WaveReport
|
||||
*/
|
||||
public class UpDownImage extends JPanel {
|
||||
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
|
||||
|
@ -38,15 +41,13 @@ public class UpDownImage extends JPanel {
|
|||
private TimeAxisTranslator translator;
|
||||
private RevolutionLog time2rpm = RevolutionLog.parseRevolutions(null);
|
||||
private String pin = "";
|
||||
|
||||
private static final Map<String, Sensor> name2sensor = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
|
||||
|
||||
static {
|
||||
name2sensor.put("inj1", Sensor.INJECTOR_1_DWELL);
|
||||
name2sensor.put("inj2", Sensor.INJECTOR_2_DWELL);
|
||||
name2sensor.put("inj3", Sensor.INJECTOR_3_DWELL);
|
||||
name2sensor.put("inj4", Sensor.INJECTOR_4_DWELL);
|
||||
}
|
||||
private long mouseEnterTime;
|
||||
private Timer repaintTimer = new Timer(1000, new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
UiUtils.trueRepaint(UpDownImage.this);
|
||||
}
|
||||
});
|
||||
|
||||
public UpDownImage(final String name) {
|
||||
this(WaveReport.MOCK, name);
|
||||
|
@ -54,7 +55,7 @@ public class UpDownImage extends JPanel {
|
|||
}
|
||||
|
||||
public void setToolTip() {
|
||||
UiUtils.setTwoLineToolTip(this, "Channel " + name, "Physical pin: " + pin);
|
||||
UiUtils.setTwoLineToolTip(this, "Channel " + NameUtil.getUiName(name), "Physical pin: " + pin);
|
||||
}
|
||||
|
||||
public void setZoomProvider(ZoomProvider zoomProvider) {
|
||||
|
@ -66,6 +67,14 @@ public class UpDownImage extends JPanel {
|
|||
setWaveReport(wr, null);
|
||||
setOpaque(true);
|
||||
translator = createTranslator();
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
mouseEnterTime = System.currentTimeMillis();
|
||||
UiUtils.trueRepaint(UpDownImage.this);
|
||||
repaintTimer.restart();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public UpDownImage setTranslator(TimeAxisTranslator translator) {
|
||||
|
@ -106,7 +115,7 @@ public class UpDownImage extends JPanel {
|
|||
}
|
||||
|
||||
private void propagateDwellIntoSensor(WaveReport wr) {
|
||||
Sensor sensor = name2sensor.get(name);
|
||||
Sensor sensor = NameUtil.name2sensor.get(name);
|
||||
if (sensor == null)
|
||||
return;
|
||||
|
||||
|
@ -134,7 +143,19 @@ public class UpDownImage extends JPanel {
|
|||
g2.setColor(Color.black);
|
||||
|
||||
int line = 0;
|
||||
g.drawString(name, 5, ++line * LINE_SIZE);
|
||||
boolean justEntered = System.currentTimeMillis() - mouseEnterTime < 1000;
|
||||
Font f = getFont();
|
||||
if (justEntered) {
|
||||
g.setFont(f.deriveFont(Font.BOLD, f.getSize() * 3));
|
||||
g.setColor(Color.red);
|
||||
}
|
||||
g.drawString(NameUtil.getUiName(name), 5, ++line * LINE_SIZE + (justEntered ? 30 : 0));
|
||||
if (justEntered) {
|
||||
// revert font & color
|
||||
g.setFont(f);
|
||||
g.setColor(Color.black);
|
||||
}
|
||||
|
||||
g.drawString("Tick length: " + duration + "; count=" + wr.getList().size(), 5, ++line * LINE_SIZE);
|
||||
g.drawString("Total seconds: " + (duration / WaveReport.SYS_TICKS_PER_MS / 000.0), 5, ++line * LINE_SIZE);
|
||||
g.drawString(FORMAT.format(new Date(lastUpdateTime)), 5, ++line * LINE_SIZE);
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package com.rusefi.ui.test;
|
||||
|
||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||
import com.rusefi.ui.engine.NameUtil;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.Set;
|
||||
|
@ -17,7 +18,7 @@ public class EngineSnifferPanelTest {
|
|||
@Test
|
||||
public void testInsertIndex() {
|
||||
Set<String> names = new TreeSet<>();
|
||||
names.add(EngineSnifferPanel.CRANK1);
|
||||
names.add(NameUtil.CRANK1);
|
||||
|
||||
String name;
|
||||
|
||||
|
@ -26,11 +27,11 @@ public class EngineSnifferPanelTest {
|
|||
names.add(name);
|
||||
|
||||
name = "inj1";
|
||||
assertEquals(1, EngineSnifferPanel.getInsertIndex(name, names));
|
||||
assertEquals(0, EngineSnifferPanel.getInsertIndex(name, names));
|
||||
names.add(name);
|
||||
|
||||
|
||||
assertEquals(1, EngineSnifferPanel.getInsertIndex("spa1", names));
|
||||
assertEquals(0, EngineSnifferPanel.getInsertIndex("spa1", names));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,17 +25,26 @@ public class AnyCommand {
|
|||
};
|
||||
|
||||
private JPanel content = new JPanel(new FlowLayout(FlowLayout.LEFT));
|
||||
private boolean reentrant;
|
||||
|
||||
public AnyCommand(final Node config) {
|
||||
this(config, config.getProperty(KEY, ""));
|
||||
public AnyCommand(final Node config, boolean listenToCommands) {
|
||||
this(config, config.getProperty(KEY, ""), listenToCommands);
|
||||
}
|
||||
|
||||
public AnyCommand(final Node config, String defaultCommand) {
|
||||
public AnyCommand(final Node config, String defaultCommand, final boolean listenToCommands) {
|
||||
text.setText(defaultCommand);
|
||||
content.setBorder(BorderFactory.createLineBorder(Color.PINK));
|
||||
content.add(new JLabel("Command: "));
|
||||
content.add(text);
|
||||
|
||||
CommandQueue.getInstance().addListener(new CommandQueue.CommandQueueListener() {
|
||||
@Override
|
||||
public void onCommand(String command) {
|
||||
if (listenToCommands && !reentrant)
|
||||
text.setText(command);
|
||||
}
|
||||
});
|
||||
|
||||
text.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
|
@ -43,7 +52,9 @@ public class AnyCommand {
|
|||
if (!isValidInput(text))
|
||||
return;
|
||||
int timeout = CommandQueue.getTimeout(cmd);
|
||||
reentrant = true;
|
||||
CommandQueue.getInstance().write(cmd.toLowerCase(), timeout);
|
||||
reentrant = false;
|
||||
}
|
||||
});
|
||||
text.getDocument().addDocumentListener(new DocumentListener() {
|
||||
|
|
Loading…
Reference in New Issue