LM-2 MTS refactoring, almost complete and is in a working state. Also added GaugeMinMax to External sensors but the values chossen may not be optimal.

Bumping up to 0.5.4Beta due to the extent of the changes to the logger.
COM4J upgrade to version released 20110322.

git-svn-id: https://svn2.assembla.com/svn/romraider/trunk@348 38686702-15cf-42e4-a595-3071df8bf5ea
This commit is contained in:
Dale Schultz 2011-09-28 21:34:55 +00:00
parent 35a860ad08
commit 5411569d9c
21 changed files with 472 additions and 348 deletions

Binary file not shown.

View File

@ -1,4 +1,4 @@
- RomRaider 0.5.3 Beta RC10 -
- RomRaider 0.5.4 Beta RC1 -
Open-Source ECU Tuning -- www.romraider.com
@ -7,7 +7,7 @@ A NEW VERSION OF ROMRAIDER. IMPORTANT NOTICES, KNOWN ISSUES AND
NEW FEATURES WILL BE DISCUSSED.
RomRaider is a full featured Engine Control Unit editing application
for tuning virtually any manufacturer, meant to be used in conjuction
for tuning virtually any manufacturer, meant to be used in conjunction
with ECU flash and dump utilities. RomRaider will give you full
control over timing, fuel, boost and many other parameters in your
ECU, competing with very expensive and proprietary software. RomRaider
@ -33,29 +33,28 @@ RomRaider is still in beta status and changing frequently,
documentation may be incomplete or out of date.
-------------------------------
- 0.5.3b RC11 Notes (??/??/????) -
-------------------------------
---------------------------------
- 0.5.4b RC1 Notes (??/??/????) -
---------------------------------
This is the eleventh beta release of the upcoming official 0.5.3b release.
---------------------------
- 0.5.3b RC11 Known Issues -
- 0.5.4b RC1 Known Issues -
---------------------------
- Editor
- Pasting table data can cause hangs under certain circumstances
- Logger
- Gauge min/max/step limits incomplete (logger.xml)
- Gauge min/max/step limits incomplete in logger.xml and External plug-ins
- ECU connections under Linux are flaky (start the logger after
you've started the engine)
- Update latency via injector tab broken for some models (eg. 2007 2.5i)
- LM-2 MTS support incomplete
--------------
- Change Log -
--------------
0.5.3b RC11 (??/??/????)
0.5.4b RC1 (??/??/????)
-----------------------
--- Logger ---
@ -65,14 +64,22 @@ This is the eleventh beta release of the upcoming official 0.5.3b release.
- Added support for sorting the Selected? & Description parameter list entries.
- Added support for convertors on External data items (F/C, lambda/AFR, etc.)
- Added all defined PLX Sensors according to their documentation
- Added more Innovate MTS LM-2 support for additional sensors. Sensors are now
loaded dynamically when the Logger starts. Sensor units are set via LogWorks.
- Updated library COM4J to version: com4j-20110322. This affects Innovate MTS
and Tactrix Openport 2.0 support.
--- Editor ---
- Fixed JInternalFrame.isPalette in TableFarme so table titles are visible on
Mac OS.
0.5.3b RC10 (09/12/2011)
-----------------------
------------------------
--- Editor ---
- Added support for multiple-state switches. Switch Tables will now use
Radio Buttons rather than a Checkbox.
- Added ECU defintion data validation for Switch Tables. If the ROM image data
- Added ECU definition data validation for Switch Tables. If the ROM image data
does not match one of the switch states according to the definition then a
warning is presented and the table is locked from editing.
- Added ROM Checksum validation on image open for 32 bit ROMs. An ERROR message

View File

@ -19,38 +19,33 @@
package com.romraider.logger.ecu.definition;
import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getMaxMin;
import static com.romraider.util.JEPUtil.evaluate;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalDataItem;
import java.text.DecimalFormat;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalDataItem;
public final class ExternalDataConvertorImpl implements EcuDataConvertor {
private final String units;
private final String expression;
private final GaugeMinMax gaugeMinMax = new GaugeMinMax(0,0,0);
private final GaugeMinMax gaugeMinMax;
private final ExternalDataItem dataItem;
private DecimalFormat format;
// <conversion units="psi" expr="x*37/255" format="0.00" gauge_min="-20" gauge_max="40" gauge_step="5" />
// <conversion units="kPa" expr="x*37/255/14.50377*100" format="0" gauge_min="-120" gauge_max="280" gauge_step="40" />
// <conversion units="hPa" expr="x*37/255/14.50377*1000" format="0" gauge_min="-1200" gauge_max="2800" gauge_step="400" />
// <conversion units="bar" expr="x*37/255/14.50377" format="0.000" gauge_min="-1.2" gauge_max="2.8" gauge_step="0.4" />
public ExternalDataConvertorImpl(ExternalDataItem dataItem, String units, String expression,
String format
// GaugeMinMax gaugeMinMax
String format,
GaugeMinMax gaugeMinMax
) {
this.dataItem = dataItem;
this.units = units;
this.expression = expression;
this.format = new DecimalFormat(format);
this.gaugeMinMax = gaugeMinMax;
}
public double convert(byte[] bytes) {
double value = dataItem.getData();
// int value = asUnsignedInt(bytes);
double result = evaluate(expression, value);
return Double.isNaN(result) || Double.isInfinite(result) ? 0.0 : result;
}
@ -64,7 +59,7 @@ public final class ExternalDataConvertorImpl implements EcuDataConvertor {
}
public GaugeMinMax getGaugeMinMax() {
return getMaxMin(getUnits());
return gaugeMinMax;
}
public String getFormat() {

View File

@ -16,7 +16,8 @@ public class ExternalDataConvertorLoader {
dataItem,
convertor.units(),
convertor.expression(),
convertor.format()
convertor.format(),
convertor.gaugeMinMax()
);
i++;
}

View File

@ -1,5 +1,7 @@
package com.romraider.logger.external.core;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
public interface ExternalSensorConversions {
String units();
@ -8,4 +10,6 @@ public interface ExternalSensorConversions {
String format();
GaugeMinMax gaugeMinMax();
}

View File

@ -19,30 +19,34 @@
package com.romraider.logger.external.core;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum SensorConversionsAFR implements ExternalSensorConversions {
// AFR conversion assumes reported DATA value is Gas AFR
LAMBDA ("Lambda", "x*0.0680272108843537", "0.00"),
AFR_147 ("AFR Gasoline", "x", "0.00"), // gasoline
AFR_90 ("AFR Ethonal", "x*0.6122448979591837", "0.00"), // ethanol
AFR_146 ("AFR Diesel", "x*0.9931972789115646", "0.00"), // diesel
AFR_64 ("AFR Methonal", "x*0.4353741496598639", "0.00"),// methanol
AFR_155 ("AFR LPG", "x*1.054421768707483", "0.00"), // LPG
AFR_172 ("AFR CNG", "x*1.170068027210884", "0.00"), // CNG
AFR_34 ("AFR Hydrogen", "x*2.312925170068027", "0.00"); // Hydrogen
LAMBDA ("Lambda", "x*0.0680272108843537", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
AFR_147 ("AFR Gasoline", "x", "0.00", new GaugeMinMax(9,20,1)), // gasoline
AFR_90 ("AFR Ethonal", "x*0.6122448979591837", "0.00", new GaugeMinMax(5,12,1)), // ethanol
AFR_146 ("AFR Diesel", "x*0.9931972789115646", "0.00", new GaugeMinMax(9,20,1)), // diesel
AFR_64 ("AFR Methonal", "x*0.4353741496598639", "0.00", new GaugeMinMax(4,9,1)),// methanol
AFR_155 ("AFR LPG", "x*1.054421768707483", "0.00", new GaugeMinMax(9,20,1)), // LPG
AFR_172 ("AFR CNG", "x*1.170068027210884", "0.00", new GaugeMinMax(9,20,1)), // CNG
AFR_34 ("AFR Hydrogen", "x*2.312925170068027", "0.00", new GaugeMinMax(20,46,2.5)); // Hydrogen
private final String units;
private final String expression;
private final String format;
private final GaugeMinMax gaugeMinMax;
SensorConversionsAFR(String units, String expression, String format) {
SensorConversionsAFR(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
this.units = units;
this.expression = expression;
this.format = format;
this.gaugeMinMax = gaugeMinMax;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
}

View File

@ -19,30 +19,34 @@
package com.romraider.logger.external.core;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum SensorConversionsLambda implements ExternalSensorConversions {
// AFR conversion assumes reported DATA value is Lambda
LAMBDA ("Lambda", "x", "0.00"),
AFR_147 ("AFR Gasoline", "x*14.7", "0.00"),// gasoline
AFR_90 ("AFR Ethonal", "x*9.0", "0.00"), // ethanol
AFR_146 ("AFR Diesel", "x*14.6", "0.00"), // diesel
AFR_64 ("AFR Methonal", "x*6.4", "0.00"), // methanol
AFR_155 ("AFR LPG", "x*15.5", "0.00"), // LPG
AFR_172 ("AFR CNG", "x*17.2", "0.00"), // CNG
AFR_34 ("AFR Hydrogen", "x*34", "0.00"); // Hydrogen
LAMBDA ("Lambda", "x", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
AFR_147 ("AFR Gasoline", "x*14.7", "0.00", new GaugeMinMax(9,20,1)),// gasoline
AFR_90 ("AFR Ethonal", "x*9.0", "0.00", new GaugeMinMax(5,12,1)), // ethanol
AFR_146 ("AFR Diesel", "x*14.6", "0.00", new GaugeMinMax(9,20,1)), // diesel
AFR_64 ("AFR Methonal", "x*6.4", "0.00", new GaugeMinMax(4,9,1)), // methanol
AFR_155 ("AFR LPG", "x*15.5", "0.00", new GaugeMinMax(9,20,1)), // LPG
AFR_172 ("AFR CNG", "x*17.2", "0.00", new GaugeMinMax(9,20,1)), // CNG
AFR_34 ("AFR Hydrogen", "x*34", "0.00", new GaugeMinMax(20,46,2.5)); // Hydrogen
private final String units;
private final String expression;
private final String format;
private final GaugeMinMax gaugeMinMax;
SensorConversionsLambda(String units, String expression, String format) {
SensorConversionsLambda(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
this.units = units;
this.expression = expression;
this.format = format;
this.gaugeMinMax = gaugeMinMax;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
}

View File

@ -19,36 +19,40 @@
package com.romraider.logger.external.core;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum SensorConversionsOther implements ExternalSensorConversions {
DEG_C ("C", "x", "0.0"),
DEG_F ("F", "x", "0.0"),
DEG_F2C ("C", "(x-32)*5/9", "0.0"),
DEG_C2F ("F", "x*9/5+32 ", "0.0"),
PSI ("psi", "x", "0.00"),
PSI2BAR ("bar", "x*0.0689475728", "0.00"), // converts from PSI to bar
PSI2KPA ("kPa", "x*6.89475728", "0.0"), // converts from PSI to kpa
PSI2KGCM2 ("kg/cm^2", "x*0.0703068835943", "0.0"),// converts from PSI to kpa
KPA2PSI ("psi", "x*0.14503774", "0.00"), // converts from kPa
KPA2BAR ("bar", "x*0.01", "0.00"), // converts from kPa
KPA ("kPa", "x", "0.0"),
KPA2KGCM2 ("kg/cm^2", "x*0.01019716", "0.00"), // converts from kPa
PERCENT ("%", "x", "0.0"),
VOLTS_DC("vdc", "x", "0.0");
DEG_C ("C", "x", "0.0", new GaugeMinMax(-40,1000,100)),
DEG_F ("F", "x", "0.0", new GaugeMinMax(-40,2000,200)),
DEG_F2C ("C", "(x-32)*5/9", "0.0", new GaugeMinMax(-40,1000,100)),
DEG_C2F ("F", "x*9/5+32 ", "0.0", new GaugeMinMax(-40,2000,200)),
PSI ("psi", "x", "0.00", new GaugeMinMax(-10,30,5)),
PSI2BAR ("bar", "x*0.0689475728", "0.00", new GaugeMinMax(-0.5,4,0.5)), // converts from PSI to bar
PSI2KPA ("kPa", "x*6.89475728", "0.0", new GaugeMinMax(98,120,2)), // converts from PSI to kpa
PSI2KGCM2 ("kg/cm^2", "x*0.0703068835943", "0.0", new GaugeMinMax(-0.5,2.5,0.5)),// converts from PSI to kpa
KPA2PSI ("psi", "x*0.14503774", "0.00", new GaugeMinMax(-10,30,5)), // converts from kPa
KPA2BAR ("bar", "x*0.01", "0.00", new GaugeMinMax(-0.5,4,0.5)), // converts from kPa
KPA ("kPa", "x", "0.0", new GaugeMinMax(98,120,2)),
KPA2KGCM2 ("kg/cm^2", "x*0.01019716", "0.00", new GaugeMinMax(-0.5,2.5,0.5)), // converts from kPa
PERCENT ("%", "x", "0.0", new GaugeMinMax(0,100,10)),
VOLTS_DC("vdc", "x", "0.0", new GaugeMinMax(0,5,0.5));
private final String units;
private final String expression;
private final String format;
private final GaugeMinMax gaugeMinMax;
SensorConversionsOther(String units, String expression, String format) {
SensorConversionsOther(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
this.units = units;
this.expression = expression;
this.format = format;
this.gaugeMinMax = gaugeMinMax;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
}

View File

@ -27,40 +27,81 @@ import java.util.Set;
import org.apache.log4j.Logger;
import com.romraider.logger.external.innovate.lm2.mts.plugin.Lm2Sensor;
public final class MTSConnector {
private static final Logger LOGGER = getLogger(MTSConnector.class);
private final MTS mts;
private MTS mts;
private int[] ports;
{
createMts();
}
/**
* MTS Connector is a set of methods to create the MTS connection,
* retrieve a set of available ports and the sensor inputs available
* across all the found ports.
*/
public MTSConnector() {
setMtsPorts();
}
public MTSConnector(int mtsPort) {
this.mts = mts(mtsPort);
if (mtsPort != -1) mts(mtsPort);
}
public MTS getMts() {
return mts;
}
private MTS mts(int mtsPort) {
// bail out early if we know specified mts port is invalid
if (mtsPort < 0) throw new IllegalArgumentException("Bad MTS port: " + mtsPort);
public int[] getMtsPorts() {
return ports;
}
public void usePort(int mtsPort) {
mts(mtsPort);
}
// create mts interface
MTS mts = createMTS();
mts.disconnect();
private void createMts() {
// create mts interface
this.mts = createMTS();
mts.disconnect();
}
private void setMtsPorts() {
try {
// check there are ports available
int portCount = mts.portCount();
if (portCount <= 0) throw new IllegalStateException("No MTS ports found");
LOGGER.info("MTS: found " + portCount + " ports.");
if (portCount <= 0) throw new IllegalStateException("No Innovate MTS ports found");
ports = new int[portCount];
String names = "";
for (int i = 0; i < portCount; i++) {
ports[i] = i;
mts.currentPort(i);
names = names + " " + mts.portName();
}
LOGGER.info("Innovate MTS: found " + portCount + " ports," + names);
}
catch (RuntimeException t) {
// cleanup mts and rethrow exception
if (mts != null) mts.dispose();
throw t;
}
}
public void mts(int mtsPort) {
// bail out early if we know specified mts port is invalid
if (mtsPort < 0) throw new IllegalArgumentException("Bad Innovate MTS port: " + mtsPort);
try {
int portCount = mts.portCount();
if (portCount <= 0) throw new IllegalStateException("No Innovate MTS ports found");
// select the specified port
mts.currentPort(mtsPort);
String portName = mts.portName();
LOGGER.info("MTS: current port [" + mtsPort + "]: " + portName);
LOGGER.info("Innovate MTS: current port [" + mtsPort + "]: " + portName);
return mts;
} catch (RuntimeException t) {
// cleanup mts and rethrow exception
if (mts != null) mts.dispose();
@ -68,8 +109,8 @@ public final class MTSConnector {
}
}
public Set<Lm2Sensor> getSensors() {
Set<Lm2Sensor> sensors = new HashSet<Lm2Sensor>();
public Set<MTSSensor> getSensors() {
Set<MTSSensor> sensors = new HashSet<MTSSensor>();
try {
// attempt to connect to the specified device
mts.connect();
@ -77,13 +118,13 @@ public final class MTSConnector {
try {
// get a count of available inputs
int inputCount = mts.inputCount();
LOGGER.info("MTS: found " + inputCount + " inputs.");
LOGGER.info("Innovate MTS: found " + inputCount + " inputs.");
if (inputCount > 0) {
for (int i = 0; i < inputCount; i++) {
// report each input found
mts.currentInput(i);
Lm2Sensor sensor = new Lm2Sensor();
MTSSensor sensor = new MTSSensor();
sensor.setInputNumber(i);
sensor.setInputName(mts.inputName());
sensor.setDeviceName(mts.inputDeviceName());
@ -93,18 +134,19 @@ public final class MTSConnector {
sensor.setMaxValue(mts.inputMaxValue());
sensors.add(sensor);
LOGGER.debug(String.format(
"MTS: InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f",
"Innovate MTS: InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f",
i, mts.inputName(), mts.inputType(), mts.inputDeviceName(), mts.inputDeviceType(), mts.inputDeviceChannel(), mts.inputUnit(), mts.inputAFRMultiplier(), mts.inputMinValue(), mts.inputMaxValue()));
}
}
else {
LOGGER.error("MTS: Error - no input channels found to log from!");
LOGGER.error("Innovate MTS: Error - no input channels found to log from!");
}
} finally {
}
finally {
mts.disconnect();
}
} finally {
mts.dispose();
}
finally {
}
return sensors;
}

View File

@ -19,7 +19,12 @@
package com.romraider.logger.external.innovate.generic.mts.io;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSFactory.createMTS;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSSensorInputFunction.MTS_FUNC_LAMBDA;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSSensorInputFunction.MTS_FUNC_NOTLAMBDA;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSSensorInputFunction.MTS_FUNC_O2;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSSensorInputType.MTS_TYPE_AFR;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSSensorInputType.MTS_TYPE_LAMBDA;
import static com.romraider.logger.external.innovate.generic.mts.io.MTSSensorInputType.MTS_TYPE_VDC;
import static com.romraider.util.ThreadUtil.sleep;
import static java.lang.System.currentTimeMillis;
import static org.apache.log4j.Logger.getLogger;
@ -30,16 +35,23 @@ import org.apache.log4j.Logger;
import com.romraider.logger.external.core.Stoppable;
import com.romraider.logger.external.innovate.lm2.mts.plugin.Lm2MtsDataItem;
import com4j.EventCookie;
public final class MTSRunner implements Stoppable {
public final class MTSRunner implements MTSEvents, Stoppable {
private static final Logger LOGGER = getLogger(MTSRunner.class);
private final Map<Integer, Lm2MtsDataItem> dataItems;
private EventCookie connectionEventCookie;
private final MTS mts;
private boolean running;
private boolean stop;
/**
* MTSRunner contains the work-horse methods to process the MTS stream
* data and update the appropriate sensor result. Once started this class
* listens for events to process, typically with the newData() method after
* a successful connection is made and data collection started.
*/
public MTSRunner(int mtsPort, Map<Integer, Lm2MtsDataItem> dataItems) {
// this.mts = mts(mtsPort);
MTSConnector connection = new MTSConnector(mtsPort);
this.mts = connection.getMts();
this.dataItems = dataItems;
@ -50,7 +62,7 @@ public final class MTSRunner implements Stoppable {
try {
doRun();
} catch (Throwable t) {
LOGGER.error("Error occurred", t);
LOGGER.error("Innovate MTS error occurred", t);
} finally {
running = false;
}
@ -58,134 +70,117 @@ public final class MTSRunner implements Stoppable {
public void stop() {
stop = true;
// wait for it to stop running so mts can disconnect/dispose... timeout after 5secs
long timeout = currentTimeMillis() + 5000L;
while (running && currentTimeMillis() < timeout) sleep(100L);
}
// private MTS mts(int mtsPort) {
// // bail out early if we know specified mts port is invalid
// if (mtsPort < 0) throw new IllegalArgumentException("Bad MTS port: " + mtsPort);
//
// // create mts interface
// MTS mts = createMTS();
// mts.disconnect();
//
// try {
// // check there are ports available
// int portCount = mts.portCount();
// if (portCount <= 0) throw new IllegalStateException("No MTS ports found");
// //LOGGER.info("MTS: found " + portCount + " ports.");
//
// // select the specified port
// mts.currentPort(mtsPort);
// String portName = mts.portName();
// //LOGGER.info("MTS: current port [" + mtsPort + "]: " + portName);
//
// return mts;
// } catch (RuntimeException t) {
// // cleanup mts and rethrow exception
// if (mts != null) mts.dispose();
// throw t;
// }
// }
private void doRun() {
try {
// attempt to connect to the specified device
connectionEventCookie = mts.advise(MTSEvents.class, this);
mts.connect();
try {
// get a count of available inputs
int inputCount = mts.inputCount();
//LOGGER.info("MTS: found " + inputCount + " inputs.");
if (inputCount > 0) {
for (int i = 0; i < inputCount; i++) {
// report each input found
mts.currentInput(i);
LOGGER.debug(String.format(
"MTS: InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f, MinVolts: %f, MaxVolts: %f",
i, mts.inputName(), mts.inputType(), mts.inputDeviceName(), mts.inputDeviceType(), mts.inputDeviceChannel(), mts.inputUnit(), mts.inputAFRMultiplier(), mts.inputMinValue(), mts.inputMaxValue(), mts.inputMinVolt(), mts.inputMaxVolt()));
}
// attempt to get data
mts.startData();
// for each input get the sample
while (!stop) {
for (int i = 0; i < inputCount; i++) {
mts.currentInput(i);
int type = mts.inputType();
int function = mts.inputFunction();
int sample = mts.inputSample();
LOGGER.trace("MTS input: " + i + ", type = " + type + ", function = " + function + ", sample = " + sample);
float data = 0f;
// Input Types
// 0 = Lambda
// 1 = AFR
// 2 = 5V
// 5V channel
// Determine the range between min and max,
// calculate what percentage of that our sample represents,
// shift back to match our offset from 0.0 for min
if (type == 2) {
// MTS_FUNC_NOTLAMBDA
if (function == 9) {
float min = mts.inputMinValue();
float max = mts.inputMaxValue();
float range = max - min;
data = (((float) sample / 1024f) * range) + min;
if (mts.inputDeviceChannel() == -1)
LOGGER.debug(String.format(
"MTS: InputNo: %02d, InputName: %s, InputType: %d, DeviceName: %s, DeviceType: %d, DeviceChannel: %d, Units: %s, Multiplier: %f, MinValue: %f, MaxValue: %f, MinVolts: %f, MaxVolts: %f, Function: %d, data: %f",
i, mts.inputName(), mts.inputType(), mts.inputDeviceName(), mts.inputDeviceType(), mts.inputDeviceChannel(), mts.inputUnit(), mts.inputAFRMultiplier(), mts.inputMinValue(), mts.inputMaxValue(), mts.inputMinVolt(), mts.inputMaxVolt(), mts.inputFunction(), data));
}
}
// AFR
// Take each sample step as .001 Lambda,
// add 0.5 (so our range is 0.5 to 1.523 for our 1024 steps),
// then multiply by the AFR multiplier
if (type == 1) {
// MTS_FUNC_LAMBDA
if (function == 0) {
float multiplier = mts.inputAFRMultiplier();
data = ((float) sample / 1000f + 0.5f) * multiplier;
}
// MTS_FUNC_O2
if (function == 1) {
data = ((float) sample / 10f);
}
}
// Lambda
// Identical to AFR, except we do not multiply for AFR.
if (type == 0) {
// MTS_FUNC_LAMBDA
if (function == 0) {
data = (float) sample / 1000f + 0.5f;
}
}
// set data for this sensor based on inputNumber
Lm2MtsDataItem dataItem = dataItems.get(i);
if (dataItem != null) dataItem.setData(data);
}
sleep(10L);
}
}
else {
LOGGER.error("MTS: Error - no input channels found to log from!");
}
} finally {
if (mts.inputCount() > 0) {
while (!stop) {
// wait for newData() event to occur
sleep(60000L);
}
}
else {
LOGGER.error("Innovate MTS: Error - no input channels found to log from!");
}
}
finally {
mts.disconnect();
}
} finally {
}
finally {
connectionEventCookie.close();
mts.dispose();
}
}
}
public void connectionEvent(int result) {
if (result == 0) {
mts.startData();
}
else if (result == -1) {
throw new IllegalStateException("No Innovate MTS Data detected");
}
else {
throw new IllegalStateException("Innovate MTS Connect Error: " + result);
}
}
public void connectionError() {
mts.disconnect();
throw new IllegalStateException("Innovate MTS Connection Timeout");
}
public void newData() {
for (int i = 0; i < mts.inputCount(); i++) {
float data = 0f;
// select the input
mts.currentInput(i);
int type = mts.inputType();
int function = mts.inputFunction();
int sample = mts.inputSample();
LOGGER.trace("Innovate MTS input = " + i + ", type = " + type + ", function = " + function + ", sample = " + sample);
// 5V channel
// Determine the range between min and max,
// calculate what percentage of that our sample represents,
// shift back to match our offset from 0.0 for min
if (type == MTS_TYPE_VDC.getType()) {
if (function == MTS_FUNC_NOTLAMBDA.getFunction()) {
float min = mts.inputMinValue();
float max = mts.inputMaxValue();
data = ((max - min) * ((float) sample / 1024f)) + min;
}
else {
// this will report other functions, such as ERROR states
// as a negative constant value
data = (float)function * -1f;
}
}
// AFR
// Take each sample step as .001 Lambda,
// add 0.5 (so our range is 0.5 to 1.523 for our 1024 steps),
// then multiply by the AFR multiplier
if (type == MTS_TYPE_AFR.getType()) {
if (function == MTS_FUNC_LAMBDA.getFunction()) {
float multiplier = mts.inputAFRMultiplier();
data = ((float) sample / 1000f + 0.5f) * multiplier;
}
else if (function == MTS_FUNC_O2.getFunction()) {
data = ((float) sample / 10f);
}
else {
// this will report other functions, such as ERROR states
// as a negative constant value
data = (float)function * -1f;
}
}
// LAMBDA
// Identical to AFR, except we do not multiply for AFR.
if (type == MTS_TYPE_LAMBDA.getType()) {
if (function == MTS_FUNC_LAMBDA.getFunction()) {
data = (float) sample / 1000f + 0.5f;
}
else {
// this will report other functions, such as ERROR states
// as a negative constant value
data = (float)function * -1f;
}
}
// set data for this sensor based on inputNumber
Lm2MtsDataItem dataItem = dataItems.get(i);
if (dataItem != null) dataItem.setData(data);
}
}
}

View File

@ -17,9 +17,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.romraider.logger.external.innovate.lm2.mts.plugin;
package com.romraider.logger.external.innovate.generic.mts.io;
public class Lm2Sensor {
public class MTSSensor {
private int inputNumber = 0;
private String inputName = "";
private String deviceName = "";
@ -28,7 +28,12 @@ public class Lm2Sensor {
private float minValue = 0f;
private float maxValue = 0f;
public Lm2Sensor() {
/**
* MTSSensor contains all the relevant information about a sensor as
* reported from information gathered from the MTS stream. A MTSSensor is
* created for each input found in the MTS stream.
*/
public MTSSensor() {
}
public int getInputNumber() {

View File

@ -0,0 +1,57 @@
/*
* 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.innovate.generic.mts.io;
public enum MTSSensorInputFunction {
MTS_FUNC_LAMBDA(0),
MTS_FUNC_O2(1),
MTS_FUNC_INCALIB(2),
MTS_FUNC_RQCALIB(3),
MTS_FUNC_WARMUP(4),
MTS_FUNC_HTRCAL(5),
MTS_FUNC_ERROR(6),
MTS_FUNC_FLASHLEV(7),
MTS_FUNC_SERMODE(8),
MTS_FUNC_NOTLAMBDA(9),
MTS_FUNC_INVALID(10);
private final int function;
private MTSSensorInputFunction(int function) {
this.function = function;
}
/**
* MTSSensorInputFunction contains the values associated with the various
* functions of the sensors reported to be in the MTS stream. Some functions
* report the state of the sensor, such as, a WBO2 that is in warm-up state (4).
*/
public int getFunction() {
return function;
}
public static MTSSensorInputFunction valueOf(int function) {
for (MTSSensorInputFunction type : values()) {
if (type.getFunction() == function)
return type;
}
return MTS_FUNC_INVALID;
}
}

View File

@ -17,29 +17,30 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
package com.romraider.logger.external.innovate.lm2.mts.plugin;
package com.romraider.logger.external.innovate.generic.mts.io;
public enum Lm2SensorType {
//SENSOR_NAME(InputNumber)
LC_1_0(0),
TC_4_1(17),
TC_4_2(18),
TC_4_3(19),
TC_4_4(20);
public enum MTSSensorInputType {
MTS_TYPE_LAMBDA(0),
MTS_TYPE_AFR(1),
MTS_TYPE_VDC(2);
private final int inputNumber;
private final int inputType;
private Lm2SensorType(int inputNumber) {
this.inputNumber = inputNumber;
private MTSSensorInputType(int inputType) {
this.inputType = inputType;
}
public int getInputNumber() {
return inputNumber;
/**
* MTSSensorInputType contains the values associated with the various
* types of sensors reported to be in the MTS stream.
*/
public int getType() {
return inputType;
}
public static Lm2SensorType valueOf(int inputNumber) {
for (Lm2SensorType type : values()) {
if (type.getInputNumber() == inputNumber)
public static MTSSensorInputType valueOf(int inputType) {
for (MTSSensorInputType type : values()) {
if (type.getType() == inputType)
return type;
}
return null;

View File

@ -19,28 +19,32 @@
package com.romraider.logger.external.innovate.lm2.mts.plugin;
import static com.romraider.logger.external.core.ExternalDataConvertorLoader.loadConvertors;
import com.romraider.logger.ecu.definition.EcuDataConvertor;
import com.romraider.logger.ecu.definition.ExternalDataConvertorImpl;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.DataListener;
import com.romraider.logger.external.core.ExternalDataItem;
import com.romraider.logger.external.core.ExternalSensorConversions;
public final class Lm2MtsDataItem implements ExternalDataItem, DataListener {
//private EcuDataConvertor[] convertors;
private final String name;
private final GaugeMinMax gaugeMinMax;
private int channel;
private double data;
private String units;
public Lm2MtsDataItem(String name, int channel, String units) {
public Lm2MtsDataItem(String name, int channel, String units, float minValue, float maxValue) {
super();
this.name = name;
this.channel = channel;
this.units = units;
// convertors = new EcuDataConvertor[convertorList.length];
// convertors = loadConvertors(this, convertors, convertorList);
float step = (Math.abs(maxValue) + Math.abs(minValue)) / 10f;
if (step > 0.5f) {
step = (float) Math.round(step);
}
else {
step = 0.5f;
}
gaugeMinMax = new GaugeMinMax(minValue, maxValue, step);
}
public String getName() {
@ -48,7 +52,7 @@ public final class Lm2MtsDataItem implements ExternalDataItem, DataListener {
}
public String getDescription() {
return "Innovate MTS " + name + " CH" +channel + " data";
return "Innovate MTS " + name + " CH" + channel + " data";
}
public int getChannel() {
@ -68,6 +72,13 @@ public final class Lm2MtsDataItem implements ExternalDataItem, DataListener {
}
public EcuDataConvertor[] getConvertors() {
EcuDataConvertor[] convertors = {new ExternalDataConvertorImpl(this, units, "x", "0.00")};
return convertors; }
EcuDataConvertor[] convertors = {
new ExternalDataConvertorImpl(
this,
units,
"x",
"0.##",
gaugeMinMax)};
return convertors;
}
}

View File

@ -37,27 +37,44 @@ import org.apache.log4j.Logger;
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.innovate.generic.mts.io.MTSSensor;
import com.romraider.logger.external.innovate.generic.mts.io.MTSConnector;
import com.romraider.logger.external.innovate.generic.mts.io.MTSRunner;
public final class Lm2MtsDataSource implements ExternalDataSource {
private static final Logger LOGGER = getLogger(Lm2MtsDataSource.class);
private final Map<Integer, Lm2MtsDataItem> dataItems = new HashMap<Integer, Lm2MtsDataItem>();
private MTSRunner runner;
private int mtsPort = 0;
private int mtsPort = -1;
/**
* The Lm2MtsDataSource class is called when the Logger starts up and the
* call to load the external plug-ins is made. The class with its helpers
* will open the MTS SDK and find all available ports. It will interrogate
* the ports for available streams then dynamically build a list of sensors
* reported in the MTS streams. If there is more than one MTS stream, only
* one stream can be processed.
*/
{
MTSConnector mts = new MTSConnector(mtsPort);
Set<Lm2Sensor> sensors = mts.getSensors();
dataItems.put(0, new Lm2MtsDataItem("LM-2", 0, "AFR")); // a default entry
for (Lm2Sensor sensor : sensors) {
dataItems.put(sensor.getInputNumber(), new Lm2MtsDataItem(sensor.getDeviceName(), sensor.getDeviceChannel(), sensor.getUnits()));
final MTSConnector connector = new MTSConnector();
int[] ports = connector.getMtsPorts();
for (int i = 0; i < ports.length; i++) {
connector.usePort(i);
Set<MTSSensor> sensors = connector.getSensors();
dataItems.put(0, new Lm2MtsDataItem("LM-2", 0, "AFR", 20, 9)); // a default entry
for (MTSSensor sensor : sensors) {
dataItems.put(
sensor.getInputNumber(),
new Lm2MtsDataItem(
sensor.getDeviceName(),
sensor.getDeviceChannel(),
sensor.getUnits(),
sensor.getMinValue(),
sensor.getMaxValue()
));
}
}
// dataItems.put(LC_1_0, new Lm2MtsDataItem("LM-2", 0, LAMBDA, AFR_147, AFR_90, AFR_146, AFR_64, AFR_155, AFR_172, AFR_34));
// dataItems.put(TC_4_1, new Lm2MtsDataItem("TC-4", 1, DEG_F));
// dataItems.put(TC_4_2, new Lm2MtsDataItem("TC-4", 2, DEG_C));
// dataItems.put(TC_4_3, new Lm2MtsDataItem("TC-4", 3, DEG_C));
// dataItems.put(TC_4_4, new Lm2MtsDataItem("TC-4", 4, DEG_C));
}
public String getId() {
@ -101,7 +118,7 @@ public final class Lm2MtsDataSource implements ExternalDataSource {
try {
return parseInt(port);
} catch (Exception e) {
LOGGER.warn("Bad MTS port: " + port);
LOGGER.warn("Bad Innovate MTS port: " + port);
return -1;
}
}

View File

@ -44,6 +44,7 @@ public final class Lm2MtsPluginMenuAction extends AbstractAction {
private String[] getPorts() {
MTS mts = createMTS();
mts.disconnect();
try {
int portCount = mts.portCount();
String[] result = new String[portCount];

View File

@ -1,40 +0,0 @@
/*
* 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.innovate.lm2.mts.plugin;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum Lm2SensorConversions implements ExternalSensorConversions {
AFR_xx ("AFR Hydrogen", "x*2.312925170068027", "0.00"); // Hydrogen
private final String units;
private final String expression;
private final String format;
Lm2SensorConversions(String units, String expression, String format) {
this.units = units;
this.expression = expression;
this.format = format;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
}

View File

@ -19,55 +19,61 @@
package com.romraider.logger.external.plx.plugin;
import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum PlxSensorConversions implements ExternalSensorConversions {
LAMBDA ("Lambda", "(x/3.75+68)/100", "0.00"),
AFR_147 ("AFR Gasoline", "(x/2.55+100)/10", "0.00"), // gasoline
AFR_90 ("AFR Ethonal", "(x/4.167+61.7)/10", "0.00"), // ethanol
AFR_146 ("AFR Diesel", "(x/2.58+100)/10", "0.00"), // diesel
AFR_64 ("AFR Methonal", "(x/5.856+43.5)/10", "0.00"),// methanol
AFR_155 ("AFR LPG", "(x/2.417+105.6)/10", "0.00"), // LPG
AFR_172 ("AFR CNG", "(x/2.18+117)/10", "0.00"), // CNG
AFR_34 ("AFR Hydrogen", "(x/3.75+68)*0.34", "0.00"), // Hydrogen
DEG_C ("C", "x", "0.0"),
DEG_F ("F", "(x/.555+32)", "0.0"),
VACUUM_IN ("in/Hg", "-(x/11.39-29.93)", "0.00"),
VACUUM_MM ("mm/Hg", "-(x*2.23+760.4)", "0.00"),
BOOST_PSI ("psi", "x/22.73", "0.00"),
BOOST_BAR ("bar", "x*0.00303333", "0.00"), // converts from PSI to bar
BOOST_KPA ("kPa", "x*0.30333292", "0.0"), // converts from PSI to kpa
BOOST_KGCM2 ("kg/cm^2", "x/329.47", "0.00"),
RPM ("rpm", "x*19.55", "0"),
MPH ("mph", "x/6.39", "0.0"),
KPH ("kph", "x/3.97", "0.0"),
PERCENT ("%", "x", "0.0"),
FLUID_PSI ("psi", "x/5.115", "0.00"),
FLUID_BAR ("bar", "x/74.22", "0.00"),
FLUID_KPA ("kPa", "x*1.34794864", "0.00"), // converts from PSI to kpa
FLUID_KGCM2 ("kg/cm^2", "x/72.73", "0.00"),
DEGREES ("deg", "x-64", "0.00"),
MAF_GS ("g/sec", "x", "0.00"),
MAF_LB ("lb/min", "x/7.54", "0.00"),
FUEL_TRIM ("%", "x-100", "0.00"),
NB_P ("%", "x", "0.00"),
NB_V ("vdc", "x/78.43", "0.00"),
BATTERY ("vdc", "x/51.15", "0.00"),
KNOCK_VDC ("vdc", "x/204.6", "0.00"),
DC_POS ("+%", "x/10.23", "0.0"),
DC_NEG ("-%", "100-(x/10.23)", "0.0");
LAMBDA ("Lambda", "(x/3.75+68)/100", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
AFR_147 ("AFR Gasoline", "(x/2.55+100)/10", "0.00", new GaugeMinMax(9,20,1)), // gasoline
AFR_90 ("AFR Ethonal", "(x/4.167+61.7)/10", "0.00", new GaugeMinMax(5,12,1)), // ethanol
AFR_146 ("AFR Diesel", "(x/2.58+100)/10", "0.00", new GaugeMinMax(9,20,1)), // diesel
AFR_64 ("AFR Methonal", "(x/5.856+43.5)/10", "0.00", new GaugeMinMax(4,9,1)),// methanol
AFR_155 ("AFR LPG", "(x/2.417+105.6)/10", "0.00", new GaugeMinMax(9,20,1)), // LPG
AFR_172 ("AFR CNG", "(x/2.18+117)/10", "0.00", new GaugeMinMax(9,20,1)), // CNG
AFR_34 ("AFR Hydrogen", "(x/3.75+68)*0.34", "0.00", new GaugeMinMax(20,46,2.5)), // Hydrogen
DEG_C ("C", "x", "0.0", getDefault()),
DEG_F ("F", "(x/.555+32)", "0.0", getDefault()),
VACUUM_IN ("in/Hg", "-(x/11.39-29.93)", "0.00", getDefault()),
VACUUM_MM ("mm/Hg", "-(x*2.23+760.4)", "0.00", getDefault()),
BOOST_PSI ("psi", "x/22.73", "0.00", getDefault()),
BOOST_BAR ("bar", "x*0.00303333", "0.00", getDefault()), // converts from PSI to bar
BOOST_KPA ("kPa", "x*0.30333292", "0.0", getDefault()), // converts from PSI to kpa
BOOST_KGCM2 ("kg/cm^2", "x/329.47", "0.00", getDefault()),
RPM ("rpm", "x*19.55", "0", new GaugeMinMax(0,10000,1000)),
MPH ("mph", "x/6.39", "0.0", getDefault()),
KPH ("kph", "x/3.97", "0.0", getDefault()),
PERCENT ("%", "x", "0.0", getDefault()),
FLUID_PSI ("psi", "x/5.115", "0.00", getDefault()),
FLUID_BAR ("bar", "x/74.22", "0.00", getDefault()),
FLUID_KPA ("kPa", "x*1.34794864", "0.00", getDefault()), // converts from PSI to kpa
FLUID_KGCM2 ("kg/cm^2", "x/72.73", "0.00", getDefault()),
DEGREES ("deg", "x-64", "0.00", getDefault()),
MAF_GS ("g/sec", "x", "0.00", getDefault()),
MAF_LB ("lb/min", "x/7.54", "0.00", getDefault()),
FUEL_TRIM ("%", "x-100", "0.00", getDefault()),
NB_P ("%", "x", "0.00", getDefault()),
NB_V ("vdc", "x/78.43", "0.00", getDefault()),
BATTERY ("vdc", "x/51.15", "0.00", new GaugeMinMax(0,12,1)),
KNOCK_VDC ("vdc", "x/204.6", "0.00", getDefault()),
DC_POS ("+%", "x/10.23", "0.0", getDefault()),
DC_NEG ("-%", "100-(x/10.23)", "0.0", getDefault());
private final String units;
private final String expression;
private final String format;
private final GaugeMinMax gaugeMinMax;
PlxSensorConversions(String units, String expression, String format) {
PlxSensorConversions(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
this.units = units;
this.expression = expression;
this.format = format;
this.gaugeMinMax = gaugeMinMax;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
}

View File

@ -19,33 +19,39 @@
package com.romraider.logger.external.te.plugin;
import static com.romraider.logger.ecu.definition.xml.ConverterMaxMinDefaults.getDefault;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum TESensorConversions implements ExternalSensorConversions {
LAMBDA ("Lambda", "x/8192+0.5", "0.00"),
AFR_147 ("AFR Gasoline", "(x/8192+0.5)*14.7", "0.00"),// gasoline
AFR_90 ("AFR Ethonal", "(x/8192+0.5)*9.0", "0.00"), // ethanol
AFR_146 ("AFR Diesel", "(x/8192+0.5)*14.6", "0.00"), // diesel
AFR_64 ("AFR Methonal", "(x/8192+0.5)*6.4", "0.00"), // methanol
AFR_155 ("AFR LPG", "(x/8192+0.5)*15.5", "0.00"), // LPG
AFR_172 ("AFR CNG", "(x/8192+0.5)*17.2", "0.00"), // CNG
AFR_34 ("AFR Hydrogen", "(x/8192+0.5)*34", "0.00"), // Hydrogen
VDC ("VDC", "x*0.000610948", "0.00"),
TC ("raw", "x*0.004887586", "0.00"),
THERM ("raw", "x", "0.00"),
RPM_4 ("RPM", "60/(x*0.00001)", "0");
LAMBDA ("Lambda", "x/8192+0.5", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
AFR_147 ("AFR Gasoline", "(x/8192+0.5)*14.7", "0.00", new GaugeMinMax(9,20,1)),// gasoline
AFR_90 ("AFR Ethonal", "(x/8192+0.5)*9.0", "0.00", new GaugeMinMax(5,12,1)), // ethanol
AFR_146 ("AFR Diesel", "(x/8192+0.5)*14.6", "0.00", new GaugeMinMax(9,20,1)), // diesel
AFR_64 ("AFR Methonal", "(x/8192+0.5)*6.4", "0.00", new GaugeMinMax(4,9,1)), // methanol
AFR_155 ("AFR LPG", "(x/8192+0.5)*15.5", "0.00", new GaugeMinMax(9,20,1)), // LPG
AFR_172 ("AFR CNG", "(x/8192+0.5)*17.2", "0.00", new GaugeMinMax(9,20,1)), // CNG
AFR_34 ("AFR Hydrogen", "(x/8192+0.5)*34", "0.00", new GaugeMinMax(20,46,2.5)), // Hydrogen
VDC ("VDC", "x*0.000610948", "0.00", new GaugeMinMax(0,12,1)),
TC ("raw", "x*0.004887586", "0.00", getDefault()),
THERM ("raw", "x", "0.00", getDefault()),
RPM_4 ("RPM", "60/(x*0.00001)", "0", new GaugeMinMax(0,10000,1000));
private final String units;
private final String expression;
private final String format;
private final GaugeMinMax gaugeMinMax;
TESensorConversions(String units, String expression, String format) {
TESensorConversions(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
this.units = units;
this.expression = expression;
this.format = format;
this.gaugeMinMax = gaugeMinMax;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
}

View File

@ -19,35 +19,39 @@
package com.romraider.logger.external.zt2.plugin;
import com.romraider.logger.ecu.ui.handler.dash.GaugeMinMax;
import com.romraider.logger.external.core.ExternalSensorConversions;
public enum ZT2SensorConversions implements ExternalSensorConversions {
// AFR conversion assumes reported DATA value is Gas AFR
LAMBDA ("Lambda", "x*0.00680272108843537", "0.00"),
AFR_147 ("AFR Gasoline", "x*0.1", "0.00"), // gasoline
AFR_90 ("AFR Ethonal", "x*0.06122448979591837", "0.00"), // ethanol
AFR_146 ("AFR Diesel", "x*0.09931972789115646", "0.00"), // diesel
AFR_64 ("AFR Methonal", "x*0.04353741496598639", "0.00"),// methanol
AFR_155 ("AFR LPG", "x*0.1054421768707483", "0.00"), // LPG
AFR_172 ("AFR CNG", "x*0.1170068027210884", "0.00"), // CNG
AFR_34 ("AFR Hydrogen", "x*0.2312925170068027", "0.00"), // Hydrogen
BOOST_PSI ("psi", "x*0.1", "0.00"),
BOOST_BAR ("bar", "x*0.0068947573", "0.00"), // converts from PSI
BOOST_KPA ("kPa", "x*0.6894757282", "0.0"), // converts from PSI
BOOST_KGCM2 ("kg/cm^2", "x*0.0070306958", "0.00"), // converts from PSI
RPM ("rpm", "round(((1000000/x)*4.59)/2)", "0");
LAMBDA ("Lambda", "x*0.00680272108843537", "0.00", new GaugeMinMax(0.6,1.4,0.08)),
AFR_147 ("AFR Gasoline", "x*0.1", "0.00", new GaugeMinMax(9,20,1)), // gasoline
AFR_90 ("AFR Ethonal", "x*0.06122448979591837", "0.00", new GaugeMinMax(5,12,1)), // ethanol
AFR_146 ("AFR Diesel", "x*0.09931972789115646", "0.00", new GaugeMinMax(9,20,1)), // diesel
AFR_64 ("AFR Methonal", "x*0.04353741496598639", "0.00", new GaugeMinMax(4,9,1)),// methanol
AFR_155 ("AFR LPG", "x*0.1054421768707483", "0.00", new GaugeMinMax(9,20,1)), // LPG
AFR_172 ("AFR CNG", "x*0.1170068027210884", "0.00", new GaugeMinMax(9,20,1)), // CNG
AFR_34 ("AFR Hydrogen", "x*0.2312925170068027", "0.00", new GaugeMinMax(20,46,2.5)), // Hydrogen
BOOST_PSI ("psi", "x*0.1", "0.00", new GaugeMinMax(-10,30,5)),
BOOST_BAR ("bar", "x*0.0068947573", "0.00", new GaugeMinMax(-0.5,4,0.5)), // converts from PSI
BOOST_KPA ("kPa", "x*0.6894757282", "0.0", new GaugeMinMax(98,120,2)), // converts from PSI
BOOST_KGCM2 ("kg/cm^2", "x*0.0070306958", "0.00", new GaugeMinMax(-0.5,2.5,0.5)), // converts from PSI
RPM ("rpm", "round(((1000000/x)*4.59)/2)", "0", new GaugeMinMax(0,10000,1000));
private final String units;
private final String expression;
private final String format;
private final GaugeMinMax gaugeMinMax;
ZT2SensorConversions(String units, String expression, String format) {
ZT2SensorConversions(String units, String expression, String format, GaugeMinMax gaugeMinMax) {
this.units = units;
this.expression = expression;
this.format = format;
this.gaugeMinMax = gaugeMinMax;
}
public String units() { return units; }
public String expression() { return expression; }
public String format() { return format; }
public GaugeMinMax gaugeMinMax() {return gaugeMinMax; }
}

View File

@ -20,10 +20,10 @@ release_notes=release_notes.txt
version.major=0
version.minor=5
version.patch=3
version.patch=4
version.buildnumber=${buildnumber}
version.extra=Beta
version.extra1=RC10
version.extra1=pre-RC1
# the starting class for the application
class.start=com.romraider.ECUExec