refactoring

This commit is contained in:
rusefi 2020-05-26 01:32:17 -04:00
parent 7cec254bb0
commit b2aebdab38
3 changed files with 13 additions and 12 deletions

View File

@ -0,0 +1,9 @@
package com.rusefi.ui.engine;
import java.util.HashMap;
public enum ChannelNaming {
INSTANCE;
public final HashMap<String, String> channelName2PhysicalPin = new HashMap<>();
}

View File

@ -16,7 +16,6 @@ import com.rusefi.ui.widgets.AnyCommand;
import com.rusefi.waves.EngineChart;
import com.rusefi.waves.EngineChartParser;
import com.rusefi.waves.EngineReport;
import com.rusefi.waves.RevolutionLog;
import javax.swing.*;
import java.awt.*;
@ -70,8 +69,6 @@ public class EngineSnifferPanel {
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
private final UpDownImage crank = createImage(Fields.PROTOCOL_CRANK1);
private final ChartScrollControl scrollControl;
// todo: move it some sort of a singleton?
public final HashMap<String, String> channelName2PhysicalPin = new HashMap<>();
private AnyCommand command;
private boolean isPaused;
@ -193,7 +190,7 @@ public class EngineSnifferPanel {
String channel = pinInfo[0];
String pin = pinInfo[1];
UpDownImage image = images.get(channel);
channelName2PhysicalPin.put(channel, pin);
ChannelNaming.INSTANCE.channelName2PhysicalPin.put(channel, pin);
if (image != null)
image.setPhysicalPin(pin);
}

View File

@ -1,6 +1,5 @@
package com.rusefi.ui.engine;
import com.rusefi.Launcher;
import com.rusefi.config.generated.Fields;
import com.rusefi.core.Sensor;
import com.rusefi.core.SensorCentral;
@ -65,13 +64,9 @@ public class UpDownImage extends JPanel {
public UpDownImage(final String name) {
this(EngineReport.MOCK, name);
setToolTip();
// this code is horrible, I am in a rush :(
EngineSnifferPanel p = Launcher.engineSnifferPanel;
if (p != null) {
String pin = p.channelName2PhysicalPin.get(name);
if (pin != null)
setPhysicalPin(pin);
}
String pin = ChannelNaming.INSTANCE.channelName2PhysicalPin.get(name);
if (pin != null)
setPhysicalPin(pin);
}
public void setSignalBody(Color signalBody) {