mirror of https://github.com/rusefi/RomRaider.git
Add APSX D1|D2 Wideband O2 Externals Plugin
This commit is contained in:
parent
e04dc48276
commit
84f6e0f230
|
@ -0,0 +1,5 @@
|
|||
datasource.class=com.romraider.logger.external.apsx.plugin.ApsxDataSource
|
||||
datasource.baudrate=9600
|
||||
datasource.databits=8
|
||||
datasource.parity=0
|
||||
datasource.stopbits=1
|
|
@ -0,0 +1,60 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2015 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.apsx.io;
|
||||
|
||||
import static org.apache.log4j.Logger.getLogger;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import com.romraider.io.connection.ConnectionProperties;
|
||||
import com.romraider.io.serial.connection.SerialConnection;
|
||||
import com.romraider.io.serial.connection.SerialConnectionImpl;
|
||||
import com.romraider.logger.external.apsx.plugin.ApsxDataItem;
|
||||
import com.romraider.logger.external.core.Stoppable;
|
||||
|
||||
public final class ApsxRunner implements Stoppable {
|
||||
private static final Logger LOGGER = getLogger(ApsxRunner.class);
|
||||
private final SerialConnection connection;
|
||||
private final ApsxDataItem dataItem;
|
||||
private boolean stop;
|
||||
|
||||
public ApsxRunner(String port, ApsxDataItem dataItem, ConnectionProperties properties) {
|
||||
this.connection = new SerialConnectionImpl(port, properties);
|
||||
this.dataItem = dataItem;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
while (!stop) {
|
||||
final int response = connection.read();
|
||||
LOGGER.trace("APSX AFR Response: " + response);
|
||||
if (response != -1) dataItem.setData(response / 10.0);
|
||||
}
|
||||
} catch (Throwable t) {
|
||||
LOGGER.error("Error occurred", t);
|
||||
} finally {
|
||||
connection.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
stop = true;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2015 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.apsx.plugin;
|
||||
|
||||
import static com.romraider.logger.external.core.ExternalDataConvertorLoader.loadConvertors;
|
||||
|
||||
import com.romraider.logger.ecu.definition.EcuDataConvertor;
|
||||
import com.romraider.logger.external.core.DataListener;
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
import com.romraider.logger.external.core.ExternalSensorConversions;
|
||||
|
||||
public final class ApsxDataItem implements ExternalDataItem, DataListener {
|
||||
private EcuDataConvertor[] convertors;
|
||||
private double data;
|
||||
|
||||
public ApsxDataItem(ExternalSensorConversions... convertorList) {
|
||||
super();
|
||||
convertors = new EcuDataConvertor[convertorList.length];
|
||||
convertors = loadConvertors(this, convertors, convertorList);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "APSX Wideband AFR";
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return "APSX Wideband data";
|
||||
}
|
||||
|
||||
public double getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(double data) {
|
||||
this.data = data;
|
||||
}
|
||||
|
||||
public EcuDataConvertor[] getConvertors() {
|
||||
return convertors;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* RomRaider Open-Source Tuning, Logging and Reflashing
|
||||
* Copyright (C) 2006-2015 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.apsx.plugin;
|
||||
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_146;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_147;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_155;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_172;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_34;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_64;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.AFR_90;
|
||||
import static com.romraider.logger.external.core.SensorConversionsAFR.LAMBDA;
|
||||
import static com.romraider.util.ThreadUtil.runAsDaemon;
|
||||
import static java.util.Arrays.asList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.swing.Action;
|
||||
|
||||
import com.romraider.io.connection.SerialConnectionProperties;
|
||||
import com.romraider.logger.ecu.EcuLogger;
|
||||
import com.romraider.logger.external.apsx.io.ApsxRunner;
|
||||
import com.romraider.logger.external.core.ExternalDataItem;
|
||||
import com.romraider.logger.external.core.ExternalDataSource;
|
||||
|
||||
public final class ApsxDataSource implements ExternalDataSource {
|
||||
private SerialConnectionProperties connectionProperties;
|
||||
private ApsxDataItem dataItem = new ApsxDataItem(AFR_147, LAMBDA, AFR_90, AFR_146, AFR_64, AFR_155, AFR_172, AFR_34);
|
||||
private ApsxRunner runner;
|
||||
private String port;
|
||||
|
||||
public String getId() {
|
||||
return getClass().getName();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return "APSX D1|D2 WBO2";
|
||||
}
|
||||
|
||||
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 setProperties(Properties properties) {
|
||||
connectionProperties = new SerialConnectionProperties(
|
||||
Integer.parseInt(properties.getProperty("datasource.baudrate")),
|
||||
Integer.parseInt(properties.getProperty("datasource.databits")),
|
||||
Integer.parseInt(properties.getProperty("datasource.stopbits")),
|
||||
Integer.parseInt(properties.getProperty("datasource.parity")),
|
||||
2000, 500
|
||||
);
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
runner = new ApsxRunner(port, dataItem, connectionProperties);
|
||||
runAsDaemon(runner);
|
||||
}
|
||||
|
||||
public void disconnect() {
|
||||
if (runner != null) runner.stop();
|
||||
}
|
||||
}
|
|
@ -58,6 +58,7 @@
|
|||
<file src="plugins/aem2.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/aem.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/aem.xwifi.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/apsx.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/ecotrons.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/fourteenpoint7.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/innovate.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
|
@ -77,6 +78,7 @@
|
|||
<exclude name="plugins/aem2.plugin"/>
|
||||
<exclude name="plugins/aem.plugin"/>
|
||||
<exclude name="plugins/aem.xwifi.plugin"/>
|
||||
<exclude name="plugins/apsx.plugin"/>
|
||||
<exclude name="plugins/ecotrons.plugin"/>
|
||||
<exclude name="plugins/fourteenpoint7.plugin"/>
|
||||
<exclude name="plugins/innovate.plugin"/>
|
||||
|
|
|
@ -57,6 +57,7 @@
|
|||
<file src="plugins/aem2.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/aem.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/aem.xwifi.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/apsx.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/fourteenpoint7.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/ecotrons.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
<file src="plugins/innovate.plugin" targetdir="$INSTALL_PATH/plugins"/>
|
||||
|
@ -77,6 +78,7 @@
|
|||
<exclude name="plugins/aem.plugin"/>
|
||||
<exclude name="plugins/aem2.plugin"/>
|
||||
<exclude name="plugins/aem.xwifi.plugin"/>
|
||||
<exclude name="plugins/apsx.plugin"/>
|
||||
<exclude name="plugins/ecotrons.plugin"/>
|
||||
<exclude name="plugins/fourteenpoint7.plugin"/>
|
||||
<exclude name="plugins/innovate.plugin"/>
|
||||
|
|
Loading…
Reference in New Issue