mirror of https://github.com/rusefi/RomRaider.git
updated profile loading
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@408 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
7f53701837
commit
59e507c942
|
@ -22,7 +22,8 @@
|
|||
</resources>
|
||||
|
||||
<panels>
|
||||
<!-- <panel classname="HelloPanel"/>
-->
|
||||
<!-- <panel classname="HelloPanel"/>
|
||||
-->
|
||||
<panel classname="InfoPanel"/>
|
||||
<panel classname="LicencePanel"/>
|
||||
<panel classname="TargetPanel"/>
|
||||
|
@ -37,15 +38,14 @@
|
|||
<description>Enginuity binary files</description>
|
||||
<file src="Enginuity.jar" targetdir="$INSTALL_PATH" />
|
||||
<file src="license.txt" targetdir="$INSTALL_PATH" />
|
||||
<file src="release notes.txt" targetdir="$INSTALL_PATH" />
|
||||
<file src="images" targetdir="$INSTALL_PATH" />
|
||||
<file src="release notes.txt" targetdir="$INSTALL_PATH" />
|
||||
<file src="images" targetdir="$INSTALL_PATH" />
|
||||
<fileset dir="graphics" targetdir="$INSTALL_PATH/graphics" excludes="*.bmp" />
|
||||
|
||||
<!-- Logger files -->
|
||||
<file src="logger.xml" targetdir="$INSTALL_PATH" />
|
||||
<file src="logger.dtd" targetdir="$INSTALL_PATH" />
|
||||
<!-- Removed until 0.4.1b
|
||||
<file src="profile.xml" targetdir="$INSTALL_PATH" />
|
||||
<file src="profile.dtd" targetdir="$INSTALL_PATH" />
|
||||
-->
|
||||
|
||||
|
@ -78,13 +78,13 @@
|
|||
<file src="lib/logger/rxtx/INSTALL" targetdir="$INSTALL_PATH/lib" />
|
||||
<file src="lib/logger/rxtx/RXTXcomm.jar" targetdir="$INSTALL_PATH/lib" />
|
||||
<file src="lib/logger/rxtx/rxtxSerial.dll" targetdir="$INSTALL_PATH/lib" />
|
||||
|
||||
|
||||
</pack>
|
||||
<!-- END Base Pack -->
|
||||
|
||||
|
||||
<pack name="ECU Definitions" required="no">
|
||||
<description>The latest official ECU definitions</description>
|
||||
<file src="ecu_defs.xml" targetdir="$INSTALL_PATH"/>
|
||||
<file src="ecu_defs.xml" targetdir="$INSTALL_PATH"/>
|
||||
</pack>
|
||||
|
||||
<pack name="Source Files" required="no">
|
||||
|
|
|
@ -22,7 +22,8 @@
|
|||
</resources>
|
||||
|
||||
<panels>
|
||||
<!-- <panel classname="HelloPanel"/>
-->
|
||||
<!-- <panel classname="HelloPanel"/>
|
||||
-->
|
||||
<panel classname="InfoPanel"/>
|
||||
<panel classname="LicencePanel"/>
|
||||
<panel classname="TargetPanel"/>
|
||||
|
@ -38,15 +39,14 @@
|
|||
<file src="Enginuity.exe" targetdir="$INSTALL_PATH" os="windows" />
|
||||
<file src="Enginuity.jar" targetdir="$INSTALL_PATH" />
|
||||
<file src="license.txt" targetdir="$INSTALL_PATH" />
|
||||
<file src="release notes.txt" targetdir="$INSTALL_PATH" />
|
||||
<file src="images" targetdir="$INSTALL_PATH" />
|
||||
<file src="release notes.txt" targetdir="$INSTALL_PATH" />
|
||||
<file src="images" targetdir="$INSTALL_PATH" />
|
||||
<fileset dir="graphics" targetdir="$INSTALL_PATH/graphics" excludes="*.bmp" />
|
||||
|
||||
<!-- Logger files -->
|
||||
<file src="logger.xml" targetdir="$INSTALL_PATH" />
|
||||
<file src="logger.dtd" targetdir="$INSTALL_PATH" />
|
||||
<!-- Removed until 0.4.1b
|
||||
<file src="profile.xml" targetdir="$INSTALL_PATH" />
|
||||
<file src="profile.dtd" targetdir="$INSTALL_PATH" />
|
||||
-->
|
||||
|
||||
|
@ -75,13 +75,13 @@
|
|||
<file src="lib/logger/rxtx/INSTALL" targetdir="$INSTALL_PATH/lib" />
|
||||
<file src="lib/logger/rxtx/RXTXcomm.jar" targetdir="$INSTALL_PATH/lib" />
|
||||
<file src="lib/logger/rxtx/rxtxSerial.dll" targetdir="$INSTALL_PATH/lib" />
|
||||
|
||||
|
||||
</pack>
|
||||
<!-- END Base Pack -->
|
||||
|
||||
|
||||
<pack name="ECU Definitions" required="no">
|
||||
<description>The latest official ECU definitions</description>
|
||||
<file src="ecu_defs.xml" targetdir="$INSTALL_PATH"/>
|
||||
<file src="ecu_defs.xml" targetdir="$INSTALL_PATH"/>
|
||||
</pack>
|
||||
|
||||
<pack name="Source Files" required="no">
|
||||
|
|
23
logger.xml
23
logger.xml
|
@ -972,10 +972,7 @@
|
|||
<ecuparam id="E1" name="IAM" desc="Ignition Advance Multiplier">
|
||||
<address>
|
||||
<ecu id="3152584006">
|
||||
<byte>0xFFFFFF</byte>
|
||||
</ecu>
|
||||
<ecu id="3152584007,3152584008">
|
||||
<byte>0xEEEEEE</byte>
|
||||
<byte>0x008228</byte>
|
||||
</ecu>
|
||||
</address>
|
||||
<conversions>
|
||||
|
@ -983,30 +980,22 @@
|
|||
</conversions>
|
||||
</ecuparam>
|
||||
|
||||
<ecuparam id="E2" name="Engine Load (16bit)" desc="Engine Load (16bit)">
|
||||
<!--<ecuparam id="E2" name="Engine Load (16bit)" desc="Engine Load (16bit)">
|
||||
<address>
|
||||
<ecu id="1234567890,0123654789">
|
||||
<ecu id="1234567890">
|
||||
<byte>0xFFFFFF</byte>
|
||||
</ecu>
|
||||
</address>
|
||||
<conversions>
|
||||
<conversion units="grams" expr="x/32" format="0.00"/>
|
||||
</conversions>
|
||||
</ecuparam>
|
||||
</ecuparam>-->
|
||||
|
||||
<ecuparam id="E3" name="Engine Load (32bit)" desc="Engine Load (32bit)">
|
||||
<address>
|
||||
<ecu id="3152584006">
|
||||
<byte>0xFFFFFE</byte>
|
||||
<byte>0xFFFFFF</byte>
|
||||
</ecu>
|
||||
<ecu id="3152584007">
|
||||
<byte>0xFFFFFE</byte>
|
||||
<byte>0xFFFFFF</byte>
|
||||
</ecu>
|
||||
<ecu id="3152584008,3152584009">
|
||||
<byte>0xFFFFFE</byte>
|
||||
<byte>0xFFFFFF</byte>
|
||||
<byte>0x00A6FC</byte>
|
||||
<byte>0x00A6FD</byte>
|
||||
</ecu>
|
||||
</address>
|
||||
<conversions>
|
||||
|
|
|
@ -25,6 +25,6 @@ import java.util.Set;
|
|||
|
||||
public interface SerialPortRefreshListener {
|
||||
|
||||
void refreshPortList(Set<String> ports);
|
||||
void refreshPortList(Set<String> ports, String defaultSelectedPort);
|
||||
|
||||
}
|
||||
|
|
|
@ -33,19 +33,25 @@ public final class SerialPortRefresher implements Runnable {
|
|||
private static final long PORT_REFRESH_INTERVAL = 15000L;
|
||||
private final SerialPortDiscoverer serialPortDiscoverer = new SerialPortDiscovererImpl();
|
||||
private SerialPortRefreshListener listener;
|
||||
private final String defaultLoggerPort;
|
||||
|
||||
public SerialPortRefresher(SerialPortRefreshListener listener) {
|
||||
public SerialPortRefresher(SerialPortRefreshListener listener, String defaultLoggerPort) {
|
||||
checkNotNull(listener);
|
||||
this.listener = listener;
|
||||
this.defaultLoggerPort = defaultLoggerPort;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
while (true) {
|
||||
listener.refreshPortList(listSerialPorts());
|
||||
refreshPortList();
|
||||
ThreadUtil.sleep(PORT_REFRESH_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
private void refreshPortList() {
|
||||
listener.refreshPortList(listSerialPorts(), defaultLoggerPort);
|
||||
}
|
||||
|
||||
private Set<String> listSerialPorts() {
|
||||
List<CommPortIdentifier> portIdentifiers = serialPortDiscoverer.listPorts();
|
||||
Set<String> portNames = new TreeSet<String>();
|
||||
|
|
|
@ -132,11 +132,11 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
public EcuLogger(Settings settings) {
|
||||
super(ENGINUITY_ECU_LOGGER_TITLE);
|
||||
bootstrap(settings);
|
||||
startPortRefresherThread();
|
||||
initControllerListeners();
|
||||
initUserInterface();
|
||||
initDataUpdateHandlers();
|
||||
reloadUserProfile(settings.getLoggerProfileFilePath());
|
||||
startPortRefresherThread();
|
||||
if (!isLogging()) startLogging();
|
||||
}
|
||||
|
||||
|
@ -187,7 +187,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
}
|
||||
|
||||
private void startPortRefresherThread() {
|
||||
Thread portRefresherThread = new Thread(new SerialPortRefresher(portsComboBox));
|
||||
Thread portRefresherThread = new Thread(new SerialPortRefresher(portsComboBox, settings.getLoggerPort()));
|
||||
portRefresherThread.setDaemon(true);
|
||||
portRefresherThread.start();
|
||||
}
|
||||
|
@ -224,7 +224,7 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
private void loadUserProfile(EcuDataLoader dataLoader, String profileFilePath) {
|
||||
UserProfileLoader profileLoader = new UserProfileLoaderImpl();
|
||||
UserProfile profile = profileLoader.loadProfile(profileFilePath);
|
||||
setSelectedPort(profile);
|
||||
initSelectedPort(profile);
|
||||
List<EcuParameter> ecuParams = dataLoader.getEcuParameters();
|
||||
addConvertorUpdateListeners(ecuParams);
|
||||
clearParamTableModels();
|
||||
|
@ -233,12 +233,9 @@ public final class EcuLogger extends JFrame implements WindowListener, PropertyC
|
|||
loadEcuSwitches(dataLoader.getEcuSwitches(), profile);
|
||||
}
|
||||
|
||||
private void setSelectedPort(UserProfile profile) {
|
||||
private void initSelectedPort(UserProfile profile) {
|
||||
if (profile != null) {
|
||||
String serialPort = profile.getSerialPort();
|
||||
if (serialPort != null && serialPort.length() > 0) {
|
||||
portsComboBox.setSelectedItem(serialPort);
|
||||
}
|
||||
settings.setLoggerPort(profile.getSerialPort());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -55,6 +55,7 @@ public final class QueryManagerImpl implements QueryManager {
|
|||
private final EcuInitCallback ecuInitCallback;
|
||||
private final MessageListener messageListener;
|
||||
private Thread queryManagerThread;
|
||||
private boolean started;
|
||||
private boolean stop;
|
||||
|
||||
public QueryManagerImpl(Settings settings, EcuInitCallback ecuInitCallback, MessageListener messageListener) {
|
||||
|
@ -80,10 +81,11 @@ public final class QueryManagerImpl implements QueryManager {
|
|||
}
|
||||
|
||||
public boolean isRunning() {
|
||||
return !stop;
|
||||
return started && !stop;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
started = true;
|
||||
queryManagerThread = Thread.currentThread();
|
||||
System.out.println("QueryManager started.");
|
||||
try {
|
||||
|
|
|
@ -37,7 +37,7 @@ public final class SerialPortComboBox extends JComboBox implements SerialPortRef
|
|||
this.settings = settings;
|
||||
}
|
||||
|
||||
public void refreshPortList(Set<String> ports) {
|
||||
public void refreshPortList(Set<String> ports, String defaultSelectedPort) {
|
||||
checkNotNull(ports);
|
||||
boolean changeDetected = ports.isEmpty() || ports.size() != getItemCount();
|
||||
if (!changeDetected) {
|
||||
|
@ -63,6 +63,9 @@ public final class SerialPortComboBox extends JComboBox implements SerialPortRef
|
|||
}
|
||||
if (changeDetected) {
|
||||
String selectedPort = (String) getSelectedItem();
|
||||
if (selectedPort == null) {
|
||||
selectedPort = defaultSelectedPort;
|
||||
}
|
||||
removeAllItems();
|
||||
if (!ports.isEmpty()) {
|
||||
for (String port : ports) {
|
||||
|
|
Loading…
Reference in New Issue