ETB quality instrumentation #494
This commit is contained in:
parent
d9c31bd6bd
commit
5ee54c3fe5
|
@ -45,7 +45,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20190420;
|
||||
public static final int CONSOLE_VERSION = 20190423;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
@ -160,6 +160,7 @@ public class Launcher {
|
|||
}
|
||||
if (!LinkManager.isLogViewer()) {
|
||||
tabbedPane.add("Bench Test", new BenchTestPane().getContent());
|
||||
tabbedPane.add("ETB", new ETBPane().getContent());
|
||||
tabbedPane.add("Presets", new PresetsPane().getContent());
|
||||
}
|
||||
|
||||
|
|
|
@ -34,4 +34,8 @@ public abstract class TestSequenceStep {
|
|||
next = step;
|
||||
return next;
|
||||
}
|
||||
|
||||
public TestSequenceStep getNext() {
|
||||
return next;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package com.rusefi.ui.etb;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.putgemin.VerticalFlowLayout;
|
||||
|
||||
import javax.swing.*;
|
||||
|
@ -9,11 +10,18 @@ public class CalibrationPanel {
|
|||
|
||||
public CalibrationPanel() {
|
||||
content.setBorder(BorderFactory.createTitledBorder("Calibration"));
|
||||
content.add(new JButton("Grab TPS#1 fully closed"));
|
||||
content.add(new JButton("Grab TPS#1 Wide Open"));
|
||||
content.add(createCommandButton("Grab TPS#1 fully closed"));
|
||||
content.add(createCommandButton("Grab TPS#1 Wide Open"));
|
||||
|
||||
content.add(new JButton("Grab Pedal Up"));
|
||||
content.add(new JButton("Grab Pedal Down"));
|
||||
content.add(createCommandButton("Grab Pedal Up"));
|
||||
content.add(createCommandButton("Grab Pedal Down"));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private JButton createCommandButton(String s) {
|
||||
JButton button = new JButton(s);
|
||||
button.setEnabled(false);
|
||||
return button;
|
||||
}
|
||||
|
||||
public JPanel getContent() {
|
||||
|
|
|
@ -29,8 +29,8 @@ public class CommandsPanel {
|
|||
content.setBorder(BorderFactory.createTitledBorder("Commands"));
|
||||
|
||||
content.add(testParameters);
|
||||
content.add(UiUtils.wrap(new EtbMonteCarloSequence().getButton()));
|
||||
content.add(UiUtils.wrap(new MagicSpotsFinder().getButton()));
|
||||
// content.add(UiUtils.wrap(new EtbMonteCarloSequence().getButton()));
|
||||
// content.add(UiUtils.wrap(new MagicSpotsFinder().getButton()));
|
||||
}
|
||||
|
||||
public JPanel getContent() {
|
||||
|
|
|
@ -41,6 +41,7 @@ public class EtbTestSequence {
|
|||
StandardTestSequence.metric.start(/* buffer size: */3000, /*period, ms: */ 100);
|
||||
|
||||
AtomicInteger stepCounter = new AtomicInteger();
|
||||
AtomicInteger totalSteps = new AtomicInteger();
|
||||
|
||||
TestSequenceStep lastStep = new TestSequenceStep(SECOND) {
|
||||
@Override
|
||||
|
@ -48,24 +49,42 @@ public class EtbTestSequence {
|
|||
button.setEnabled(true);
|
||||
button.setText(BUTTON_TEXT);
|
||||
double value = StandardTestSequence.metric.getStandardDeviation();
|
||||
result.setText(String.format("Result: %.3f", value));
|
||||
result.setText(String.format("Final Result: %.3f", value));
|
||||
}
|
||||
};
|
||||
|
||||
Runnable onEachStep = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SwingUtilities.invokeLater(() -> button.setText("Running " + stepCounter.incrementAndGet()));
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
String state = stepCounter.incrementAndGet() + "/" + totalSteps.get();
|
||||
button.setText("Running " + state);
|
||||
double value = StandardTestSequence.metric.getStandardDeviation();
|
||||
result.setText(String.format(state + " Result: %.3f", value));
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
TestSequenceStep firstStep = new EtbTarget(10 * SECOND, 4, /*position*/onEachStep);
|
||||
TestSequenceStep result = StandardTestSequence.addSequence(firstStep, onEachStep);
|
||||
result.addNext(lastStep);
|
||||
|
||||
totalSteps.set(count(firstStep));
|
||||
|
||||
firstStep.execute(executor);
|
||||
});
|
||||
}
|
||||
|
||||
private static int count(TestSequenceStep step) {
|
||||
int result = 0;
|
||||
while ((step = step.getNext()) != null)
|
||||
result++;
|
||||
return result;
|
||||
}
|
||||
|
||||
public JButton getButton() {
|
||||
return button;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue