inverting boolean, also better name
This commit is contained in:
parent
87a8ac1ca5
commit
2dfff3a3e9
|
@ -25,7 +25,7 @@ public class DbcField {
|
|||
}
|
||||
|
||||
public static int crazyMotorolaMath(int b, int length, boolean isBigEndian) {
|
||||
if (!DbcFile.applyOrderForStartOffset || !isBigEndian)
|
||||
if (DbcFile.compatibilityWithBrokenRusEfiLogic || !isBigEndian)
|
||||
return b;
|
||||
|
||||
// https://github.com/ebroecker/canmatrix/wiki/signal-Byteorder
|
||||
|
|
|
@ -17,7 +17,7 @@ public class DbcFile {
|
|||
* problem: looks like some DBC files which were created by AndreyB manually were invalid
|
||||
* this flag is technical debt of conversion from bad DBC into legit DBC
|
||||
*/
|
||||
public static boolean applyOrderForStartOffset = true;
|
||||
public static boolean compatibilityWithBrokenRusEfiLogic;
|
||||
|
||||
private List<BinaryLogEntry> list;
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.rusefi.can.reader.dbc;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static com.rusefi.can.reader.dbc.DbcFile.applyOrderForStartOffset;
|
||||
import static com.rusefi.can.reader.dbc.DbcFile.compatibilityWithBrokenRusEfiLogic;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
|
@ -10,7 +10,7 @@ public class DbcFieldTest {
|
|||
@Test
|
||||
public void testBigEndian() {
|
||||
{
|
||||
applyOrderForStartOffset = true;
|
||||
compatibilityWithBrokenRusEfiLogic = false;
|
||||
DbcField field = create(true);
|
||||
assertFalse(field.coversByte(1));
|
||||
assertFalse(field.coversByte(2));
|
||||
|
@ -18,13 +18,13 @@ public class DbcFieldTest {
|
|||
assertFalse(field.coversByte(0));
|
||||
}
|
||||
{
|
||||
applyOrderForStartOffset = false;
|
||||
compatibilityWithBrokenRusEfiLogic = true;
|
||||
DbcField field = create(true);
|
||||
assertTrue(field.coversByte(0));
|
||||
assertTrue(field.coversByte(1));
|
||||
assertFalse(field.coversByte(3));
|
||||
}
|
||||
applyOrderForStartOffset = true;
|
||||
compatibilityWithBrokenRusEfiLogic = false;
|
||||
}
|
||||
|
||||
private static DbcField create(boolean isBigEndian) {
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.junit.Test;
|
|||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.StringReader;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import static junit.framework.TestCase.assertEquals;
|
||||
import static org.junit.Assert.*;
|
||||
|
@ -124,7 +123,7 @@ public class ParseDBCTest {
|
|||
|
||||
|
||||
DbcFile dbc = new DbcFile(false);
|
||||
DbcFile.applyOrderForStartOffset = true;
|
||||
DbcFile.compatibilityWithBrokenRusEfiLogic = false;
|
||||
dbc.read(reader);
|
||||
|
||||
assertEquals(dbc.packets.size(), 1);
|
||||
|
@ -137,7 +136,7 @@ public class ParseDBCTest {
|
|||
|
||||
@Test
|
||||
public void crazyMotorola() {
|
||||
DbcFile.applyOrderForStartOffset = true;
|
||||
DbcFile.compatibilityWithBrokenRusEfiLogic = false;
|
||||
assertEquals(24, DbcField.crazyMotorolaMath(27, 4, true));
|
||||
assertEquals(24, DbcField.crazyMotorolaMath(30, 7, true));
|
||||
assertEquals(24, DbcField.crazyMotorolaMath(31, 8, true));
|
||||
|
|
Loading…
Reference in New Issue