Skip to content

Commit

Permalink
trigger images - black dot is green line fix #2730
Browse files Browse the repository at this point in the history
  • Loading branch information
rusefillc committed May 23, 2021
1 parent 2a0e72e commit f051993
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import java.util.concurrent.atomic.AtomicReference;

public class rusEFIVersion {
public static final int CONSOLE_VERSION = 20210428;
public static final int CONSOLE_VERSION = 20210523;
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");

public static long classBuildTimeMillis() {
Expand Down
17 changes: 14 additions & 3 deletions java_console/ui/src/main/java/com/rusefi/TriggerImage.java
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ private static JPanel createWheelPanel(List<TriggerSignal> wheel, boolean showTd
@Override
public void paint(Graphics g) {
super.paint(g);
g.setColor(Color.black);

int middle = WHEEL_BORDER + WHEEL_DIAMETER / 2;
if (showTdc) {
Expand All @@ -249,12 +248,14 @@ public void paint(Graphics g) {
int smallY = (int) (WHEEL_DIAMETER / 2 * Math.cos(tdcAngle));

int tdcMarkRadius = 8;
g.setColor(UpDownImage.ENGINE_CYCLE_COLOR);
g.fillOval(middle + smallX - tdcMarkRadius, middle + smallY - tdcMarkRadius,
2 * tdcMarkRadius,
2 * tdcMarkRadius);

g.drawString("TDC", middle + smallX + tdcMarkRadius * 2, middle + smallY);
}
g.setColor(Color.black);

for (int i = 0; i < wheel.size(); i++) {
TriggerSignal current = wheel.get(i);
Expand Down Expand Up @@ -401,13 +402,23 @@ public void paint(Graphics g) {
if (id != null)
g.drawString(id, 0, (int) (h * 0.9));

g.setColor(Color.green);
g.setColor(UpDownImage.ENGINE_CYCLE_COLOR);
int tdcFontSize = (int) (f.getSize() * 1.5);
g.setFont(new Font(f.getName(), Font.BOLD, tdcFontSize));
g.drawString("tdcPosition " + formatTdcPosition(), 0, tdcFontSize);
String tdcMessage;
if (tdcPosition != 0) {
tdcMessage = "TDC " + formatTdcPosition() + " degree from synchronization point";
} else {
tdcMessage = "TDC at synchronization point";
}
g.drawString(" " + tdcMessage, 0, tdcFontSize);

int tdcX = (int) (w / 720.0 * tdcPosition);
g.drawLine(tdcX, 0, tdcX, h);
Graphics2D g2 = (Graphics2D) g;
g2.rotate(Math.PI / 2);
g2.drawString("TDC", 60, -tdcX - 3);
g2.rotate(-Math.PI / 2);
}

private String formatTdcPosition() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class UpDownImage extends JPanel {
private static final SimpleDateFormat FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'hh:mm:ss");
private static final int LINE_SIZE = 20;
public static final Color TIME_SCALE_COLOR = Color.red;
public static final Color ENGINE_CYCLE_COLOR = Color.green;
public static final Color ENGINE_CYCLE_COLOR = new Color(0, 153, 0);
private static final BasicStroke TIME_SCALE_STROKE = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f,
new float[]{7.0f, 21.0f}, 0.0f);
private static final BasicStroke ENGINE_CYCLE_STROKE = new BasicStroke(1, BasicStroke.CAP_BUTT, BasicStroke.JOIN_BEVEL, 10.0f,
Expand Down

0 comments on commit f051993

Please sign in to comment.