refactoring: inlining constant, explicit helper API
This commit is contained in:
parent
25d42b7b84
commit
a69b80d14c
|
@ -130,7 +130,7 @@ public class TestingUtils {
|
|||
final AtomicReference<String> result = new AtomicReference<>();
|
||||
|
||||
FileLog.MAIN.logLine("waiting for next chart");
|
||||
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(EngineReport.ENGINE_CHART, new EngineState.ValueCallback<String>() {
|
||||
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(Fields.PROTOCOL_ENGINE_SNIFFER, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
engineChartLatch.countDown();
|
||||
|
@ -141,9 +141,13 @@ public class TestingUtils {
|
|||
long waitStartTime = System.currentTimeMillis();
|
||||
IoUtil.wait(engineChartLatch, timeoutMs);
|
||||
log.info("got next chart in " + (System.currentTimeMillis() - waitStartTime) + "ms for engine_type " + EcuTestHelper.currentEngineType);
|
||||
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(EngineReport.ENGINE_CHART, (EngineState.ValueCallback<String>) EngineState.ValueCallback.VOID);
|
||||
installVoidEngineSnifferAction(commandQueue);
|
||||
if (result.get() == null)
|
||||
throw new IllegalStateException("Chart timeout: " + timeoutMs);
|
||||
return result.get();
|
||||
}
|
||||
|
||||
private static void installVoidEngineSnifferAction(CommandQueue commandQueue) {
|
||||
commandQueue.getLinkManager().getEngineState().replaceStringValueAction(Fields.PROTOCOL_ENGINE_SNIFFER, (EngineState.ValueCallback<String>) EngineState.ValueCallback.VOID);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@ import static com.rusefi.config.generated.Fields.PROTOCOL_ES_UP;
|
|||
* @see SensorSnifferPane
|
||||
*/
|
||||
public class EngineReport {
|
||||
public static final String ENGINE_CHART = Fields.PROTOCOL_ENGINE_SNIFFER;
|
||||
public static final EngineReport MOCK = new EngineReport(Collections.singletonList(new UpDown(0, -1, 1, -1, Double.NaN, Double.NaN)));
|
||||
/**
|
||||
* number of Engine Sniffer ticks per ms
|
||||
|
|
|
@ -153,7 +153,7 @@ public class EngineSnifferPanel {
|
|||
|
||||
resetImagePanel();
|
||||
|
||||
uiContext.getLinkManager().getEngineState().registerStringValueAction(EngineReport.ENGINE_CHART, new EngineState.ValueCallback<String>() {
|
||||
uiContext.getLinkManager().getEngineState().registerStringValueAction(Fields.PROTOCOL_ENGINE_SNIFFER, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
if (isPaused)
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.rusefi.ui.logview;
|
|||
import com.opensr5.Logger;
|
||||
import com.rusefi.ConsoleUI;
|
||||
import com.rusefi.FileLog;
|
||||
import com.rusefi.config.generated.Fields;
|
||||
import com.rusefi.core.EngineState;
|
||||
import com.rusefi.file.FileUtils;
|
||||
import com.rusefi.ui.ChartRepository;
|
||||
|
@ -182,7 +183,7 @@ public class LogViewer extends JPanel {
|
|||
EngineState engineState = new EngineState(listener);
|
||||
// this is pretty dirty, better OOP desperately needed
|
||||
ConsoleUI.engineSnifferPanel.setOutpinListener(engineState);
|
||||
engineState.registerStringValueAction(EngineReport.ENGINE_CHART, new EngineState.ValueCallback<String>() {
|
||||
engineState.registerStringValueAction(Fields.PROTOCOL_ENGINE_SNIFFER, new EngineState.ValueCallback<String>() {
|
||||
@Override
|
||||
public void onUpdate(String value) {
|
||||
FileLog.MAIN.logLine("Got wave_chart: " + value);
|
||||
|
|
Loading…
Reference in New Issue