updating naming convention
This commit is contained in:
parent
50e01b4041
commit
6bb0a1c56b
|
@ -65,7 +65,7 @@ public class SensorStats {
|
||||||
SensorCentral.getInstance().addListener(input1, new SensorCentral.SensorListener() {
|
SensorCentral.getInstance().addListener(input1, new SensorCentral.SensorListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSensorUpdate(double value) {
|
public void onSensorUpdate(double value) {
|
||||||
double valueMs = 1.0 * (value - SensorCentral.getInstance().getValue(input2)) / EngineReport.SYS_TICKS_PER_MS;
|
double valueMs = 1.0 * (value - SensorCentral.getInstance().getValue(input2)) / EngineReport.ENGINE_SNIFFER_TICKS_PER_MS;
|
||||||
SensorCentral.getInstance().setValue(valueMs, destination);
|
SensorCentral.getInstance().setValue(valueMs, destination);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,16 +23,15 @@ public class EngineReport implements TimeAxisTranslator {
|
||||||
public static final String ENGINE_CHART = Fields.PROTOCOL_ENGINE_SNIFFER;
|
public static final String ENGINE_CHART = Fields.PROTOCOL_ENGINE_SNIFFER;
|
||||||
public static final EngineReport MOCK = new EngineReport(Collections.singletonList(new UpDown(0, -1, 1, -1)));
|
public static final EngineReport MOCK = new EngineReport(Collections.singletonList(new UpDown(0, -1, 1, -1)));
|
||||||
/**
|
/**
|
||||||
* number of ChibiOS systicks per ms
|
* number of Engine Sniffer ticks per ms
|
||||||
*/
|
*/
|
||||||
public static final double SYS_TICKS_PER_MS = 1000 / Fields.ENGINE_SNIFFER_UNIT_US;
|
public static final double ENGINE_SNIFFER_TICKS_PER_MS = 1000 / Fields.ENGINE_SNIFFER_UNIT_US;
|
||||||
public static final double RATIO = 0.05;
|
public static final double RATIO = 0.05;
|
||||||
public static final int mult = (int) (100 * SYS_TICKS_PER_MS); // 100ms
|
|
||||||
|
|
||||||
private final List<UpDown> list;
|
private final List<UpDown> list;
|
||||||
private int maxTime;
|
private int maxTime;
|
||||||
/**
|
/**
|
||||||
* min timestamp on this chart, in systicks
|
* min timestamp on this chart, in Engine Sniffer ticks
|
||||||
*/
|
*/
|
||||||
private int minTime;
|
private int minTime;
|
||||||
|
|
||||||
|
@ -130,15 +129,12 @@ public class EngineReport implements TimeAxisTranslator {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public double screenToTime(int screenX, int screenWidth) {
|
public double screenToTime(int screenX, int screenWidth) {
|
||||||
// / SYS_TICKS_PER_MS / 1000
|
|
||||||
double time = 1.0 * screenX * getDuration() / screenWidth + minTime;
|
double time = 1.0 * screenX * getDuration() / screenWidth + minTime;
|
||||||
// int x2 = timeToScreen((int) time, screenWidth, zoomProvider);
|
|
||||||
// FileLog.rlog("screenToTime " + (screen - x2));
|
|
||||||
return (int) time;
|
return (int) time;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Length of this chart in systicks
|
* @return Length of this chart in Engine Sniffer ticks
|
||||||
*/
|
*/
|
||||||
public int getDuration() {
|
public int getDuration() {
|
||||||
return maxTime - minTime;
|
return maxTime - minTime;
|
||||||
|
|
|
@ -63,7 +63,7 @@ public class RevolutionLog {
|
||||||
double diff = time - entry.getKey();
|
double diff = time - entry.getKey();
|
||||||
|
|
||||||
Integer rpm = entry.getValue();
|
Integer rpm = entry.getValue();
|
||||||
double timeForRevolution = 60000 * EngineReport.SYS_TICKS_PER_MS / rpm;
|
double timeForRevolution = 60000 * EngineReport.ENGINE_SNIFFER_TICKS_PER_MS / rpm;
|
||||||
|
|
||||||
return 360.0 * diff / timeForRevolution;
|
return 360.0 * diff / timeForRevolution;
|
||||||
}
|
}
|
||||||
|
|
|
@ -30,6 +30,7 @@ import java.util.Date;
|
||||||
* @see EngineReport
|
* @see EngineReport
|
||||||
*/
|
*/
|
||||||
public class UpDownImage extends JPanel {
|
public class UpDownImage extends JPanel {
|
||||||
|
private static final int TIMESCALE_MULT = (int) (100 * EngineReport.ENGINE_SNIFFER_TICKS_PER_MS); // 100ms
|
||||||
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
|
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
|
||||||
private static final int LINE_SIZE = 20;
|
private static final int LINE_SIZE = 20;
|
||||||
public static final Color TIME_SCALE_COLOR = Color.red;
|
public static final Color TIME_SCALE_COLOR = Color.red;
|
||||||
|
@ -236,14 +237,14 @@ public class UpDownImage extends JPanel {
|
||||||
new float[]{21.0f, 7.0f}, 0.0f);
|
new float[]{21.0f, 7.0f}, 0.0f);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method draws a vertical line every millisecond
|
* This method draws a vertical line every 100 milliseconds
|
||||||
*/
|
*/
|
||||||
private void paintScaleLines(Graphics2D g2, Dimension d) {
|
private void paintScaleLines(Graphics2D g2, Dimension d) {
|
||||||
int fromMs = translator.getMinTime() / EngineReport.mult;
|
int fromMs = translator.getMinTime() / TIMESCALE_MULT;
|
||||||
g2.setStroke(LONG_STROKE);
|
g2.setStroke(LONG_STROKE);
|
||||||
g2.setColor(TIME_SCALE_COLOR);
|
g2.setColor(TIME_SCALE_COLOR);
|
||||||
|
|
||||||
int toMs = translator.getMaxTime() / EngineReport.mult;
|
int toMs = translator.getMaxTime() / TIMESCALE_MULT;
|
||||||
|
|
||||||
if (toMs - fromMs > d.getWidth() / 5) {
|
if (toMs - fromMs > d.getWidth() / 5) {
|
||||||
/**
|
/**
|
||||||
|
@ -255,7 +256,7 @@ public class UpDownImage extends JPanel {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int ms = fromMs; ms <= toMs; ms++) {
|
for (int ms = fromMs; ms <= toMs; ms++) {
|
||||||
int tick = ms * EngineReport.mult;
|
int tick = ms * TIMESCALE_MULT;
|
||||||
int x = translator.timeToScreen(tick, d.width);
|
int x = translator.timeToScreen(tick, d.width);
|
||||||
g2.drawLine(x, 0, x, d.height);
|
g2.drawLine(x, 0, x, d.height);
|
||||||
}
|
}
|
||||||
|
@ -277,7 +278,7 @@ public class UpDownImage extends JPanel {
|
||||||
|
|
||||||
if (showMouseOverText) {
|
if (showMouseOverText) {
|
||||||
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.ENGINE_SNIFFER_TICKS_PER_MS);
|
||||||
g.drawString(durationString, x1, (int) (0.5 * d.height));
|
g.drawString(durationString, x1, (int) (0.5 * d.height));
|
||||||
|
|
||||||
double fromAngle = time2rpm.getCrankAngleByTime(upDown.upTime);
|
double fromAngle = time2rpm.getCrankAngleByTime(upDown.upTime);
|
||||||
|
|
Loading…
Reference in New Issue