auto-sync
This commit is contained in:
parent
8de46e97bd
commit
b7f167fde8
|
@ -4,6 +4,7 @@ import com.rusefi.FileLog;
|
||||||
import com.rusefi.core.EngineState;
|
import com.rusefi.core.EngineState;
|
||||||
import com.rusefi.models.Point3D;
|
import com.rusefi.models.Point3D;
|
||||||
import com.rusefi.models.XYData;
|
import com.rusefi.models.XYData;
|
||||||
|
import com.rusefi.waves.EngineReport;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -50,7 +51,7 @@ public class BaseMap {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
EngineState engineState = new EngineState(listener);
|
EngineState engineState = new EngineState(listener);
|
||||||
engineState.registerStringValueAction("wave_chart", new EngineState.ValueCallback<String>() {
|
engineState.registerStringValueAction(EngineReport.ENGINE_CHART, new EngineState.ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(String value) {
|
public void onUpdate(String value) {
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,8 @@ public class Launcher {
|
||||||
private final String port;
|
private final String port;
|
||||||
// todo: the logic around 'fatalError' could be implemented nicer
|
// todo: the logic around 'fatalError' could be implemented nicer
|
||||||
private String fatalError;
|
private String fatalError;
|
||||||
|
public static EngineSnifferPanel engineSnifferPanel;
|
||||||
|
|
||||||
private final JTabbedPane tabbedPane = new JTabbedPane() {
|
private final JTabbedPane tabbedPane = new JTabbedPane() {
|
||||||
@Override
|
@Override
|
||||||
public void paint(Graphics g) {
|
public void paint(Graphics g) {
|
||||||
|
@ -122,7 +124,10 @@ public class Launcher {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
EngineSnifferPanel engineSnifferPanel = new EngineSnifferPanel(getConfig().getRoot().getChild("digital_sniffer"));
|
engineSnifferPanel = new EngineSnifferPanel(getConfig().getRoot().getChild("digital_sniffer"));
|
||||||
|
if (!LinkManager.isLogViewerMode(port))
|
||||||
|
engineSnifferPanel.setOutpinListener(LinkManager.engineState);
|
||||||
|
|
||||||
if (LinkManager.isLogViewerMode(port))
|
if (LinkManager.isLogViewerMode(port))
|
||||||
tabbedPane.add("Log Viewer", new LogViewer(engineSnifferPanel));
|
tabbedPane.add("Log Viewer", new LogViewer(engineSnifferPanel));
|
||||||
|
|
||||||
|
|
|
@ -102,11 +102,11 @@ public class TriggerImage {
|
||||||
|
|
||||||
triggerPanel.removeAll();
|
triggerPanel.removeAll();
|
||||||
UpDownImage upDownImage0 = new UpDownImage(re0, "trigger");
|
UpDownImage upDownImage0 = new UpDownImage(re0, "trigger");
|
||||||
upDownImage0.showText = false;
|
upDownImage0.showMouseOverText = false;
|
||||||
triggerPanel.add(upDownImage0);
|
triggerPanel.add(upDownImage0);
|
||||||
|
|
||||||
UpDownImage upDownImage1 = new UpDownImage(re1, "trigger");
|
UpDownImage upDownImage1 = new UpDownImage(re1, "trigger");
|
||||||
upDownImage1.showText = false;
|
upDownImage1.showMouseOverText = false;
|
||||||
boolean isSingleSenssor = re1.getList().isEmpty();
|
boolean isSingleSenssor = re1.getList().isEmpty();
|
||||||
|
|
||||||
triggerPanel.setLayout(new GridLayout(isSingleSenssor ? 1 : 2, 1));
|
triggerPanel.setLayout(new GridLayout(isSingleSenssor ? 1 : 2, 1));
|
||||||
|
|
|
@ -70,23 +70,12 @@ public class EngineSnifferPanel {
|
||||||
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
||||||
private final UpDownImage crank = createImage(NameUtil.CRANK1);
|
private final UpDownImage crank = createImage(NameUtil.CRANK1);
|
||||||
private final ChartScrollControl scrollControl;
|
private final ChartScrollControl scrollControl;
|
||||||
|
// todo: move it some sort of a singleton?
|
||||||
|
public final HashMap<String, String> channelName2PhysicalPin = new HashMap<>();
|
||||||
|
|
||||||
private boolean isPaused;
|
private boolean isPaused;
|
||||||
|
|
||||||
public EngineSnifferPanel(Node config) {
|
public EngineSnifferPanel(Node config) {
|
||||||
LinkManager.engineState.registerStringValueAction(EngineState.OUTPIN_TAG, new EngineState.ValueCallback<String>() {
|
|
||||||
@Override
|
|
||||||
public void onUpdate(String value) {
|
|
||||||
String pinInfo[] = value.split("@");
|
|
||||||
if (pinInfo.length != 2)
|
|
||||||
return;
|
|
||||||
String channel = pinInfo[0];
|
|
||||||
String pin = pinInfo[1];
|
|
||||||
UpDownImage image = images.get(channel);
|
|
||||||
if (image != null)
|
|
||||||
image.setPhysicalPin(pin);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
statusPanel.setTimeAxisTranslator(crank.createTranslator());
|
statusPanel.setTimeAxisTranslator(crank.createTranslator());
|
||||||
|
@ -192,6 +181,23 @@ public class EngineSnifferPanel {
|
||||||
// displayChart("wave_chart,crank2!down!192811978!crank2!up!192813389!crank2!down!192813749!crank2!up!192815156!crank2!down!192815512!crank!up!192820764!crank2!up!192825818!crank2!down!192826182!crank2!up!192827610!crank2!down!192827975!crank2!up!192829399!crank2!down!192829757!crank2!up!192831154!crank2!down!192831507!r!187!192834224!crank!down!192834224!crank2!up!192836757!crank2!down!192841994!crank2!up!192843561!crank2!down!192843925!crank2!up!192845334!crank2!down!192845693!crank2!up!192847086!crank2!down!192847439!crank!up!192853135!crank2!up!192857701!crank2!down!192858065!crank2!up!192859491!crank2!down!192859858!crank2!up!192861269!crank2!down!192861626!crank2!up!192863025!crank2!down!192863382!crank2!up!192868647!crank!down!192871268!crank2!down!192872804!crank2!up!192872804!crank!down!192872804!crank!up!192872804!crank2!down!192873898!crank2!up!192875508!crank2!down!192875887!crank2!up!192877357!crank2!down!192877732!crank2!up!192879192!crank2!down!192879565!crank!up!192886293!r!0!194982088!crank!down!194982088!crank2!up!194984699!crank2!down!194990112!crank2!up!194991715!crank2!down!194992085!crank2!up!194993530!crank2!down!194993884!crank2!up!194995292!crank2!down!194995645!crank!up!195001475!crank2!up!195006153!crank2!down!195006515!crank2!up!195007968!crank2!down!195008325!crank2!up!195009773!crank2!down!195010134!crank2!up!195011549!crank2!down!195011901!crank2!up!195017256!crank!down!195019915!crank2!down!195022597!crank2!up!195024189!crank2!down!195024554!crank2!up!195025980!crank2!down!195026329!crank2!up!195027744!crank2!down!195028103!crank!up!195033418!crank2!up!195038542!crank2!down!195038911!crank2!up!195040351!crank2!down!195040722!crank2!up!195042167!crank2!down!195042529!crank2!up!195043934!crank2!down!195044294!r!187!195047060!crank!down!195047060!crank2!up!195049619!crank2!down!195054954!crank2!up!195056549!crank2!down!195056920!crank2!up!195058345!crank2!down!195058703!crank2!up!195060114!crank2!down!195060464!crank!up!195066245!crank2!up!195070882!crank2!down!195071250!crank2!up!195072689!crank2!down!195073054!crank2!up!195074479!,");
|
// displayChart("wave_chart,crank2!down!192811978!crank2!up!192813389!crank2!down!192813749!crank2!up!192815156!crank2!down!192815512!crank!up!192820764!crank2!up!192825818!crank2!down!192826182!crank2!up!192827610!crank2!down!192827975!crank2!up!192829399!crank2!down!192829757!crank2!up!192831154!crank2!down!192831507!r!187!192834224!crank!down!192834224!crank2!up!192836757!crank2!down!192841994!crank2!up!192843561!crank2!down!192843925!crank2!up!192845334!crank2!down!192845693!crank2!up!192847086!crank2!down!192847439!crank!up!192853135!crank2!up!192857701!crank2!down!192858065!crank2!up!192859491!crank2!down!192859858!crank2!up!192861269!crank2!down!192861626!crank2!up!192863025!crank2!down!192863382!crank2!up!192868647!crank!down!192871268!crank2!down!192872804!crank2!up!192872804!crank!down!192872804!crank!up!192872804!crank2!down!192873898!crank2!up!192875508!crank2!down!192875887!crank2!up!192877357!crank2!down!192877732!crank2!up!192879192!crank2!down!192879565!crank!up!192886293!r!0!194982088!crank!down!194982088!crank2!up!194984699!crank2!down!194990112!crank2!up!194991715!crank2!down!194992085!crank2!up!194993530!crank2!down!194993884!crank2!up!194995292!crank2!down!194995645!crank!up!195001475!crank2!up!195006153!crank2!down!195006515!crank2!up!195007968!crank2!down!195008325!crank2!up!195009773!crank2!down!195010134!crank2!up!195011549!crank2!down!195011901!crank2!up!195017256!crank!down!195019915!crank2!down!195022597!crank2!up!195024189!crank2!down!195024554!crank2!up!195025980!crank2!down!195026329!crank2!up!195027744!crank2!down!195028103!crank!up!195033418!crank2!up!195038542!crank2!down!195038911!crank2!up!195040351!crank2!down!195040722!crank2!up!195042167!crank2!down!195042529!crank2!up!195043934!crank2!down!195044294!r!187!195047060!crank!down!195047060!crank2!up!195049619!crank2!down!195054954!crank2!up!195056549!crank2!down!195056920!crank2!up!195058345!crank2!down!195058703!crank2!up!195060114!crank2!down!195060464!crank!up!195066245!crank2!up!195070882!crank2!down!195071250!crank2!up!195072689!crank2!down!195073054!crank2!up!195074479!,");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setOutpinListener(EngineState engineState) {
|
||||||
|
engineState.registerStringValueAction(EngineState.OUTPIN_TAG, new EngineState.ValueCallback<String>() {
|
||||||
|
@Override
|
||||||
|
public void onUpdate(String value) {
|
||||||
|
String pinInfo[] = value.split("@");
|
||||||
|
if (pinInfo.length != 2)
|
||||||
|
return;
|
||||||
|
String channel = pinInfo[0];
|
||||||
|
String pin = pinInfo[1];
|
||||||
|
UpDownImage image = images.get(channel);
|
||||||
|
channelName2PhysicalPin.put(channel, pin);
|
||||||
|
if (image != null)
|
||||||
|
image.setPhysicalPin(pin);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
private void resetImagePanel() {
|
private void resetImagePanel() {
|
||||||
imagePanel.removeAll();
|
imagePanel.removeAll();
|
||||||
imagePanel.add(crank);
|
imagePanel.add(crank);
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package com.rusefi.ui.engine;
|
package com.rusefi.ui.engine;
|
||||||
|
|
||||||
|
import com.rusefi.Launcher;
|
||||||
import com.rusefi.core.Sensor;
|
import com.rusefi.core.Sensor;
|
||||||
import com.rusefi.core.SensorCentral;
|
import com.rusefi.core.SensorCentral;
|
||||||
import com.rusefi.ui.util.UiUtils;
|
import com.rusefi.ui.util.UiUtils;
|
||||||
|
@ -51,12 +52,19 @@ public class UpDownImage extends JPanel {
|
||||||
UiUtils.trueRepaint(UpDownImage.this);
|
UiUtils.trueRepaint(UpDownImage.this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
public boolean showText = true;
|
public boolean showMouseOverText = true;
|
||||||
private int currentMouseX = -100;
|
private int currentMouseX = -100;
|
||||||
|
|
||||||
public UpDownImage(final String name) {
|
public UpDownImage(final String name) {
|
||||||
this(EngineReport.MOCK, name);
|
this(EngineReport.MOCK, name);
|
||||||
setToolTip();
|
setToolTip();
|
||||||
|
// this code is horrible, I am in a rush :(
|
||||||
|
EngineSnifferPanel p = Launcher.engineSnifferPanel;
|
||||||
|
if (p != null) {
|
||||||
|
String pin = p.channelName2PhysicalPin.get(name);
|
||||||
|
if (pin != null)
|
||||||
|
setPhysicalPin(pin);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSignalBody(Color signalBody) {
|
public void setSignalBody(Color signalBody) {
|
||||||
|
@ -162,7 +170,7 @@ public class UpDownImage extends JPanel {
|
||||||
for (EngineReport.UpDown upDown : wr.getList())
|
for (EngineReport.UpDown upDown : wr.getList())
|
||||||
paintUpDown(d, upDown, g);
|
paintUpDown(d, upDown, g);
|
||||||
|
|
||||||
if (showText)
|
if (showMouseOverText)
|
||||||
paintScaleLines(g2, d);
|
paintScaleLines(g2, d);
|
||||||
|
|
||||||
int duration = wr.getDuration();
|
int duration = wr.getDuration();
|
||||||
|
@ -175,15 +183,19 @@ public class UpDownImage extends JPanel {
|
||||||
g.setFont(f.deriveFont(Font.BOLD, f.getSize() * 3));
|
g.setFont(f.deriveFont(Font.BOLD, f.getSize() * 3));
|
||||||
g.setColor(Color.red);
|
g.setColor(Color.red);
|
||||||
}
|
}
|
||||||
if (showText)
|
if (showMouseOverText) {
|
||||||
g.drawString(NameUtil.getUiName(name), 5, ++line * LINE_SIZE + (justEntered ? 30 : 0));
|
String mouseOverText = NameUtil.getUiName(name);
|
||||||
|
if (pin != null)
|
||||||
|
mouseOverText += "/" + pin;
|
||||||
|
g.drawString(mouseOverText, 5, ++line * LINE_SIZE + (justEntered ? 30 : 0));
|
||||||
|
}
|
||||||
if (justEntered) {
|
if (justEntered) {
|
||||||
// revert font & color
|
// revert font & color
|
||||||
g.setFont(f);
|
g.setFont(f);
|
||||||
g.setColor(Color.black);
|
g.setColor(Color.black);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showText) {
|
if (showMouseOverText) {
|
||||||
g.drawString("Tick length: " + duration + "; count=" + wr.getList().size(), 5, ++line * LINE_SIZE);
|
g.drawString("Tick length: " + duration + "; count=" + wr.getList().size(), 5, ++line * LINE_SIZE);
|
||||||
g.drawString("Total seconds: " + (duration / EngineReport.SYS_TICKS_PER_MS / 000.0), 5, ++line * LINE_SIZE);
|
g.drawString("Total seconds: " + (duration / EngineReport.SYS_TICKS_PER_MS / 000.0), 5, ++line * LINE_SIZE);
|
||||||
g.drawString(FORMAT.format(new Date(lastUpdateTime)), 5, ++line * LINE_SIZE);
|
g.drawString(FORMAT.format(new Date(lastUpdateTime)), 5, ++line * LINE_SIZE);
|
||||||
|
@ -262,7 +274,7 @@ public class UpDownImage extends JPanel {
|
||||||
g.setColor(Color.red);
|
g.setColor(Color.red);
|
||||||
String durationString = String.format(" %.2fms", upDown.getDuration() / EngineReport.SYS_TICKS_PER_MS);
|
String durationString = String.format(" %.2fms", upDown.getDuration() / EngineReport.SYS_TICKS_PER_MS);
|
||||||
|
|
||||||
if (showText) {
|
if (showMouseOverText) {
|
||||||
g.drawString(durationString, x1, (int) (0.5 * d.height));
|
g.drawString(durationString, x1, (int) (0.5 * d.height));
|
||||||
|
|
||||||
double fromAngle = time2rpm.getCrankAngleByTime((double) upDown.upTime);
|
double fromAngle = time2rpm.getCrankAngleByTime((double) upDown.upTime);
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package com.rusefi.ui.logview;
|
package com.rusefi.ui.logview;
|
||||||
|
|
||||||
import com.rusefi.FileLog;
|
import com.rusefi.FileLog;
|
||||||
|
import com.rusefi.Launcher;
|
||||||
import com.rusefi.core.EngineState;
|
import com.rusefi.core.EngineState;
|
||||||
import com.rusefi.file.FileUtils;
|
import com.rusefi.file.FileUtils;
|
||||||
import com.rusefi.ui.ChartRepository;
|
import com.rusefi.ui.ChartRepository;
|
||||||
|
@ -8,6 +9,7 @@ import com.rusefi.ui.LogDownloader;
|
||||||
import com.rusefi.ui.engine.EngineSnifferPanel;
|
import com.rusefi.ui.engine.EngineSnifferPanel;
|
||||||
import com.rusefi.ui.util.UiUtils;
|
import com.rusefi.ui.util.UiUtils;
|
||||||
import com.rusefi.io.LinkManager;
|
import com.rusefi.io.LinkManager;
|
||||||
|
import com.rusefi.waves.EngineReport;
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -176,7 +178,9 @@ public class LogViewer extends JPanel {
|
||||||
|
|
||||||
ChartRepository.getInstance().clear();
|
ChartRepository.getInstance().clear();
|
||||||
EngineState engineState = new EngineState(listener);
|
EngineState engineState = new EngineState(listener);
|
||||||
engineState.registerStringValueAction("wave_chart", new EngineState.ValueCallback<String>() {
|
// this is pretty dirty, better OOP desperately needed
|
||||||
|
Launcher.engineSnifferPanel.setOutpinListener(engineState);
|
||||||
|
engineState.registerStringValueAction(EngineReport.ENGINE_CHART, new EngineState.ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(String value) {
|
public void onUpdate(String value) {
|
||||||
FileLog.MAIN.logLine("Got wave_chart: " + value);
|
FileLog.MAIN.logLine("Got wave_chart: " + value);
|
||||||
|
|
Loading…
Reference in New Issue