mirror of https://github.com/rusefi/RomRaider.git
- Added support to log from ECU or TCU (not both at the same time, yet)
- New AEM protocol support added (AEM2 plugin works at 19200 baud and reports Lambda values) - New Tech Edge support added (currently only supports data format 2.0) git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@323 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
parent
579d2cf0a4
commit
c916da4de5
File diff suppressed because it is too large
Load Diff
87
logger.xml
87
logger.xml
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE logger SYSTEM "logger.dtd">
|
||||
<!--ROMRAIDER STANDARD UNITS LOGGER DEFINITION FILE (VERSION 34) 20110329_232125
|
||||
Identified target for all SSM parameters/switches and Extended parameters with new tag.
|
||||
<!--ROMRAIDER STANDARD UNITS LOGGER DEFINITION FILE (VERSION 36) 20110404_222458
|
||||
Added ECU ID: 74A2584007 to extended parameters
|
||||
-->
|
||||
<logger>
|
||||
<protocols>
|
||||
|
@ -145,7 +145,7 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<conversion units="ms" expr="x*256/1000" format="0.00" />
|
||||
</conversions>
|
||||
</parameter>
|
||||
<parameter id="P23" name="Knock Correction Advance" desc="P23" ecubyteindex="10" ecubit="1" target="1">
|
||||
<parameter id="P23" name="Knock Correction Advance" desc="P23-Retard amount when knocking has occurred. Partial learned value of the learned ignition timing." ecubyteindex="10" ecubit="1" target="1">
|
||||
<address>0x000022</address>
|
||||
<conversions>
|
||||
<conversion units="degrees" expr="(x-128)/2" format="0.00" gauge_min="-15" gauge_max="20" gauge_step="5" />
|
||||
|
@ -189,7 +189,7 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<conversion units="V" expr="x/50" format="0.00" />
|
||||
</conversions>
|
||||
</parameter>
|
||||
<parameter id="P29" name="Learned Ignition Timing" desc="P29" ecubyteindex="11" ecubit="3" target="1">
|
||||
<parameter id="P29" name="Learned Ignition Timing" desc="P29-Advance or retard amount when knocking has occurred." ecubyteindex="11" ecubit="3" target="1">
|
||||
<address>0x000028</address>
|
||||
<conversions>
|
||||
<conversion units="degrees" expr="(x-128)/2" format="0.00" />
|
||||
|
@ -748,7 +748,7 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<conversion units="ohms" expr="x*4/2" format="0.0" />
|
||||
</conversions>
|
||||
</parameter>
|
||||
<parameter id="P120" name="Odometer" desc="P120" ecubyteindex="41" ecubit="1" target="1">
|
||||
<parameter id="P120" name="Estimated odometer" desc="P120-Estimated odometer - increments every 2km" ecubyteindex="41" ecubit="1" target="1">
|
||||
<address length="2">0x00010E</address>
|
||||
<conversions>
|
||||
<conversion units="miles" expr="x*1.242742384" format="0" />
|
||||
|
@ -978,7 +978,7 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<conversion units="misfire count" expr="x" format="0" />
|
||||
</conversions>
|
||||
</parameter>
|
||||
<parameter id="P153" name="Learned Ignition Timing Correction" desc="P153" ecubyteindex="55" ecubit="1" target="1">
|
||||
<parameter id="P153" name="Learned Ignition Timing Correction" desc="P153-Value of only the whole learning value in the ignition timing learning value." ecubyteindex="55" ecubit="1" target="1">
|
||||
<address>0x0000F9</address>
|
||||
<conversions>
|
||||
<conversion units="degrees" expr="x/16" format="0.0" />
|
||||
|
@ -10374,6 +10374,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF2DE4</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF2D28</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF2D38</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="multiplier" storagetype="float" expr="x" format="0.0000" />
|
||||
</conversions>
|
||||
|
@ -12474,6 +12480,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF5F0C</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF5F0C</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF5F0C</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="absolute %" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -13046,6 +13058,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF5EFC</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF5EFC</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF5EFC</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="psi" storagetype="float" expr="x*0.01933677" format="0.00" />
|
||||
<conversion units="bar" storagetype="float" expr="x*0.001333224" format="0.000" />
|
||||
|
@ -13620,6 +13638,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF5F04</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF5F04</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF5F04</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="psi relative sea level" storagetype="float" expr="(x-760)*0.01933677" format="0.00" />
|
||||
<conversion units="psi absolute" storagetype="float" expr="x*0.01933677" format="0.00" />
|
||||
|
@ -14196,6 +14220,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF5F08</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF5F08</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF5F08</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="absolute %" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -14861,6 +14891,9 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF6540</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF6520</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="%" storagetype="float" expr="x/.84" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -15604,6 +15637,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF7BD4</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF7C78</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF7B60</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="degrees" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -17096,6 +17135,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF7C70</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF7D14</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF7BFC</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="degrees" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -27573,6 +27618,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address length="4">0xFF7F38</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF7FDC</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF7EC4</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="raw ecu value" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -29820,6 +29871,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7442594007">
|
||||
<address>0xFF6A79</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address>0xFF6A31</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address>0xFF6A35</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="position" expr="x" format="0" />
|
||||
</conversions>
|
||||
|
@ -50822,6 +50879,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7432744007">
|
||||
<address length="4">0xFF7A04</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF7A20</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF7908</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="degrees" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -50839,6 +50902,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7432744007">
|
||||
<address length="4">0xFF7B30</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF7B40</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF7A28</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="degrees" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
@ -50856,6 +50925,12 @@ Identified target for all SSM parameters/switches and Extended parameters with n
|
|||
<ecu id="7432744007">
|
||||
<address length="4">0xFF7B68</address>
|
||||
</ecu>
|
||||
<ecu id="7452584007">
|
||||
<address length="4">0xFF7B78</address>
|
||||
</ecu>
|
||||
<ecu id="74A2584007">
|
||||
<address length="4">0xFF7A60</address>
|
||||
</ecu>
|
||||
<conversions>
|
||||
<conversion units="degrees" storagetype="float" expr="x" format="0.00" />
|
||||
</conversions>
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
datasource.class=com.romraider.logger.external.aem2.plugin.AemDataSource
|
|
@ -0,0 +1 @@
|
|||
datasource.class=com.romraider.logger.external.te.plugin.TEDataSource
|
|
@ -1,4 +1,4 @@
|
|||
- RomRaider 0.5.3 Beta RC7 -
|
||||
- RomRaider 0.5.3 Beta RC8 -
|
||||
Open-Source ECU Tuning -- www.romraider.com
|
||||
|
||||
|
||||
|
@ -33,14 +33,13 @@ RomRaider is still in beta status and changing frequently,
|
|||
documentation may be incomplete or out of date.
|
||||
|
||||
|
||||
|
||||
-------------------------------
|
||||
- 0.5.3b RC7 Notes (05/02/2010) -
|
||||
- 0.5.3b RC8 Notes (05/14/2011) -
|
||||
-------------------------------
|
||||
This is the seventh beta release of the upcoming official 0.5.3b release.
|
||||
This is the eigth beta release of the upcoming official 0.5.3b release.
|
||||
|
||||
---------------------------
|
||||
- 0.5.3b RC7 Known Issues -
|
||||
- 0.5.3b RC8 Known Issues -
|
||||
---------------------------
|
||||
- Editor
|
||||
- Pasting table data can cause hangs under certain circumstances
|
||||
|
@ -56,6 +55,15 @@ This is the seventh beta release of the upcoming official 0.5.3b release.
|
|||
- Change Log -
|
||||
--------------
|
||||
|
||||
0.5.3b RC8 (05/14/2011)
|
||||
-----------------------
|
||||
|
||||
--- Logger ---
|
||||
- Added support to log from ECU or TCU (not both at the same time, yet)
|
||||
- New AEM protocol support added (AEM2 plugin works at 19200 baud and reports
|
||||
Lambda values)
|
||||
- New Tech Edge support added (currently only supports data format 2.0)
|
||||
|
||||
0.5.3b RC7 (12/21/2010)
|
||||
-----------------------
|
||||
|
||||
|
|
2
run.bat
2
run.bat
|
@ -1 +1 @@
|
|||
start javaw -Djava.library.path=lib/windows -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms32M -Xmx384M -jar RomRaider.jar 1>>romraider_sout.log 2>&1
|
||||
start javaw -Djava.library.path=lib/windows -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms642M -Xmx512M -jar RomRaider.jar 1>>romraider_sout.log 2>&1
|
2
run.sh
2
run.sh
|
@ -5,6 +5,6 @@ if [ -z "$JAVA_HOME" ]; then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
$JAVA_HOME/bin/java -Djava.library.path=lib/linux -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms32M -Xmx384M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar >> romraider_sout.log 2>&1
|
||||
$JAVA_HOME/bin/java -Djava.library.path=lib/linux -Dawt.useSystemAAFontSettings=lcd -Dswing.aatext=true -Dsun.java2d.d3d=false -Xms64M -Xmx512M -XX:-UseParallelGC -XX:CompileThreshold=10000 -jar RomRaider.jar >> romraider_sout.log 2>&1
|
||||
|
||||
exit 0
|
||||
|
|
|
@ -22,6 +22,8 @@ package com.romraider.io.connection;
|
|||
public interface ConnectionProperties {
|
||||
int getBaudRate();
|
||||
|
||||
void setBaudRate(int b);
|
||||
|
||||
int getDataBits();
|
||||
|
||||
int getStopBits();
|
||||
|
|
|
@ -41,6 +41,10 @@ public final class ConnectionPropertiesImpl implements ConnectionProperties {
|
|||
return baudRate;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return dataBits;
|
||||
}
|
||||
|
|
|
@ -139,6 +139,10 @@ public final class SSMProtocol implements Protocol {
|
|||
return 4800;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -40,8 +40,14 @@ public final class GenericPluginMenuAction extends AbstractAction {
|
|||
}
|
||||
|
||||
public void actionPerformed(ActionEvent actionEvent) {
|
||||
String port = (String) showInputDialog(logger, "Select COM port:", dataSource.getName() + " Plugin Settings", QUESTION_MESSAGE, null,
|
||||
getPorts(), dataSource.getPort());
|
||||
String port = (String) showInputDialog(
|
||||
logger,
|
||||
"Select COM port:",
|
||||
dataSource.getName() + " Plugin Settings",
|
||||
QUESTION_MESSAGE,
|
||||
null,
|
||||
getPorts(),
|
||||
dataSource.getPort());
|
||||
if (port != null && port.length() > 0) dataSource.setPort(port);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public final class MafControlPanel extends JPanel {
|
|||
private final JTextField rpmMax = new JTextField("4500", 3);
|
||||
private final JTextField mafMin = new JTextField("0", 3);
|
||||
private final JTextField mafMax = new JTextField("100", 3);
|
||||
private final JTextField iatMax = new JTextField("45", 3);
|
||||
private final JTextField iatMax = new JTextField("100", 3);
|
||||
private final JTextField coolantMin = new JTextField("70", 3);
|
||||
private final JTextField mafvChangeMax = new JTextField("0.1", 3);
|
||||
private final JComboBox afrSourceList = new JComboBox();
|
||||
|
|
|
@ -26,6 +26,10 @@ public final class AemConnectionProperties implements ConnectionProperties {
|
|||
return 9600;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public final class AemRunner implements Stoppable {
|
|||
try {
|
||||
while (!stop) {
|
||||
String response = connection.readLine();
|
||||
LOGGER.trace("AEM UEGO Response: " + response);
|
||||
LOGGER.trace("AEM UEGO AFR Response: " + response);
|
||||
if (!isNullOrEmpty(response)) dataItem.setData(parseDouble(response));
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
|
|
|
@ -26,7 +26,7 @@ public final class AemDataItem implements ExternalDataItem, DataListener {
|
|||
private double data;
|
||||
|
||||
public String getName() {
|
||||
return "AEM UEGO";
|
||||
return "AEM UEGO AFR [9600]";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
|
|
|
@ -38,11 +38,11 @@ public final class AemDataSource implements ExternalDataSource {
|
|||
}
|
||||
|
||||
public String getName() {
|
||||
return "AEM UEGO";
|
||||
return "AEM UEGO AFR [9600]";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "0.03";
|
||||
return "0.04";
|
||||
}
|
||||
|
||||
public List<? extends ExternalDataItem> getDataItems() {
|
||||
|
|
|
@ -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.aem2.io;
|
||||
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
|
||||
public final class AemConnectionProperties 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,80 @@
|
|||
/*
|
||||
* 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.aem2.io;
|
||||
|
||||
import com.romraider.io.serial.connection.SerialConnection;
|
||||
import com.romraider.io.serial.connection.SerialConnectionImpl;
|
||||
import com.romraider.logger.external.aem2.plugin.AemDataItem;
|
||||
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 AemRunner implements Stoppable {
|
||||
private static final Logger LOGGER = getLogger(AemRunner.class);
|
||||
private static final AemConnectionProperties CONNECTION_PROPS = new AemConnectionProperties();
|
||||
private final SerialConnection connection;
|
||||
private final AemDataItem dataItem;
|
||||
private boolean stop;
|
||||
|
||||
public AemRunner(String port, AemDataItem dataItem) {
|
||||
this.connection = new SerialConnectionImpl(port, CONNECTION_PROPS);
|
||||
this.dataItem = dataItem;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
while (!stop) {
|
||||
String response = connection.readLine();
|
||||
LOGGER.trace("AEM UEGO Lambda 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();
|
||||
}
|
||||
|
||||
/*
|
||||
* http://www.romraider.com/forum/viewtopic.php?f=14&t=7207
|
||||
* The new version uses a baud rate of 19200 and outputs data
|
||||
* in the form "1.000\tReady\tNo-errors\r"
|
||||
* where 1.000 is the lambda value and the two other strings
|
||||
* are status values. The values are separated by a tab and
|
||||
* terminated with a carriage return. I believe the old version
|
||||
* terminated with a carriage return and line feed. This should
|
||||
* work for either case.
|
||||
*/
|
||||
private double parseString(String value){
|
||||
try{
|
||||
String[] substr = value.split("\t");
|
||||
return Double.parseDouble(substr[0]);
|
||||
}
|
||||
catch (Exception e){
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* 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.aem2.plugin;
|
||||
|
||||
import com.romraider.logger.external.core.DataListener;
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
|
||||
public final class AemDataItem implements ExternalDataItem, DataListener {
|
||||
private double data;
|
||||
|
||||
public String getName() {
|
||||
return "AEM UEGO Lambda [19200]";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "AEM UEGO Lambda data";
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return "Lambda";
|
||||
}
|
||||
|
||||
public double getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(double data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,72 @@
|
|||
/*
|
||||
* 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.aem2.plugin;
|
||||
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.external.aem2.io.AemRunner;
|
||||
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 final class AemDataSource implements ExternalDataSource {
|
||||
private AemDataItem dataItem = new AemDataItem();
|
||||
private AemRunner runner;
|
||||
private String port;
|
||||
|
||||
public String getId() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "AEM UEGO Lambda [19200]";
|
||||
}
|
||||
|
||||
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 AemRunner(port, dataItem);
|
||||
runAsDaemon(runner);
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (runner != null) runner.stop();
|
||||
}
|
||||
}
|
|
@ -26,6 +26,10 @@ public final class NawConnectionProperties implements ConnectionProperties {
|
|||
return 9600;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@ public final class InnovateConnectionProperties implements ConnectionProperties
|
|||
return 19200;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@ public final class MrfConnectionProperties implements ConnectionProperties {
|
|||
return 9600;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,10 @@ public final class PlxConnectionProperties implements ConnectionProperties {
|
|||
return 19200;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.te.io;
|
||||
|
||||
public interface TEConnection {
|
||||
byte readByte();
|
||||
|
||||
void close();
|
||||
}
|
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* 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.te.io;
|
||||
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
import com.romraider.io.serial.connection.SerialConnection;
|
||||
import com.romraider.io.serial.connection.SerialConnectionImpl;
|
||||
import static com.romraider.util.ParamChecker.checkNotNullOrEmpty;
|
||||
|
||||
public final class TEConnectionImpl implements TEConnection {
|
||||
private final SerialConnection connection;
|
||||
|
||||
public TEConnectionImpl(String port) {
|
||||
checkNotNullOrEmpty(port, "port");
|
||||
connection = serialConnection(port);
|
||||
// connection = new TestTEConnection();
|
||||
}
|
||||
|
||||
public byte readByte() {
|
||||
return (byte) connection.read();
|
||||
}
|
||||
|
||||
public void close() {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
private SerialConnection serialConnection(String port) {
|
||||
ConnectionProperties connectionProperties = new TEConnectionProperties();
|
||||
return new SerialConnectionImpl(port, connectionProperties);
|
||||
}
|
||||
}
|
|
@ -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.te.io;
|
||||
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
|
||||
public final class TEConnectionProperties 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,168 @@
|
|||
/*
|
||||
* 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.te.io;
|
||||
|
||||
import com.romraider.logger.external.core.Stoppable;
|
||||
import com.romraider.logger.external.te.plugin.TEDataItem;
|
||||
import com.romraider.logger.external.te.plugin.TESensorType;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.Lambda;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.USR1;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.USR2;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.USR3;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TC1;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TC2;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TC3;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TorVss;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.RPM;
|
||||
import org.apache.log4j.Logger;
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class TERunner implements Stoppable {
|
||||
private static final Logger LOGGER = getLogger(TERunner.class);
|
||||
private final Map<TESensorType, TEDataItem> dataItems;
|
||||
private final TEConnection connection;
|
||||
private boolean stop;
|
||||
|
||||
public TERunner(String port, Map<TESensorType, TEDataItem> dataItems) {
|
||||
this.connection = new TEConnectionImpl(port);
|
||||
this.dataItems = dataItems;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
boolean packetStarted = false;
|
||||
List<Byte> buffer = new ArrayList<Byte>(28);
|
||||
while (!stop) {
|
||||
byte b = connection.readByte();
|
||||
if (convertAsUnsignedByteToInt(b) == 0xa5
|
||||
&& buffer.size() >= 1
|
||||
&& buffer.get(buffer.size() - 1) == 0x5a) {
|
||||
packetStarted = true;
|
||||
buffer.clear();
|
||||
buffer.add((byte) 0x5a);
|
||||
buffer.add(b);
|
||||
|
||||
} else if (packetStarted && buffer.size() <= 28) {
|
||||
buffer.add(b);
|
||||
switch (buffer.size()) {
|
||||
case 7:
|
||||
TEDataItem lambdaDataItem = dataItems.get(Lambda);
|
||||
if (lambdaDataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(5));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(6));
|
||||
lambdaDataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 11:
|
||||
TEDataItem usr1DataItem = dataItems.get(USR1);
|
||||
if (usr1DataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(9));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(10));
|
||||
usr1DataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
TEDataItem usr2DataItem = dataItems.get(USR2);
|
||||
if (usr2DataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(11));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(12));
|
||||
usr2DataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
TEDataItem usr3DataItem = dataItems.get(USR3);
|
||||
if (usr3DataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(13));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(14));
|
||||
usr3DataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
TEDataItem tc1DataItem = dataItems.get(TC1);
|
||||
if (tc1DataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(15));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(16));
|
||||
tc1DataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
TEDataItem tc2DataItem = dataItems.get(TC2);
|
||||
if (tc2DataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(17));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(18));
|
||||
tc2DataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
TEDataItem tc3DataItem = dataItems.get(TC3);
|
||||
if (tc3DataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(19));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(20));
|
||||
tc3DataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 23:
|
||||
TEDataItem tOrVssDataItem = dataItems.get(TorVss);
|
||||
if (tOrVssDataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(21));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(22));
|
||||
tOrVssDataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 25:
|
||||
TEDataItem rpmDataItem = dataItems.get(RPM);
|
||||
if (rpmDataItem != null) {
|
||||
int raw1 = convertAsUnsignedByteToInt(buffer.get(23));
|
||||
int raw2 = convertAsUnsignedByteToInt(buffer.get(24));
|
||||
rpmDataItem.setRaw(raw1, raw2);
|
||||
}
|
||||
break;
|
||||
case 28:
|
||||
buffer.clear();
|
||||
packetStarted = false;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
buffer.add(b);
|
||||
packetStarted = false;
|
||||
}
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("Error occurred", t);
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
stop = true;
|
||||
connection.close();
|
||||
}
|
||||
|
||||
private int convertAsUnsignedByteToInt(byte aByte) {
|
||||
// A byte in java is signed, so -128 to 128
|
||||
// unlike in other platforms where it's
|
||||
// normally unsigned, so 0-255
|
||||
return (int) aByte & 0xFF;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,127 @@
|
|||
/*
|
||||
* 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.te.io;
|
||||
|
||||
import com.romraider.io.serial.connection.SerialConnection;
|
||||
import static com.romraider.util.ThreadUtil.sleep;
|
||||
|
||||
public final class TestTEConnection implements SerialConnection {
|
||||
/*
|
||||
2.0 Data Frame Format:
|
||||
Byte - Description
|
||||
1 - Frame Header byte 1 (0x5A)
|
||||
2 - Frame Header byte 2 (0xA5)
|
||||
3 - Frame Sequence counter
|
||||
4 - Tick [high] (1 tick = 1/100 Second)
|
||||
5 - Tick [low] byte
|
||||
6 - l-16 or Ipx(0), (or ADC) [high] byte
|
||||
7 - l-16 or Ipx(0), (or ADC) [low] byte
|
||||
8 - Ipx(1) [high] (8192=F/A, 4096=Ipx[0])
|
||||
9 - Ipx(1) [low] byte
|
||||
10 - User 1 ADC [high] (V1 input)
|
||||
11 - User 1 ADC [low] byte
|
||||
12 - User 2 ADC [high] (V2 input)
|
||||
13 - User 2 ADC [low] byte
|
||||
14 - User 3 ADC [high] (V3 input)
|
||||
15 - User 3 ADC [low] byte
|
||||
16 - Thermocouple 1 ADC [high] (T1 Input)
|
||||
17 - Thermocouple 1 ADC [low]
|
||||
18 - Thermocouple 2 ADC [high] (T2 Input)
|
||||
19 - Thermocouple 2 ADC [low]
|
||||
20 - Thermocouple 3 ADC [high] (T3 Input)
|
||||
21 - Thermocouple 3 ADC [low]
|
||||
22 - Thermistor ADC or Vss count [high]
|
||||
23 - Thermistor ADC or Vss count [low]
|
||||
24 - RPM count [high] byte
|
||||
25 - RPM count [low] bye
|
||||
26 - Status/Error [high] byte
|
||||
27 - Status/Error [low] byte
|
||||
28 - CRC (1's comp. sum of above)
|
||||
*/
|
||||
private final byte[] data = {
|
||||
(byte) 0x5a,
|
||||
(byte) 0xa5,
|
||||
(byte) 0x02, // frame count
|
||||
(byte) 0x89,
|
||||
(byte) 0x00,
|
||||
(byte) 0x1f, // lambda [high]
|
||||
(byte) 0xf4, // lambda [low]
|
||||
(byte) 0x01, // Ipx(1) [high]
|
||||
(byte) 0x00, // Ipx(1) [low]
|
||||
(byte) 0x1f, // user1 [high]
|
||||
(byte) 0xf8, // user1 [low]
|
||||
(byte) 0x0f,
|
||||
(byte) 0xfc,
|
||||
(byte) 0x00,
|
||||
(byte) 0x21,
|
||||
(byte) 0x03, // tc1 [high]
|
||||
(byte) 0xf8, // tc1 [low]
|
||||
(byte) 0x01,
|
||||
(byte) 0xfc,
|
||||
(byte) 0x00,
|
||||
(byte) 0x20,
|
||||
(byte) 0x09,
|
||||
(byte) 0x00,
|
||||
(byte) 0x03, // RPM count [high]
|
||||
(byte) 0xec, // RPM count [low]
|
||||
(byte) 0x0b,
|
||||
(byte) 0x00,
|
||||
(byte) 0x00
|
||||
};
|
||||
private int index;
|
||||
private byte[] result = new byte[1];
|
||||
|
||||
public void write(byte[] bytes) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int available() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public void read(byte[] bytes) {
|
||||
if (bytes.length != 1) throw new IllegalArgumentException();
|
||||
if (index >= data.length) index = 0;
|
||||
data[3] = (byte) index;
|
||||
bytes[0] = data[index++];
|
||||
sleep(10);
|
||||
}
|
||||
|
||||
public byte[] readAvailable() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public void readStaleData() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public String readLine() {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
public int read() {
|
||||
read(result);
|
||||
return result[0];
|
||||
}
|
||||
|
||||
public void close() {
|
||||
index = 0;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
/*
|
||||
* 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.te.plugin;
|
||||
|
||||
public interface TEConverter {
|
||||
double convert(TESensorType sensorType, int... raw);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/*
|
||||
* 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.te.plugin;
|
||||
|
||||
public final class TEConverterImpl implements TEConverter {
|
||||
public double convert(TESensorType sensorType, int... raw) {
|
||||
switch (sensorType) {
|
||||
case Lambda:
|
||||
// Lambda = 0.5 to 5.0 (normal usage range of unleaded AFR = 7.35 to AFR = 73.5)
|
||||
return ((((raw[0] * 256d) + raw[1]) / 8192) + 0.5 );
|
||||
case USR1:
|
||||
// inputs are sampled at 10 bit accuracy, the result is multiplied by 8 giving 1024 steps
|
||||
return ((raw[0] * 256d) + raw[1]) * 0.000610948;
|
||||
case USR2:
|
||||
// inputs are sampled at 10 bit accuracy, the result is multiplied by 8 giving 1024 steps
|
||||
return ((raw[0] * 256d) + raw[1]) * 0.000610948;
|
||||
case USR3:
|
||||
// inputs are sampled at 10 bit accuracy, the result is multiplied by 8 giving 1024 steps
|
||||
return ((raw[0] * 256d) + raw[1]) * 0.000610948;
|
||||
case TC1:
|
||||
// inputs are sampled at 10 bit accuracy, the result is not multiplied by any value
|
||||
return ((raw[0] * 256d) + raw[1]) * 0.004887586;
|
||||
case TC2:
|
||||
// inputs are sampled at 10 bit accuracy, the result is not multiplied by any value
|
||||
return ((raw[0] * 256d) + raw[1]) * 0.004887586;
|
||||
case TC3:
|
||||
// inputs are sampled at 10 bit accuracy, the result is not multiplied by any value
|
||||
return ((raw[0] * 256d) + raw[1]) * 0.004887586;
|
||||
case TorVss:
|
||||
// raw Thermocouple value or VSS counts @ 100 uSec periods
|
||||
return ((raw[0] * 256d) + raw[1]);
|
||||
case RPM:
|
||||
// RPM = count of 5 uSec periods between sparks for 4 cyl engine
|
||||
return (60 / (((raw[0] * 256d) + raw[1]) * 0.00001));
|
||||
default:
|
||||
throw new UnsupportedOperationException("Calculation for this particular TESensorType is not supported");
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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.te.plugin;
|
||||
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
|
||||
public interface TEDataItem extends ExternalDataItem {
|
||||
void setRaw(int... raw);
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
/*
|
||||
* 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.te.plugin;
|
||||
|
||||
public final class TEDataItemImpl implements TEDataItem {
|
||||
private final TEConverter converter = new TEConverterImpl();
|
||||
private final TESensorType sensorType;
|
||||
private final String units;
|
||||
private final String name;
|
||||
private int[] raw;
|
||||
|
||||
public TEDataItemImpl(String name, String units, TESensorType sensorType) {
|
||||
super();
|
||||
this.name = name;
|
||||
this.units = units;
|
||||
this.sensorType = sensorType;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "Tech Edge " + name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "Tech Edge " + name + " data";
|
||||
}
|
||||
|
||||
public String getUnits() {
|
||||
return units;
|
||||
}
|
||||
|
||||
public double getData() {
|
||||
return converter.convert(sensorType, raw);
|
||||
}
|
||||
|
||||
public void setRaw(int... raw) {
|
||||
this.raw = raw;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* 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.te.plugin;
|
||||
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
import com.romraider.logger.external.core.ExternalDataSource;
|
||||
import com.romraider.logger.external.te.io.TERunner;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.Lambda;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.USR1;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.USR2;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.USR3;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TC1;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TC2;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TC3;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.TorVss;
|
||||
import static com.romraider.logger.external.te.plugin.TESensorType.RPM;
|
||||
import static com.romraider.util.ThreadUtil.runAsDaemon;
|
||||
import static java.util.Collections.unmodifiableList;
|
||||
import javax.swing.Action;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public final class TEDataSource implements ExternalDataSource {
|
||||
private final Map<TESensorType, TEDataItem> dataItems = new HashMap<TESensorType, TEDataItem>();
|
||||
private TERunner runner;
|
||||
private String port;
|
||||
|
||||
{
|
||||
dataItems.put(Lambda, new TEDataItemImpl("Wideband Lambda", "Lambda", Lambda));
|
||||
dataItems.put(USR1, new TEDataItemImpl("User 1", "VDC", USR1));
|
||||
dataItems.put(USR2, new TEDataItemImpl("User 2", "VDC", USR2));
|
||||
dataItems.put(USR3, new TEDataItemImpl("User 3", "VDC", USR3));
|
||||
dataItems.put(TC1, new TEDataItemImpl("Thermocouple 1", "raw", TC1));
|
||||
dataItems.put(TC2, new TEDataItemImpl("Thermocouple 2", "raw", TC2));
|
||||
dataItems.put(TC3, new TEDataItemImpl("Thermocouple 3", "raw", TC3));
|
||||
dataItems.put(TorVss, new TEDataItemImpl("Thermistor or Vss", "raw", TorVss));
|
||||
dataItems.put(RPM, new TEDataItemImpl("RPM", "RPM", RPM));
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "Tech Edge (mode 2.0)";
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return "0.01";
|
||||
}
|
||||
|
||||
public List<? extends ExternalDataItem> getDataItems() {
|
||||
return unmodifiableList(new ArrayList<TEDataItem>(dataItems.values()));
|
||||
}
|
||||
|
||||
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 TERunner(port, dataItems);
|
||||
runAsDaemon(runner);
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (runner != null) runner.stop();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* 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.te.plugin;
|
||||
|
||||
public enum TESensorType {
|
||||
Lambda,
|
||||
USR1,
|
||||
USR2,
|
||||
USR3,
|
||||
TC1,
|
||||
TC2,
|
||||
TC3,
|
||||
TorVss,
|
||||
RPM
|
||||
}
|
|
@ -26,6 +26,10 @@ public final class ZT2ConnectionProperties implements ConnectionProperties {
|
|||
return 9600;
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return 8;
|
||||
}
|
||||
|
|
|
@ -34,6 +34,10 @@ public final class RamTuneTestAppConnectionProperties implements ConnectionPrope
|
|||
return defaultConnectionProperties.getBaudRate();
|
||||
}
|
||||
|
||||
public void setBaudRate(int b) {
|
||||
|
||||
}
|
||||
|
||||
public int getDataBits() {
|
||||
return defaultConnectionProperties.getDataBits();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue