diff --git a/java_console/inifile/src/com/rusefi/config/Field.java b/java_console/inifile/src/com/rusefi/config/Field.java index 881d5d229a..916fdf8cfd 100644 --- a/java_console/inifile/src/com/rusefi/config/Field.java +++ b/java_console/inifile/src/com/rusefi/config/Field.java @@ -159,12 +159,18 @@ public class Field { if (bitOffset != NO_BIT_OFFSET) { int packed = wrapped.getInt(); value = (packed >> bitOffset) & 1; - } else if (type == INT8 || type == UINT8) { + } else if (type == INT8) { value = wrapped.get(); + } else if (type == UINT8) { + byte signed = wrapped.get(); + value = signed & 0xFF; } else if (type == INT) { value = wrapped.getInt(); - } else if (type == INT16 || type == UINT16) { + } else if (type == INT16) { value = wrapped.getShort(); + } else if (type == UINT16) { + short signed = wrapped.getShort(); + value = signed & 0xFFFF; } else { value = wrapped.getFloat(); } diff --git a/java_console/ui/src/test/java/com/rusefi/ui/TuneReadWriteTest.java b/java_console/ui/src/test/java/com/rusefi/ui/TuneReadWriteTest.java index 2b43bf69e7..cb71620866 100644 --- a/java_console/ui/src/test/java/com/rusefi/ui/TuneReadWriteTest.java +++ b/java_console/ui/src/test/java/com/rusefi/ui/TuneReadWriteTest.java @@ -57,8 +57,7 @@ public class TuneReadWriteTest { ConfigurationImage binaryDataFromXml = tuneFromFile.asImage(IniFileModel.getInstance()); - // todo: why one byte mismatch? since it's in floats I kind of do not care, floats are weird - assertEquals(1, compareImages(originalBinaryData, binaryDataFromXml)); + assertEquals(0, compareImages(originalBinaryData, binaryDataFromXml)); Files.delete(path); }