updated lc-1 support (unfinished)

git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@697 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d
This commit is contained in:
kascade 2007-06-13 12:52:25 +00:00
parent dcaed25b98
commit 6294351edf
2 changed files with 3 additions and 13 deletions

View File

@ -1,7 +1,6 @@
package enginuity.logger.innovate.plugin;
import enginuity.logger.innovate.io.InnovateConnectionProperties;
import static enginuity.util.HexUtil.asHex;
public final class InnovateRunnerImpl implements InnovateRunner {
private final InnovateConnection connection;
@ -17,7 +16,6 @@ public final class InnovateRunnerImpl implements InnovateRunner {
try {
while (!stop) {
byte[] bytes = connection.read();
System.out.println("Read bytes = " + asHex(bytes));
listener.setBytes(bytes);
}
} finally {

View File

@ -1,14 +1,10 @@
package enginuity.logger.innovate.plugin;
import static enginuity.util.HexUtil.asHex;
public final class Lc1ConvertorImpl implements Lc1Convertor {
public double convert(byte[] bytes) {
/*
10110010 10000010 01000011 00010011 00010111 00101111
Example bytes: 10110010 10000010 01000011 00010011 00010111 00101111
*/
// check header
System.out.println("Converting bytes = " + asHex(bytes));
if (isLc1(bytes) && isHeaderValid(bytes)) {
if (isError(bytes)) {
return -1 * getLambda(bytes);
@ -25,15 +21,11 @@ public final class Lc1ConvertorImpl implements Lc1Convertor {
}
private int getAF(byte[] bytes) {
int af = (((bytes[2] | 254) & 1) << 7) | bytes[3];
System.out.println("af = " + af);
return af;
return (((bytes[2] | 254) & 1) << 7) | bytes[3];
}
private int getLambda(byte[] bytes) {
int lambda = ((bytes[4] & 63) << 7) | bytes[5];
System.out.println("lambda = " + lambda);
return lambda;
return ((bytes[4] & 63) << 7) | bytes[5];
}
private boolean isOk(byte[] bytes) {