mirror of https://github.com/rusefi/RomRaider.git
TXS Tuner Wideband plugin added curtosy of, nitros
git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@335 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
parent
bcea252c9d
commit
62516b605b
|
@ -0,0 +1 @@
|
|||
datasource.class=com.romraider.logger.external.txstuner.plugin.TxsTunerDataSource
|
52
src/com/romraider/logger/external/txstuner/io/TxsTunerConnectionProperties.java
vendored
Normal file
52
src/com/romraider/logger/external/txstuner/io/TxsTunerConnectionProperties.java
vendored
Normal file
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2010 RomRaider.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package com.romraider.logger.external.txstuner.io;
|
||||
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
|
||||
public final class TxsTunerConnectionProperties implements ConnectionProperties {
|
||||
public int getBaudRate() {
|
||||
return 19200;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
||||
public int getStopBits() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public int getParity() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int getConnectTimeout() {
|
||||
return 2000;
|
||||
}
|
||||
|
||||
public int getSendTimeout() {
|
||||
return 500;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,91 @@
|
|||
|
||||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2010 RomRaider.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package com.romraider.logger.external.txstuner.io;
|
||||
|
||||
import com.romraider.io.serial.connection.SerialConnection;
|
||||
import com.romraider.io.serial.connection.SerialConnectionImpl;
|
||||
import com.romraider.logger.external.txstuner.plugin.TxsTunerDataItem;
|
||||
import com.romraider.logger.external.core.Stoppable;
|
||||
|
||||
import static com.romraider.util.ParamChecker.isNullOrEmpty;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
|
||||
public final class TxsTunerRunner implements Stoppable {
|
||||
private static final Logger LOGGER = getLogger(TxsTunerRunner.class);
|
||||
private static final TxsTunerConnectionProperties CONNECTION_PROPS = new TxsTunerConnectionProperties();
|
||||
private static final String TXS_TUNER = "t";
|
||||
private static final String TXS_LOGGER = "1";
|
||||
private static final String SPLIT_DELIMITER = " ";
|
||||
private final SerialConnection connection;
|
||||
private final TxsTunerDataItem dataItem;
|
||||
private boolean stop;
|
||||
|
||||
public TxsTunerRunner(String port, TxsTunerDataItem dataItem) {
|
||||
this.connection = new SerialConnectionImpl(port, CONNECTION_PROPS);
|
||||
this.dataItem = dataItem;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
|
||||
byte[] tuner = TXS_TUNER.getBytes();
|
||||
byte[] logger = TXS_LOGGER.getBytes();
|
||||
|
||||
//Send T to switch to tuner if connected to utec.
|
||||
connection.write(tuner);
|
||||
String response = connection.readLine();
|
||||
LOGGER.trace("TXS Tuner Response: " + response);
|
||||
|
||||
//Start TXS tuner logger
|
||||
connection.write(logger);
|
||||
response = connection.readLine();
|
||||
LOGGER.trace("TXS Tuner Response: " + response);
|
||||
|
||||
while (!stop) {
|
||||
response = connection.readLine();
|
||||
LOGGER.trace("TXS Tuner Response: " + response);
|
||||
if (!isNullOrEmpty(response)) dataItem.setData(parseString(response));
|
||||
}
|
||||
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("Error occurred", t);
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
stop = true;
|
||||
connection.close();
|
||||
}
|
||||
|
||||
private double parseString(String value){
|
||||
try{
|
||||
value = value.trim();
|
||||
String[] substr = value.split(SPLIT_DELIMITER);
|
||||
return Double.parseDouble(substr[0]);
|
||||
}
|
||||
catch (Exception e){
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,49 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2010 RomRaider.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package com.romraider.logger.external.txstuner.plugin;
|
||||
|
||||
import com.romraider.logger.external.core.DataListener;
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
|
||||
public final class TxsTunerDataItem implements ExternalDataItem, DataListener {
|
||||
|
||||
private double data;
|
||||
|
||||
public String getName() {
|
||||
return "TXS Tuner AFR";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "TXS Tuner AFR data";
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return "AFR";
|
||||
}
|
||||
|
||||
public double getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(double data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,73 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2010 RomRaider.com
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
*/
|
||||
|
||||
package com.romraider.logger.external.txstuner.plugin;
|
||||
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.external.txstuner.io.TxsTunerRunner;
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
import com.romraider.logger.external.core.ExternalDataSource;
|
||||
import static com.romraider.util.ThreadUtil.runAsDaemon;
|
||||
import static java.util.Arrays.asList;
|
||||
import javax.swing.Action;
|
||||
import java.util.List;
|
||||
|
||||
public class TxsTunerDataSource implements ExternalDataSource {
|
||||
|
||||
private TxsTunerDataItem dataItem = new TxsTunerDataItem();
|
||||
private TxsTunerRunner runner;
|
||||
private String port;
|
||||
|
||||
public String getId() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "TXS Tuner AFR";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "0.01";
|
||||
}
|
||||
|
||||
public List<? extends ExternalDataItem> getDataItems() {
|
||||
return asList(dataItem);
|
||||
}
|
||||
|
||||
public Action getMenuAction(EcuLogger logger) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setPort(String port) {
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
runner = new TxsTunerRunner(port, dataItem);
|
||||
runAsDaemon(runner);
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (runner != null) runner.stop();
|
||||
}
|
||||
}
|
|
@ -56,6 +56,7 @@
|
|||
<file src="plugins/mrf.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/plx.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/te.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/txs_tuner.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/zt2.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
|
||||
<fileset dir="lib/common" targetdir="$INSTALL_PATH/lib/common"/>
|
||||
|
@ -64,11 +65,13 @@
|
|||
<updatecheck>
|
||||
<include name="plugins/**"/>
|
||||
<exclude name="plugins/aem.plugin"/>
|
||||
<exclude name="plugins/aem2.plugin"/>
|
||||
<exclude name="plugins/fourteenpoint7.plugin"/>
|
||||
<exclude name="plugins/innovate.plugin"/>
|
||||
<exclude name="plugins/lm2_mts.plugin"/>
|
||||
<exclude name="plugins/mrf.plugin"/>
|
||||
<exclude name="plugins/plx.plugin"/>
|
||||
<exclude name="plugins/te.plugin"/>
|
||||
<exclude name="plugins/txs_tuner.plugin"/>
|
||||
<exclude name="plugins/zt2.plugin"/>
|
||||
</updatecheck>
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<file src="plugins/mrf.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/plx.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/te.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/txs_tuner.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/zt2.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
|
||||
<fileset dir="lib/common" targetdir="$INSTALL_PATH/lib/common"/>
|
||||
|
@ -66,11 +67,14 @@
|
|||
<updatecheck>
|
||||
<include name="plugins/**"/>
|
||||
<exclude name="plugins/aem.plugin"/>
|
||||
<exclude name="plugins/aem2.plugin"/>
|
||||
<exclude name="plugins/fourteenpoint7.plugin"/>
|
||||
<exclude name="plugins/innovate.plugin"/>
|
||||
<exclude name="plugins/lm2_mts.plugin"/>
|
||||
<exclude name="plugins/mrf.plugin"/>
|
||||
<exclude name="plugins/plx.plugin"/>
|
||||
<exclude name="plugins/te.plugin"/>
|
||||
<exclude name="plugins/txs_tuner.plugin"/>
|
||||
<exclude name="plugins/zt2.plugin"/>
|
||||
</updatecheck>
|
||||
|
||||
|
|
Loading…
Reference in New Issue