only:Vadim is asking for SyncEdge to be reflected on trigger images fix #5472

This commit is contained in:
rusefillc 2023-07-29 14:53:46 -04:00
parent 0c2dcb1788
commit 3c9f2cae8d
2 changed files with 21 additions and 2 deletions

View File

@ -41,6 +41,7 @@ public class TriggerImage {
/**
* todo: https://github.com/rusefi/rusefi/issues/2077
*
* @see TriggerWheelInfo#isCrankBased
*/
private static String getTriggerName(TriggerWheelInfo triggerName) {
@ -163,6 +164,7 @@ public class TriggerImage {
triggerPanel.tdcPosition = triggerWheelInfo.getTdcPosition();
triggerPanel.gaps = triggerWheelInfo.getGaps();
triggerPanel.syncEdge = triggerWheelInfo.getSyncEdge();
EngineReport re0 = new EngineReport(waves.get(0).list, MIN_TIME, 720 * (1 + EXTRA_COUNT));
System.out.println(re0);
@ -328,6 +330,7 @@ public class TriggerImage {
public String id;
// angle
public double tdcPosition;
public String syncEdge;
public UpDownImage image;
public TriggerWheelInfo.TriggerGaps gaps;
@ -364,13 +367,22 @@ public class TriggerImage {
} else {
tdcMessage = "TDC at synchronization point";
}
g.drawString(" " + tdcMessage, 0, tdcFontSize);
int y = tdcFontSize;
String prefix = " ";
g.drawString(prefix + tdcMessage, 0, y);
y += tdcFontSize;
g.setColor(Color.darkGray);
if (image == null)
return;
for (int i = 0; i < gaps.gapFrom.length; i++) {
String message = "Sync " + (i + 1) + ": From " + gaps.gapFrom[i] + " to " + gaps.gapTo[i];
g.drawString(" " + message, 0, tdcFontSize * (2 + i));
g.drawString(prefix + " " + message, 0, y);
y += tdcFontSize;
}
if (syncEdge != null) {
g.drawString(prefix + syncEdge, 0, y);
y += tdcFontSize;
}
int tdcX = image.engineReport.getTimeAxisTranslator().timeToScreen(MIN_TIME + tdcPosition, w);

View File

@ -22,6 +22,7 @@ public class TriggerWheelInfo {
private final boolean hasSecondChannel;
private final boolean hardcodedOperationMode;
private final TriggerGaps gaps;
private final String syncEdge;
public TriggerWheelInfo(int id, double tdcPosition, String triggerName, List<TriggerSignal> signals,
boolean isCrankBased,
@ -38,6 +39,7 @@ public class TriggerWheelInfo {
this.hasSecondChannel = hasSecondChannel;
this.hardcodedOperationMode = hardcodedOperationMode;
this.gaps = gaps;
this.syncEdge = syncEdge;
}
private static TriggerWheelInfo readTriggerWheelInfo(String line, BufferedReader reader) throws IOException {
@ -104,6 +106,7 @@ public class TriggerWheelInfo {
break;
case TRIGGER_SYNC_EDGE:
syncEdge = value;
break;
default:
throw new IllegalStateException("Unexpected key/value: " + line);
}
@ -233,6 +236,10 @@ public class TriggerWheelInfo {
return gaps;
}
public String getSyncEdge() {
return syncEdge;
}
public interface TriggerWheelInfoConsumer {
void onWheel(TriggerWheelInfo wheelInfo);
}