From bc2714c786b0e9c604f00abebd06b4f96e1b8120 Mon Sep 17 00:00:00 2001 From: toxx36 <33377250+toxx36@users.noreply.github.com> Date: Sat, 14 Dec 2024 23:05:48 +0300 Subject: [PATCH] Fix Veteran bms negative temperature displaying MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use a signed type -- currently a negative temperature is displayed as 655.2°C, 652.0°C, etc. --- .../com/cooper/wheellog/utils/VeteranAdapter.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/com/cooper/wheellog/utils/VeteranAdapter.java b/app/src/main/java/com/cooper/wheellog/utils/VeteranAdapter.java index bc92bbae..7cfeb2d2 100644 --- a/app/src/main/java/com/cooper/wheellog/utils/VeteranAdapter.java +++ b/app/src/main/java/com/cooper/wheellog/utils/VeteranAdapter.java @@ -80,12 +80,12 @@ public boolean decode(byte[] data) { int cell = MathsUtil.shortFromBytesBE(buff, 59 + i * 2); bms.getCells()[i+30] = cell/1000.0; } - bms.setTemp1(MathsUtil.shortFromBytesBE(buff, 47)/100.0); - bms.setTemp2(MathsUtil.shortFromBytesBE(buff, 49)/100.0); - bms.setTemp3(MathsUtil.shortFromBytesBE(buff, 51)/100.0); - bms.setTemp4(MathsUtil.shortFromBytesBE(buff, 53)/100.0); - bms.setTemp5(MathsUtil.shortFromBytesBE(buff, 55)/100.0); - bms.setTemp6(MathsUtil.shortFromBytesBE(buff, 57)/100.0); + bms.setTemp1(MathsUtil.signedShortFromBytesBE(buff, 47)/100.0); + bms.setTemp2(MathsUtil.signedShortFromBytesBE(buff, 49)/100.0); + bms.setTemp3(MathsUtil.signedShortFromBytesBE(buff, 51)/100.0); + bms.setTemp4(MathsUtil.signedShortFromBytesBE(buff, 53)/100.0); + bms.setTemp5(MathsUtil.signedShortFromBytesBE(buff, 55)/100.0); + bms.setTemp6(MathsUtil.signedShortFromBytesBE(buff, 57)/100.0); bms.setMinCell(bms.getCells()[0]); bms.setMaxCell(bms.getCells()[0]); @@ -387,4 +387,4 @@ public static VeteranAdapter getInstance() { return INSTANCE; } -} \ No newline at end of file +}