aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main/java/org/traccar/protocol/Gt06ProtocolDecoder.java6
1 files changed, 5 insertions, 1 deletions
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) {