This commit is contained in:
rusefillc 2024-01-13 01:08:24 -05:00
parent fe48468748
commit 833c3056b9
77 changed files with 18 additions and 32 deletions

View File

@ -13,11 +13,6 @@ allprojects {
}
}
dependencies {
implementation libs.snakeyaml
testImplementation libs.junit
}
defaultTasks 'jar'
jar {

View File

@ -3,10 +3,8 @@ plugins {
id 'java-library'
}
apply from: '../dependencies.gradle'
dependencies {
api rootProject
api project(':reader')
api project(':peak-can-basic')
api libs.annotations
api group: 'tel.schich', name: 'javacan-core', version: "$javaCanVersion"

View File

@ -1,9 +1,9 @@
package com.rusefi.can;
import com.rusefi.can.reader.impl.CANoeReader;
import com.rusefi.can.deprecated.decoders.PacketDecoder;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.decoders.bmw.BmwRegistry;
import com.rusefi.can.reader.impl.CANoeReader;
import java.io.FileWriter;
import java.io.IOException;

View File

@ -2,8 +2,6 @@ package com.rusefi.can;
import com.rusefi.util.BitMathUtil;
import static com.rusefi.can.Utils.bytesToHexWithSpaces;
public class CANPacket {
private final double timeStamp;
private final int id;
@ -68,7 +66,7 @@ public class CANPacket {
public void assertThat(String msg, PackerAssertion assertion) {
if (!assertion.test(this))
throw new IllegalStateException("Not " + msg + " " + bytesToHexWithSpaces(data));
throw new IllegalStateException("Not " + msg + " " + Utils.bytesToHexWithSpaces(data));
}
public int getUnsignedInt(int index) {

View File

@ -1,7 +1,7 @@
package com.rusefi.can;
import com.rusefi.can.reader.CANLineReader;
import com.rusefi.can.reader.dbc.DbcFile;
import com.rusefi.can.reader.CANLineReader;
import com.rusefi.mlv.LoggingStrategy;
import com.rusefi.util.FolderUtil;

View File

@ -29,7 +29,7 @@ public class PerSidDump {
// O(n*M) is not so bad
for (int sid : sids) {
String outputFileName = filteredDestinationFolder + File.separator + simpleFileName + "_filtered_" + dualSid(sid, "_") + ".txt";
String outputFileName = filteredDestinationFolder + File.separator + simpleFileName + "_filtered_" + ByteRateOfChange.dualSid(sid, "_") + ".txt";
PrintWriter pw = new PrintWriter(new FileOutputStream(outputFileName));
List<CANPacket> filteredPackets = new ArrayList<>();
@ -47,7 +47,7 @@ public class PerSidDump {
int middleIndex = filteredPackets.size() / 2;
CANPacket middlePacket = filteredPackets.get(middleIndex);
String middleOutputFileName = filteredDestinationFolder + File.separator + simpleFileName + "_filtered_" + dualSid(sid, "_") + "_middle.txt";
String middleOutputFileName = filteredDestinationFolder + File.separator + simpleFileName + "_filtered_" + ByteRateOfChange.dualSid(sid, "_") + "_middle.txt";
PrintWriter middle = new PrintWriter(new FileOutputStream(middleOutputFileName));
String decAndHex = middlePacket.getId() + "_" + Integer.toHexString(middlePacket.getId());

View File

@ -1,8 +1,7 @@
package com.rusefi.can.deprecated.decoders;
import com.rusefi.can.CANPacket;
import static com.rusefi.can.Utils.bytesToHexWithSpaces;
import com.rusefi.can.Utils;
public abstract class AbstractPacketDecoder implements PacketDecoder {
private final int id;
@ -21,6 +20,6 @@ public abstract class AbstractPacketDecoder implements PacketDecoder {
}
protected IllegalStateException unexpected(String reason, CANPacket packet) {
return new IllegalStateException(reason + ": " + bytesToHexWithSpaces(packet.getData()));
return new IllegalStateException(reason + ": " + Utils.bytesToHexWithSpaces(packet.getData()));
}
}

View File

@ -1,9 +1,9 @@
package com.rusefi.can.deprecated.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
public class Bmw0A9 extends AbstractPacketDecoder {

View File

@ -1,9 +1,9 @@
package com.rusefi.can.deprecated.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
public class Bmw0AA extends AbstractPacketDecoder {

View File

@ -1,9 +1,9 @@
package com.rusefi.can.deprecated.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
public class Bmw0B5 extends AbstractPacketDecoder {

View File

@ -1,9 +1,9 @@
package com.rusefi.can.deprecated.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
public class Bmw0BA extends AbstractPacketDecoder {

View File

@ -1,9 +1,9 @@
package com.rusefi.can.deprecated.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
/**

View File

@ -1,9 +1,9 @@
package com.rusefi.can.deprecated.decoders.bmw;
import com.rusefi.can.CANPacket;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.PacketPayload;
import com.rusefi.can.deprecated.SensorType;
import com.rusefi.can.SensorValue;
import com.rusefi.can.deprecated.decoders.AbstractPacketDecoder;
public class Bmw1D0 extends AbstractPacketDecoder {

View File

@ -1,9 +1,9 @@
package com.rusefi.can.reader;
import com.rusefi.can.CANPacket;
import com.rusefi.can.reader.impl.AutoFormatReader;
import com.rusefi.can.reader.impl.CANoeReader;
import com.rusefi.can.reader.impl.CanHackerReader;
import com.rusefi.can.reader.impl.*;
import java.io.IOException;
import java.nio.file.Files;

View File

@ -3,8 +3,6 @@ package com.rusefi.can.reader.impl;
import com.rusefi.can.CANPacket;
import com.rusefi.can.reader.CANLineReader;
import static com.rusefi.can.reader.impl.PcanTrcReader2_0.FILEVERSION;
/**
* @see PcanTrcReader2_0 for version 2.0 format
* TODO: merge these two?
@ -15,7 +13,7 @@ public class PcanTrcReader1_1 implements CANLineReader {
@Override
public CANPacket readLine(String line, String fileName, int lineIndex) {
line = line.trim();
if (line.startsWith(FILEVERSION) && !line.startsWith(FILEVERSION + "=1.1"))
if (line.startsWith(PcanTrcReader2_0.FILEVERSION) && !line.startsWith(PcanTrcReader2_0.FILEVERSION + "=1.1"))
throw new IllegalStateException("Unexpected fileversion " + line);
if (line.startsWith(";"))
return null;

View File

@ -4,8 +4,6 @@ import java.io.*;
import java.util.*;
import java.util.function.Function;
import static com.rusefi.sensor_logs.Fields.MLQ_FIELD_HEADER_NAME_OR_CATEGORY;
/**
* MLV .mlq binary log file
* https://www.efianalytics.com/TunerStudio/docs/MLG_Binary_LogFormat_1.0.pdf
@ -123,7 +121,7 @@ public class BinarySensorLog<T extends BinaryLogEntry> implements SensorLog, Aut
// 0000h type enum
stream.write(7);
// 0001h
writeLine(stream, name, MLQ_FIELD_HEADER_NAME_OR_CATEGORY);
writeLine(stream, name, Fields.MLQ_FIELD_HEADER_NAME_OR_CATEGORY);
// 0023h
writeLine(stream, unit, 10);
stream.write(0); // Display Style, 0=Float
@ -133,7 +131,7 @@ public class BinarySensorLog<T extends BinaryLogEntry> implements SensorLog, Aut
stream.writeFloat(0);
// 0036h precision digits
stream.write(2);
writeLine(stream, sensor.getCategory(), MLQ_FIELD_HEADER_NAME_OR_CATEGORY);
writeLine(stream, sensor.getCategory(), Fields.MLQ_FIELD_HEADER_NAME_OR_CATEGORY);
}
if (stream.size() != infoDataStart)
throw new IllegalStateException("We are doing something wrong :( stream.size=" + stream.size() + "/" + infoDataStart);