refactoring

This commit is contained in:
rusefi 2020-05-26 01:51:50 -04:00
parent 11235befde
commit eeef824894
3 changed files with 13 additions and 10 deletions

View File

@ -159,15 +159,18 @@ public class EngineReport {
public static class UpDown { public static class UpDown {
// times in sys ticks // times in sys ticks
public final int upTime; public final int upTime;
public final int upIndex; /**
* Only trigger channels have these
*/
public final int upTriggerCycleIndex;
public final int downTime; public final int downTime;
public final int downIndex; public final int downTriggerCycleIndex;
public UpDown(int upTime, int upIndex, int downTime, int downIndex) { public UpDown(int upTime, int upIndex, int downTime, int downIndex) {
this.upTime = upTime; this.upTime = upTime;
this.upIndex = upIndex; this.upTriggerCycleIndex = upIndex;
this.downTime = downTime; this.downTime = downTime;
this.downIndex = downIndex; this.downTriggerCycleIndex = downIndex;
} }
public int getDuration() { public int getDuration() {

View File

@ -32,10 +32,10 @@ public class EngineChartParserTest {
EngineReport.UpDown upDown = list.get(0); EngineReport.UpDown upDown = list.get(0);
assertEquals(24, upDown.upTime); assertEquals(24, upDown.upTime);
assertEquals(156, upDown.upIndex); assertEquals(156, upDown.upTriggerCycleIndex);
assertEquals(39, upDown.downTime); assertEquals(39, upDown.downTime);
assertEquals(157, upDown.downIndex); assertEquals(157, upDown.downTriggerCycleIndex);
} }
@Test @Test

View File

@ -282,12 +282,12 @@ public class UpDownImage extends JPanel {
String fromAngleStr = RevolutionLog.angle2string(fromAngle); String fromAngleStr = RevolutionLog.angle2string(fromAngle);
g.setColor(Color.darkGray); g.setColor(Color.darkGray);
if (upDown.upIndex != -1) { if (upDown.upTriggerCycleIndex != -1) {
g.drawString("" + upDown.upIndex, x1, (int) (0.25 * d.height)); g.drawString("" + upDown.upTriggerCycleIndex, x1, (int) (0.25 * d.height));
// System.out.println("digital_event," + upDown.upIndex + "," + fromAngleStr); // System.out.println("digital_event," + upDown.upIndex + "," + fromAngleStr);
} }
if (upDown.downIndex != -1) { if (upDown.downTriggerCycleIndex != -1) {
g.drawString("" + upDown.downIndex, x2, (int) (0.25 * d.height)); g.drawString("" + upDown.downTriggerCycleIndex, x2, (int) (0.25 * d.height));
// System.out.println("digital_event," + upDown.downIndex + "," + toAngleStr); // System.out.println("digital_event," + upDown.downIndex + "," + toAngleStr);
} }