first part (#3907)
This commit is contained in:
parent
e186a7c343
commit
1e163e5daf
|
@ -98,8 +98,7 @@ public class RXTextUtilities
|
||||||
Element root = component.getDocument().getDefaultRootElement();
|
Element root = component.getDocument().getDefaultRootElement();
|
||||||
line = Math.max(line, 1);
|
line = Math.max(line, 1);
|
||||||
line = Math.min(line, root.getElementCount());
|
line = Math.min(line, root.getElementCount());
|
||||||
int startOfLineOffset = root.getElement( line - 1 ).getStartOffset();
|
return root.getElement( line - 1 ).getStartOffset();
|
||||||
return startOfLineOffset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class StandardTestSequence {
|
||||||
metric.reset();
|
metric.reset();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
TestSequenceStep result = first_step.addNext(secondStep)
|
return first_step.addNext(secondStep)
|
||||||
.addNext(uiContext, 10 * SECOND, 4 /*position*/, onEachStep, condition)
|
.addNext(uiContext, 10 * SECOND, 4 /*position*/, onEachStep, condition)
|
||||||
.addNext(uiContext, 5 * SECOND, 6, /*position*/onEachStep, condition)
|
.addNext(uiContext, 5 * SECOND, 6, /*position*/onEachStep, condition)
|
||||||
.addNext(uiContext, 5 * SECOND, 8, /*position*/onEachStep, condition)
|
.addNext(uiContext, 5 * SECOND, 8, /*position*/onEachStep, condition)
|
||||||
|
@ -63,6 +63,5 @@ public class StandardTestSequence {
|
||||||
.addNext(uiContext, 10 * SECOND, 4, /*position*/onEachStep, condition)
|
.addNext(uiContext, 10 * SECOND, 4, /*position*/onEachStep, condition)
|
||||||
.addNext(uiContext, 10 * SECOND, 0, /*position*/onEachStep, condition)
|
.addNext(uiContext, 10 * SECOND, 0, /*position*/onEachStep, condition)
|
||||||
;
|
;
|
||||||
return result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ import static javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
|
||||||
public class LiveDataParserPanel {
|
public class LiveDataParserPanel {
|
||||||
private static final Logging log = getLogging(LiveDataParserPanel.class);
|
private static final Logging log = getLogging(LiveDataParserPanel.class);
|
||||||
|
|
||||||
{
|
static {
|
||||||
// log.configureDebugEnabled(true);
|
// log.configureDebugEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ public class LiveDataParserPanel {
|
||||||
//log.error("BAD condition, should be variable: " + name);
|
//log.error("BAD condition, should be variable: " + name);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
double number = f.getValue(new ConfigurationImage(bytes)).doubleValue();
|
double number = f.getValue(new ConfigurationImage(bytes));
|
||||||
if (log.debugEnabled()) {
|
if (log.debugEnabled()) {
|
||||||
log.debug("getValue(" + name + "): " + number);
|
log.debug("getValue(" + name + "): " + number);
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,8 +82,8 @@ public class BinarySensorLog implements SensorLog {
|
||||||
|
|
||||||
byte[] byteArray = baos.toByteArray();
|
byte[] byteArray = baos.toByteArray();
|
||||||
byte checkSum = 0;
|
byte checkSum = 0;
|
||||||
for (int i = 0; i < byteArray.length; i++) {
|
for (byte b : byteArray) {
|
||||||
checkSum += byteArray[i];
|
checkSum += b;
|
||||||
}
|
}
|
||||||
stream.write(byteArray);
|
stream.write(byteArray);
|
||||||
stream.write(checkSum);
|
stream.write(checkSum);
|
||||||
|
|
|
@ -267,7 +267,7 @@ public class ConsoleTools {
|
||||||
|
|
||||||
private static void readTune() {
|
private static void readTune() {
|
||||||
startAndConnect(linkManager -> {
|
startAndConnect(linkManager -> {
|
||||||
System.out.println("Loaded! Exiting");;
|
System.out.println("Loaded! Exiting");
|
||||||
System.exit(0);
|
System.exit(0);
|
||||||
return null;
|
return null;
|
||||||
});
|
});
|
||||||
|
@ -377,8 +377,10 @@ public class ConsoleTools {
|
||||||
EngineState.ValueCallback<String> callback = new EngineState.ValueCallback<String>() {
|
EngineState.ValueCallback<String> callback = new EngineState.ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(String value) {
|
public void onUpdate(String value) {
|
||||||
if (value.startsWith(Fields.PROTOCOL_HELLO_PREFIX))
|
if (value.startsWith(Fields.PROTOCOL_HELLO_PREFIX)) {
|
||||||
messages.append(value + "\n");
|
messages.append(value);
|
||||||
|
messages.append("\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
while (!unpack.isEmpty()) {
|
while (!unpack.isEmpty()) {
|
||||||
|
|
|
@ -38,7 +38,7 @@ public class ChartRepository {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface ChartRepositoryListener {
|
public interface ChartRepositoryListener {
|
||||||
public void onDigitalChart(String chart);
|
void onDigitalChart(String chart);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChartScrollControl createControls(final ChartRepositoryListener listener) {
|
public ChartScrollControl createControls(final ChartRepositoryListener listener) {
|
||||||
|
|
|
@ -44,13 +44,12 @@ public class FuelTunePane {
|
||||||
|
|
||||||
|
|
||||||
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
|
private final List<FuelDataPoint> incomingDataPoints = new ArrayList<>();
|
||||||
private final double veLoadBins[] = new double[Fields.FUEL_LOAD_COUNT];
|
private final double[] veLoadBins = new double[Fields.FUEL_LOAD_COUNT];
|
||||||
private final double veRpmBins[] = new double[Fields.FUEL_RPM_COUNT];
|
private final double[] veRpmBins = new double[Fields.FUEL_RPM_COUNT];
|
||||||
private final Table3D veTable = new Table3D();
|
private final Table3D veTable = new Table3D();
|
||||||
private final Table3D changeMap = new Table3D();
|
private final Table3D changeMap = new Table3D();
|
||||||
private final JButton upload = new JButton("Upload");
|
private final JButton upload = new JButton("Upload");
|
||||||
private final JCheckBox collect = new JCheckBox("enable");
|
private final JCheckBox collect = new JCheckBox("enable");
|
||||||
private final JButton clean = new JButton("clear");
|
|
||||||
private final UIContext uiContext;
|
private final UIContext uiContext;
|
||||||
private byte[] newVeMap;
|
private byte[] newVeMap;
|
||||||
private DataOutputStream dos;
|
private DataOutputStream dos;
|
||||||
|
@ -72,6 +71,7 @@ public class FuelTunePane {
|
||||||
uploadCurrentResult();
|
uploadCurrentResult();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
final JButton clean = new JButton("clear");
|
||||||
clean.addActionListener(new ActionListener() {
|
clean.addActionListener(new ActionListener() {
|
||||||
@Override
|
@Override
|
||||||
public void actionPerformed(ActionEvent e) {
|
public void actionPerformed(ActionEvent e) {
|
||||||
|
@ -190,7 +190,7 @@ public class FuelTunePane {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void doJob() {
|
private void doJob() {
|
||||||
double veTable[][] = new double[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
|
double[][] veTable = new double[Fields.FUEL_LOAD_COUNT][Fields.FUEL_RPM_COUNT];
|
||||||
loadMap(veTable, Fields.VETABLE.getOffset());
|
loadMap(veTable, Fields.VETABLE.getOffset());
|
||||||
logMap("source", veTable);
|
logMap("source", veTable);
|
||||||
|
|
||||||
|
|
|
@ -58,13 +58,12 @@ public class EngineSnifferPanel {
|
||||||
public Dimension getPreferredSize() {
|
public Dimension getPreferredSize() {
|
||||||
Dimension d = chartPanel.getSize();
|
Dimension d = chartPanel.getSize();
|
||||||
Dimension s = super.getPreferredSize();
|
Dimension s = super.getPreferredSize();
|
||||||
Dimension dimension = new Dimension((int) (d.width * zoomControl.getZoomProvider().getZoomValue()), s.height);
|
return new Dimension((int) (d.width * zoomControl.getZoomProvider().getZoomValue()), s.height);
|
||||||
return dimension;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private final ZoomControl zoomControl = new ZoomControl();
|
private final ZoomControl zoomControl = new ZoomControl();
|
||||||
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel();
|
||||||
private final UpDownImage crank = createImage(Fields.PROTOCOL_CRANK1);
|
private final UpDownImage crank = createImage(Fields.PROTOCOL_CRANK1);
|
||||||
private final ChartScrollControl scrollControl;
|
private final ChartScrollControl scrollControl;
|
||||||
private AnyCommand command;
|
private AnyCommand command;
|
||||||
|
@ -114,12 +113,7 @@ public class EngineSnifferPanel {
|
||||||
|
|
||||||
upperPanel.add(zoomControl);
|
upperPanel.add(zoomControl);
|
||||||
|
|
||||||
scrollControl = ChartRepository.getInstance().createControls(new ChartRepository.ChartRepositoryListener() {
|
scrollControl = ChartRepository.getInstance().createControls(chart -> displayChart(chart));
|
||||||
@Override
|
|
||||||
public void onDigitalChart(String chart) {
|
|
||||||
displayChart(chart);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (uiContext.getLinkManager().isLogViewer())
|
if (uiContext.getLinkManager().isLogViewer())
|
||||||
upperPanel.add(scrollControl.getContent());
|
upperPanel.add(scrollControl.getContent());
|
||||||
|
|
||||||
|
@ -145,15 +139,12 @@ public class EngineSnifferPanel {
|
||||||
chartPanel.add(pane, BorderLayout.CENTER);
|
chartPanel.add(pane, BorderLayout.CENTER);
|
||||||
chartPanel.add(bottomPanel, BorderLayout.SOUTH);
|
chartPanel.add(bottomPanel, BorderLayout.SOUTH);
|
||||||
|
|
||||||
zoomControl.listener = new ZoomControl.ZoomControlListener() {
|
zoomControl.listener = () -> {
|
||||||
@Override
|
System.out.println("onZoomChange");
|
||||||
public void onZoomChange() {
|
/**
|
||||||
System.out.println("onZoomChange");
|
* We have scroll pane size which depends on zoom, that's a long chain of dependencies
|
||||||
/**
|
*/
|
||||||
* We have scroll pane size which depends on zoom, that's a long chain of dependencies
|
UiUtils.trueLayout(imagePanel.getParent());
|
||||||
*/
|
|
||||||
UiUtils.trueLayout(imagePanel.getParent());
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
resetImagePanel();
|
resetImagePanel();
|
||||||
|
@ -180,7 +171,7 @@ public class EngineSnifferPanel {
|
||||||
engineState.registerStringValueAction(Fields.PROTOCOL_OUTPIN, new EngineState.ValueCallback<String>() {
|
engineState.registerStringValueAction(Fields.PROTOCOL_OUTPIN, new EngineState.ValueCallback<String>() {
|
||||||
@Override
|
@Override
|
||||||
public void onUpdate(String value) {
|
public void onUpdate(String value) {
|
||||||
String pinInfo[] = value.split("@");
|
String[] pinInfo = value.split("@");
|
||||||
if (pinInfo.length != 2)
|
if (pinInfo.length != 2)
|
||||||
return;
|
return;
|
||||||
String channel = pinInfo[0];
|
String channel = pinInfo[0];
|
||||||
|
|
|
@ -54,10 +54,7 @@ public class EngineSnifferStatusPanel {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
private ZoomProvider zoomProvider;
|
public EngineSnifferStatusPanel() {
|
||||||
|
|
||||||
public EngineSnifferStatusPanel(ZoomProvider zoomProvider) {
|
|
||||||
this.zoomProvider = zoomProvider;
|
|
||||||
infoPanel.add(new JLabel("X: "));
|
infoPanel.add(new JLabel("X: "));
|
||||||
infoPanel.add(xLabel);
|
infoPanel.add(xLabel);
|
||||||
infoPanel.add(new JLabel(" time: "));
|
infoPanel.add(new JLabel(" time: "));
|
||||||
|
|
|
@ -52,11 +52,7 @@ public class InternetStatus {
|
||||||
HttpURLConnection urlConn = (HttpURLConnection) urlServer.openConnection();
|
HttpURLConnection urlConn = (HttpURLConnection) urlServer.openConnection();
|
||||||
urlConn.setConnectTimeout(3000); //<- 3Seconds Timeout
|
urlConn.setConnectTimeout(3000); //<- 3Seconds Timeout
|
||||||
urlConn.connect();
|
urlConn.connect();
|
||||||
if (urlConn.getResponseCode() == 200) {
|
return urlConn.getResponseCode() == 200;
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,15 +20,11 @@ import static com.rusefi.StartupFrame.createLogoLabel;
|
||||||
|
|
||||||
public class LightweightGUI {
|
public class LightweightGUI {
|
||||||
|
|
||||||
private final UIContext uiContext;
|
|
||||||
private FrameHelper frameHelper = new FrameHelper();
|
|
||||||
private JPanel content = new JPanel(new BorderLayout());
|
|
||||||
|
|
||||||
private JPanel connectedPanel = new JPanel();
|
private JPanel connectedPanel = new JPanel();
|
||||||
private JLabel connectedLabel = new JLabel();
|
private JLabel connectedLabel = new JLabel();
|
||||||
|
|
||||||
public LightweightGUI(UIContext uiContext) {
|
public LightweightGUI(UIContext uiContext) {
|
||||||
this.uiContext = uiContext;
|
final FrameHelper frameHelper = new FrameHelper();
|
||||||
frameHelper.getFrame().setTitle("rusEFI Lightweight " + rusEFIVersion.CONSOLE_VERSION);
|
frameHelper.getFrame().setTitle("rusEFI Lightweight " + rusEFIVersion.CONSOLE_VERSION);
|
||||||
|
|
||||||
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
JPanel topPanel = new JPanel(new FlowLayout(FlowLayout.RIGHT));
|
||||||
|
@ -48,12 +44,12 @@ public class LightweightGUI {
|
||||||
SensorCentral.getInstance().addListener(Sensor.FIRMWARE_VERSION, value -> firmwareVersion.setText(Integer.toString((int) value)));
|
SensorCentral.getInstance().addListener(Sensor.FIRMWARE_VERSION, value -> firmwareVersion.setText(Integer.toString((int) value)));
|
||||||
leftPanel.add(firmwareVersion);
|
leftPanel.add(firmwareVersion);
|
||||||
|
|
||||||
|
final JPanel content = new JPanel(new BorderLayout());
|
||||||
content.add(topPanel, BorderLayout.NORTH);
|
content.add(topPanel, BorderLayout.NORTH);
|
||||||
content.add(leftPanel, BorderLayout.WEST);
|
content.add(leftPanel, BorderLayout.WEST);
|
||||||
|
|
||||||
content.add(createLogoUrlPanel(), BorderLayout.EAST);
|
content.add(createLogoUrlPanel(), BorderLayout.EAST);
|
||||||
|
|
||||||
|
|
||||||
frameHelper.showFrame(content, true);
|
frameHelper.showFrame(content, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue