mirror of https://github.com/rusefi/RomRaider.git
added simple lc-1 support (unfinished)
git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@692 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
parent
7d486eac46
commit
e37010cc88
|
@ -3,23 +3,14 @@ package enginuity.logger.innovate.plugin;
|
|||
import enginuity.logger.ecu.external.ExternalDataItem;
|
||||
import static enginuity.util.ThreadUtil.runAsDaemon;
|
||||
|
||||
public final class InnovateControllerImpl implements InnovateController, DataListener {
|
||||
private Lc1Convertor convertor = new Lc1ConvertorImpl();
|
||||
private byte[] bytes;
|
||||
public final class InnovateControllerImpl implements InnovateController {
|
||||
private Lc1DataItem dataItem = new Lc1DataItem();
|
||||
|
||||
public InnovateControllerImpl(InnovateConnection connection) {
|
||||
runAsDaemon(new InnovateRunnerImpl(connection, this));
|
||||
runAsDaemon(new InnovateRunnerImpl(connection, dataItem));
|
||||
}
|
||||
|
||||
public synchronized ExternalDataItem getDataItem() {
|
||||
if (bytes != null) {
|
||||
return new Lc1DataItem(convertor.convert(bytes));
|
||||
} else {
|
||||
return new Lc1DataItem(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void setBytes(byte[] bytes) {
|
||||
this.bytes = bytes;
|
||||
return dataItem;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ public final class Lc1ConvertorImpl implements Lc1Convertor {
|
|||
}
|
||||
|
||||
private double getAfr(byte[] bytes) {
|
||||
return (getLambda(bytes) + 500) * getAF(bytes) / 10000;
|
||||
return (getLambda(bytes) + 500) * getAF(bytes) / 10000.0;
|
||||
}
|
||||
|
||||
private int getAF(byte[] bytes) {
|
||||
|
|
|
@ -2,12 +2,9 @@ package enginuity.logger.innovate.plugin;
|
|||
|
||||
import enginuity.logger.ecu.external.ExternalDataItem;
|
||||
|
||||
public final class Lc1DataItem implements ExternalDataItem {
|
||||
private final double data;
|
||||
|
||||
public Lc1DataItem(double data) {
|
||||
this.data = data;
|
||||
}
|
||||
public final class Lc1DataItem implements ExternalDataItem, DataListener {
|
||||
private Lc1Convertor convertor = new Lc1ConvertorImpl();
|
||||
private byte[] bytes;
|
||||
|
||||
public String getName() {
|
||||
return "LC-1";
|
||||
|
@ -22,6 +19,14 @@ public final class Lc1DataItem implements ExternalDataItem {
|
|||
}
|
||||
|
||||
public double getData() {
|
||||
return data;
|
||||
if (bytes != null) {
|
||||
return convertor.convert(bytes);
|
||||
} else {
|
||||
return 0.0;
|
||||
}
|
||||
}
|
||||
|
||||
public void setBytes(byte[] bytes) {
|
||||
this.bytes = bytes;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,10 +9,12 @@ import java.util.List;
|
|||
|
||||
public final class Lc1DataSource implements ExternalDataSource {
|
||||
private InnovateController controller;
|
||||
private List<ExternalDataItem> dataItems;
|
||||
|
||||
public Lc1DataSource() {
|
||||
Lc1Connection connection = new Lc1Connection(new InnovateConnectionProperties(), "COM6");
|
||||
controller = new InnovateControllerImpl(connection);
|
||||
dataItems = asList(controller.getDataItem());
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
|
@ -24,7 +26,7 @@ public final class Lc1DataSource implements ExternalDataSource {
|
|||
}
|
||||
|
||||
public List<ExternalDataItem> getDataItems() {
|
||||
return asList(controller.getDataItem());
|
||||
return dataItems;
|
||||
}
|
||||
|
||||
public void setCommPortChoice(String commPort) {
|
||||
|
|
Loading…
Reference in New Issue