From 381e25ab358de59c5b55a65767ada98b80d6d0f6 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Fri, 5 Jul 2024 19:30:21 -0700 Subject: Improve EV02 battery level --- src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/main/java/org') diff --git a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java index 372cf5f78..1d77f75d7 100644 --- a/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java +++ b/src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java @@ -859,7 +859,11 @@ public class Gt06ProtocolDecoder extends BaseProtocolDecoder { position.set(Position.KEY_POWER, buf.readUnsignedShort() * 0.01); } int battery = buf.readUnsignedByte(); - position.set(Position.KEY_BATTERY_LEVEL, battery <= 6 ? battery * 100 / 6 : battery); + if (battery <= 6) { + position.set(Position.KEY_BATTERY_LEVEL, battery * 100 / 6); + } else if (battery <= 100) { + position.set(Position.KEY_BATTERY_LEVEL, battery); + } position.set(Position.KEY_RSSI, buf.readUnsignedByte()); short alarmExtension = buf.readUnsignedByte(); if (variant != Variant.VXT01) { -- cgit v1.2.3