ByteRateOfChangeReports shows relevant byte

This commit is contained in:
rusefillc 2024-03-22 11:45:19 -04:00
parent 6a04166862
commit e795581f6a
3 changed files with 8 additions and 2 deletions

View File

@ -3,6 +3,7 @@ package com.rusefi.can.analysis;
import com.rusefi.can.CANPacket;
import com.rusefi.can.Launcher;
import com.rusefi.can.reader.CANLineReader;
import com.rusefi.can.reader.dbc.DbcField;
import com.rusefi.can.reader.dbc.DbcFile;
import com.rusefi.can.reader.dbc.DbcPacket;
import com.rusefi.util.FolderUtil;
@ -55,6 +56,9 @@ public class ByteRateOfChangeReports {
DbcPacket packet = dbc.packets.get(id.sid);
if (packet != null) {
prefix = packet.getName() + " ";
DbcField field = packet.getFieldAtByte(id.byteIndex);
if (field != null)
prefix += field.getName() + " ";
}
}

View File

@ -126,9 +126,9 @@ public class DbcField {
public boolean coversByte(int byteIndex) {
int startBit = byteIndex * 8;
if (startOffset>startBit)
if (startOffset > startBit)
return false;
if (startOffset + length < byteIndex + 8)
if (startOffset + length < startBit + 8)
return false;
return true;
}

View File

@ -58,6 +58,8 @@ public class GetValueFromTrcTest {
DbcField byte1 = packet640.getFieldAtByte(1);
assertNotNull(byte1);
assertEquals("inneres_Motor_Moment", byte1.getName());
DbcField byte4 = packet640.getFieldAtByte(4);
assertNotNull(byte4);
assertNull(dbc.findPacket(1640));
String trcLine = " 3769) 2117.7 Rx 0280 8 01 1D DF 12 1E 00 1A 1E ";