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