refactoring
This commit is contained in:
parent
7cec254bb0
commit
b2aebdab38
|
@ -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<>();
|
||||||
|
}
|
|
@ -16,7 +16,6 @@ import com.rusefi.ui.widgets.AnyCommand;
|
||||||
import com.rusefi.waves.EngineChart;
|
import com.rusefi.waves.EngineChart;
|
||||||
import com.rusefi.waves.EngineChartParser;
|
import com.rusefi.waves.EngineChartParser;
|
||||||
import com.rusefi.waves.EngineReport;
|
import com.rusefi.waves.EngineReport;
|
||||||
import com.rusefi.waves.RevolutionLog;
|
|
||||||
|
|
||||||
import javax.swing.*;
|
import javax.swing.*;
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
|
@ -70,8 +69,6 @@ public class EngineSnifferPanel {
|
||||||
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
private final EngineSnifferStatusPanel statusPanel = new EngineSnifferStatusPanel(zoomControl.getZoomProvider());
|
||||||
private final UpDownImage crank = createImage(Fields.PROTOCOL_CRANK1);
|
private final UpDownImage crank = createImage(Fields.PROTOCOL_CRANK1);
|
||||||
private final ChartScrollControl scrollControl;
|
private final ChartScrollControl scrollControl;
|
||||||
// todo: move it some sort of a singleton?
|
|
||||||
public final HashMap<String, String> channelName2PhysicalPin = new HashMap<>();
|
|
||||||
private AnyCommand command;
|
private AnyCommand command;
|
||||||
|
|
||||||
private boolean isPaused;
|
private boolean isPaused;
|
||||||
|
@ -193,7 +190,7 @@ public class EngineSnifferPanel {
|
||||||
String channel = pinInfo[0];
|
String channel = pinInfo[0];
|
||||||
String pin = pinInfo[1];
|
String pin = pinInfo[1];
|
||||||
UpDownImage image = images.get(channel);
|
UpDownImage image = images.get(channel);
|
||||||
channelName2PhysicalPin.put(channel, pin);
|
ChannelNaming.INSTANCE.channelName2PhysicalPin.put(channel, pin);
|
||||||
if (image != null)
|
if (image != null)
|
||||||
image.setPhysicalPin(pin);
|
image.setPhysicalPin(pin);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
package com.rusefi.ui.engine;
|
package com.rusefi.ui.engine;
|
||||||
|
|
||||||
import com.rusefi.Launcher;
|
|
||||||
import com.rusefi.config.generated.Fields;
|
import com.rusefi.config.generated.Fields;
|
||||||
import com.rusefi.core.Sensor;
|
import com.rusefi.core.Sensor;
|
||||||
import com.rusefi.core.SensorCentral;
|
import com.rusefi.core.SensorCentral;
|
||||||
|
@ -65,13 +64,9 @@ public class UpDownImage extends JPanel {
|
||||||
public UpDownImage(final String name) {
|
public UpDownImage(final String name) {
|
||||||
this(EngineReport.MOCK, name);
|
this(EngineReport.MOCK, name);
|
||||||
setToolTip();
|
setToolTip();
|
||||||
// this code is horrible, I am in a rush :(
|
String pin = ChannelNaming.INSTANCE.channelName2PhysicalPin.get(name);
|
||||||
EngineSnifferPanel p = Launcher.engineSnifferPanel;
|
if (pin != null)
|
||||||
if (p != null) {
|
setPhysicalPin(pin);
|
||||||
String pin = p.channelName2PhysicalPin.get(name);
|
|
||||||
if (pin != null)
|
|
||||||
setPhysicalPin(pin);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSignalBody(Color signalBody) {
|
public void setSignalBody(Color signalBody) {
|
||||||
|
|
Loading…
Reference in New Issue