auto-sync
This commit is contained in:
parent
664062d16b
commit
8897b277b3
|
@ -35,8 +35,11 @@ public class RevolutionLog {
|
|||
}
|
||||
|
||||
public String getCrankAngleByTimeString(double time) {
|
||||
double result = getCrankAngleByTime(time);
|
||||
return Double.isNaN(result) ? "n/a" : String.format("%.2f", result);
|
||||
return angle2string(getCrankAngleByTime(time));
|
||||
}
|
||||
|
||||
public static String angle2string(double angle) {
|
||||
return Double.isNaN(angle) ? "n/a" : String.format("%.2f", angle);
|
||||
}
|
||||
|
||||
public double getCrankAngleByTime(double time) {
|
||||
|
|
|
@ -32,7 +32,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see com.rusefi.StartupFrame
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20150918;
|
||||
public static final int CONSOLE_VERSION = 20150920;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
|
@ -88,7 +88,7 @@ public class EngineSnifferPanel {
|
|||
});
|
||||
|
||||
|
||||
statusPanel.setWaveReport(crank.createTranslator());
|
||||
statusPanel.setTimeAxisTranslator(crank.createTranslator());
|
||||
|
||||
JButton clearButton = new JButton(CLEAR.getMessage());
|
||||
clearButton.setMnemonic('c');
|
||||
|
|
|
@ -46,10 +46,11 @@ public class EngineSnifferStatusPanel {
|
|||
angleLabel.setText(text);
|
||||
|
||||
Map.Entry<Integer, Integer> e = time2rpm.getTimeAndRpm(time);
|
||||
if (e == null)
|
||||
if (e == null) {
|
||||
rpmLabel.setText("n/a");
|
||||
else
|
||||
} else {
|
||||
rpmLabel.setText("" + e.getValue());
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -77,7 +78,7 @@ public class EngineSnifferStatusPanel {
|
|||
infoPanel.add(red);
|
||||
}
|
||||
|
||||
public void setWaveReport(TimeAxisTranslator translator) {
|
||||
public void setTimeAxisTranslator(TimeAxisTranslator translator) {
|
||||
this.translator = translator;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,7 @@ public class UpDownImage extends JPanel {
|
|||
}
|
||||
});
|
||||
public boolean showText = true;
|
||||
private int currentMouseX = -100;
|
||||
|
||||
public UpDownImage(final String name) {
|
||||
this(EngineReport.MOCK, name);
|
||||
|
@ -68,6 +69,13 @@ public class UpDownImage extends JPanel {
|
|||
setWaveReport(wr, null);
|
||||
setOpaque(true);
|
||||
translator = createTranslator();
|
||||
addMouseMotionListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
currentMouseX = e.getX();
|
||||
UiUtils.trueRepaint(UpDownImage.this);
|
||||
}
|
||||
});
|
||||
addMouseListener(new MouseAdapter() {
|
||||
@Override
|
||||
public void mouseEntered(MouseEvent e) {
|
||||
|
@ -217,9 +225,15 @@ public class UpDownImage extends JPanel {
|
|||
|
||||
int y = (int) (0.2 * d.height);
|
||||
|
||||
/**
|
||||
* signal body
|
||||
*/
|
||||
g.setColor(Color.lightGray);
|
||||
g.fillRect(x1, y, x2 - x1, d.height - y);
|
||||
|
||||
/**
|
||||
* signal out-line
|
||||
*/
|
||||
g.setColor(Color.blue);
|
||||
g.drawLine(x1, y, x2, y);
|
||||
g.drawLine(x1, y, x1, d.height);
|
||||
|
@ -231,25 +245,35 @@ public class UpDownImage extends JPanel {
|
|||
if (showText) {
|
||||
g.drawString(durationString, x1, (int) (0.5 * d.height));
|
||||
|
||||
String fromAngle = time2rpm.getCrankAngleByTimeString(upDown.upTime);
|
||||
String toAngle = time2rpm.getCrankAngleByTimeString(upDown.downTime);
|
||||
double fromAngle = time2rpm.getCrankAngleByTime((double) upDown.upTime);
|
||||
double toAngle = time2rpm.getCrankAngleByTime((double) upDown.downTime);
|
||||
|
||||
String fromAngleStr = RevolutionLog.angle2string(fromAngle);
|
||||
|
||||
g.setColor(Color.darkGray);
|
||||
if (upDown.upIndex != -1) {
|
||||
g.drawString("" + upDown.upIndex, x1, (int) (0.25 * d.height));
|
||||
// System.out.println("digital_event," + upDown.upIndex + "," + fromAngle);
|
||||
// System.out.println("digital_event," + upDown.upIndex + "," + fromAngleStr);
|
||||
}
|
||||
if (upDown.downIndex != -1) {
|
||||
g.drawString("" + upDown.downIndex, x2, (int) (0.25 * d.height));
|
||||
// System.out.println("digital_event," + upDown.downIndex + "," + toAngle);
|
||||
// System.out.println("digital_event," + upDown.downIndex + "," + toAngleStr);
|
||||
}
|
||||
|
||||
int offset = 3;
|
||||
g.setColor(Color.black);
|
||||
g.drawString(fromAngle, x1 + offset, (int) (0.75 * d.height));
|
||||
g.drawString(fromAngleStr, x1 + offset, (int) (0.75 * d.height));
|
||||
|
||||
g.setColor(Color.green);
|
||||
g.drawString(toAngle, x1 + offset, (int) (1.0 * d.height));
|
||||
g.setColor(Color.black);
|
||||
|
||||
if (Math.abs(x1 - currentMouseX) < 5) {
|
||||
double angleDuration = toAngle - fromAngle;
|
||||
String durationStr = RevolutionLog.angle2string(angleDuration);
|
||||
g.drawString(durationStr, x1 + offset, (int) (1.0 * d.height));
|
||||
} else {
|
||||
String toAngleStr = RevolutionLog.angle2string(toAngle);
|
||||
g.drawString(toAngleStr, x1 + offset, (int) (1.0 * d.height));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue