generate java enum from C enum? generate both C and java from yaml? #2102
This commit is contained in:
parent
bf601b831a
commit
eec89e7118
|
@ -6,7 +6,7 @@ import java.net.URL;
|
|||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
public class rusEFIVersion {
|
||||
public static final int CONSOLE_VERSION = 20211028;
|
||||
public static final int CONSOLE_VERSION = 20211030;
|
||||
public static AtomicReference<String> firmwareVersion = new AtomicReference<>("N/A");
|
||||
|
||||
public static long classBuildTimeMillis() {
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.rusefi.binaryprotocol.BinaryProtocolState;
|
|||
import com.rusefi.config.Field;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.enums.live_data_e;
|
||||
import com.rusefi.io.LinkConnector;
|
||||
import com.rusefi.livedata.generated.CPP14Lexer;
|
||||
import com.rusefi.livedata.generated.CPP14Parser;
|
||||
import com.rusefi.livedata.generated.CPP14ParserBaseListener;
|
||||
|
@ -24,14 +23,12 @@ import org.antlr.v4.runtime.tree.ParseTree;
|
|||
import org.antlr.v4.runtime.tree.ParseTreeWalker;
|
||||
import org.antlr.v4.runtime.tree.TerminalNode;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.*;
|
||||
import java.awt.*;
|
||||
import java.io.*;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.Stack;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
|
@ -232,8 +229,14 @@ public class LiveDataParserPanel {
|
|||
}, tree);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static LiveDataParserPanel getLiveDataParserPanel(UIContext uiContext, final live_data_e live_data_e, final Field[] values, String fileName) {
|
||||
@NotNull
|
||||
public static JPanel createLiveDataParserContent(UIContext uiContext, LiveDataView view) {
|
||||
LiveDataParserPanel panel = createLiveDataParserPanel(uiContext, view.getLiveDataE(), view.getValues(), view.getFileName());
|
||||
return panel.getContent();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static LiveDataParserPanel createLiveDataParserPanel(UIContext uiContext, final live_data_e live_data_e, final Field[] values, String fileName) {
|
||||
AtomicReference<byte[]> reference = new AtomicReference<>();
|
||||
|
||||
LiveDataParserPanel livePanel = new LiveDataParserPanel(uiContext, new VariableValueSource() {
|
||||
|
|
|
@ -0,0 +1,35 @@
|
|||
package com.rusefi.livedata;
|
||||
|
||||
import com.rusefi.config.Field;
|
||||
import com.rusefi.config.generated.AcControl;
|
||||
import com.rusefi.config.generated.TpsAccelState;
|
||||
import com.rusefi.enums.live_data_e;
|
||||
|
||||
public enum LiveDataView {
|
||||
AC_CONTROL(live_data_e.LDS_AC_CONTROL, AcControl.VALUES, "ac_control.cpp"),
|
||||
TPS_ACCEL(live_data_e.LDS_TPS_ACCEL, TpsAccelState.VALUES, "accel_enrichment.cpp"),
|
||||
;
|
||||
|
||||
private final live_data_e liveDataE;
|
||||
private final Field[] values;
|
||||
private final String fileName;
|
||||
|
||||
LiveDataView(live_data_e liveDataE, Field[] values, String fileName) {
|
||||
|
||||
this.liveDataE = liveDataE;
|
||||
this.values = values;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
public live_data_e getLiveDataE() {
|
||||
return liveDataE;
|
||||
}
|
||||
|
||||
public Field[] getValues() {
|
||||
return values;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
}
|
||||
}
|
|
@ -4,12 +4,11 @@ import com.opensr5.ConfigurationImage;
|
|||
import com.opensr5.Logger;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.binaryprotocol.BinaryProtocol;
|
||||
import com.rusefi.config.generated.AcControl;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.core.Sensor;
|
||||
import com.rusefi.core.SensorCentral;
|
||||
import com.rusefi.enums.live_data_e;
|
||||
import com.rusefi.livedata.LiveDataParserPanel;
|
||||
import com.rusefi.livedata.LiveDataView;
|
||||
import com.rusefi.ui.config.ConfigField;
|
||||
import com.rusefi.ui.util.UiUtils;
|
||||
import com.rusefi.ui.widgets.IntGaugeLabel;
|
||||
|
@ -48,10 +47,9 @@ public class FormulasPane {
|
|||
public FormulasPane(UIContext uiContext) {
|
||||
this.uiContext = uiContext;
|
||||
|
||||
LiveDataParserPanel livePanel = LiveDataParserPanel.getLiveDataParserPanel(uiContext, live_data_e.LDS_AC_CONTROL, AcControl.VALUES, "ac_control.cpp");
|
||||
|
||||
JPanel vertical = new JPanel(new VerticalFlowLayout());
|
||||
vertical.add(livePanel.getContent());
|
||||
for (LiveDataView view : LiveDataView.values())
|
||||
vertical.add(LiveDataParserPanel.createLiveDataParserContent(uiContext, view));
|
||||
vertical.add(formulaProxy);
|
||||
|
||||
JScrollPane scroll = new JScrollPane(vertical, JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
|
||||
|
|
|
@ -8,8 +8,14 @@ public class Range {
|
|||
private final int stop;
|
||||
|
||||
public Range(int start, int stop) {
|
||||
if (start < 0)
|
||||
throw new IllegalArgumentException("Negative start " + start);
|
||||
if (stop < 0)
|
||||
throw new IllegalArgumentException("Negative stop " + stop);
|
||||
this.start = start;
|
||||
this.stop = stop;
|
||||
if (getLength() < 0)
|
||||
throw new IllegalArgumentException("Negative length " + start + "/" + stop);
|
||||
}
|
||||
|
||||
public Range(Token start, Token stop) {
|
||||
|
@ -32,4 +38,12 @@ public class Range {
|
|||
public int getLength() {
|
||||
return stop - start;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Range{" +
|
||||
"start=" + start +
|
||||
", stop=" + stop +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue